TouchScreenButton.gd 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. extends TouchScreenButton
  2. onready var initpos = global_position
  3. onready var initpos2 = global_position
  4. var posswitch = true
  5. var text = ''
  6. var id = 0
  7. var collayer = 4
  8. func col():
  9. print(collayer)
  10. $col.collision_layer = collayer
  11. $col.collision_mask = collayer
  12. func _processUI(dict = [[0,0], [0,0], [0,0]]):
  13. $Label/icons/icon1.frame = dict[0][0]
  14. $Label/icons/icon1/stars.frame = dict[0][1]
  15. $Label/icons/icon2.frame = dict[1][0]
  16. $Label/icons/icon2/stars.frame = dict[1][1]
  17. $Label/icons/icon3.frame = dict[2][0]
  18. $Label/icons/icon3/stars.frame = dict[2][1]
  19. func _description(arg = ''):
  20. $Label/Label.text = arg
  21. $Label/icons.visible = arg == ''
  22. func _physics_process(delta):
  23. $Label.text = text
  24. $Label.show()
  25. global_position = initpos if posswitch else initpos2
  26. if not posswitch: $Label.hide()
  27. if is_pressed():
  28. $Label.hide()
  29. global_position = get_global_mouse_position() - Vector2(32,32)
  30. func _on_Button_mouse_entered():
  31. print('mouse in')
  32. pass # Replace with function body.
  33. func _on_Button_mouse_exited():
  34. print('mouse out')
  35. pass # Replace with function body.