12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- extends TouchScreenButton
- onready var initpos = global_position
- onready var initpos2 = global_position
- var posswitch = true
- var text = ''
- var id = 0
- var collayer = 4
- func col():
- print(collayer)
- $col.collision_layer = collayer
- $col.collision_mask = collayer
- func _processUI(dict = [[0,0], [0,0], [0,0]]):
- $Label/icons/icon1.frame = dict[0][0]
- $Label/icons/icon1/stars.frame = dict[0][1]
- $Label/icons/icon2.frame = dict[1][0]
- $Label/icons/icon2/stars.frame = dict[1][1]
- $Label/icons/icon3.frame = dict[2][0]
- $Label/icons/icon3/stars.frame = dict[2][1]
- func _description(arg = ''):
- $Label/Label.text = arg
- $Label/icons.visible = arg == ''
- func _physics_process(delta):
- $Label.text = text
- $Label.show()
- global_position = initpos if posswitch else initpos2
- # if posswitch: global_position = initpos2
- if not posswitch: $Label.hide()
- # $col/CollisionShape2D.call_deferred('set_disabled', false)
- if is_pressed():
- # $col/CollisionShape2D.call_deferred('set_disabled', true)
- $Label.hide()
- global_position = get_global_mouse_position() - Vector2(32,32)
- func _on_Button_mouse_entered():
- print('mouse in')
- # $Label.show()
- pass # Replace with function body.
- func _on_Button_mouse_exited():
- print('mouse out')
- # $Label.hide()
- pass # Replace with function body.
|