menu.gd 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. extends Control
  2. var texture_orig=load("res://menu_textures/orig_1.png") as Texture
  3. var texture_glow1=load("res://menu_textures/glow_1.png") as Texture
  4. var texture_glow2=load("res://menu_textures/glow_2.png") as Texture
  5. var texture_glow3=load("res://menu_textures/glow_3.png") as Texture
  6. var texture_glow4=load("res://menu_textures/glow_4.png") as Texture
  7. var glow1=0.0
  8. var glow2=0.0
  9. var glow3=0.0
  10. var glow4=0.0
  11. var glowg=1.0
  12. var glow1b=false
  13. var glow2b=false
  14. var glow3b=false
  15. var glow4b=false
  16. func _ready():
  17. pass
  18. func _process(delta):
  19. var any_of=false
  20. if(glow1b):
  21. glow1+=delta
  22. any_of=any_of||(glow1>=1)
  23. else:
  24. glow1+=-delta
  25. if(glow2b):
  26. glow2+=delta
  27. any_of=any_of||(glow2>=1)
  28. else:
  29. glow2+=-delta
  30. if(glow3b):
  31. glow3+=delta
  32. any_of=any_of||(glow3>=1)
  33. else:
  34. glow3+=-delta
  35. if(glow4b):
  36. glow4+=delta
  37. any_of=any_of||(glow4>=1)
  38. else:
  39. glow4+=-delta
  40. if(any_of):
  41. glowg+=-delta
  42. else:
  43. glowg=1.0
  44. glow1=clamp(glow1,0,1)
  45. glow2=clamp(glow2,0,1)
  46. glow3=clamp(glow3,0,1)
  47. glow4=clamp(glow4,0,1)
  48. glowg=clamp(glowg,0,1)
  49. get_node("menu_texture").material.set("shader_param/glow1",glow1)
  50. get_node("menu_texture").material.set("shader_param/glow2",glow2)
  51. get_node("menu_texture").material.set("shader_param/glow3",glow3)
  52. get_node("menu_texture").material.set("shader_param/glow4",glow4)
  53. get_node("menu_texture").material.set("shader_param/glowg",glowg)
  54. func _on_b1_pressed():
  55. get_node("popup").popup_centered(Vector2(320,240))
  56. func _on_b1_button_down():
  57. glow1=1.0
  58. glow1b=true
  59. func _on_b1_button_up():
  60. glow1b=false
  61. func _on_b1_mouse_entered():
  62. glow1b=true
  63. func _on_b1_mouse_exited():
  64. glow1b=false
  65. func _on_b2_pressed():
  66. get_node("popup").popup_centered(Vector2(320,240))
  67. func _on_b2_button_down():
  68. glow2=1.0
  69. glow2b=true
  70. func _on_b2_button_up():
  71. glow2b=false
  72. func _on_b2_mouse_entered():
  73. glow2b=true
  74. func _on_b2_mouse_exited():
  75. glow2b=false
  76. func _on_b3_pressed():
  77. get_node("popup").popup_centered(Vector2(320,240))
  78. func _on_b3_button_down():
  79. glow3=1.0
  80. glow3b=true
  81. func _on_b3_button_up():
  82. glow3b=false
  83. func _on_b3_mouse_entered():
  84. glow3b=true
  85. func _on_b3_mouse_exited():
  86. glow3b=false
  87. func _on_b4_pressed():
  88. get_node("popup").popup_centered(Vector2(320,240))
  89. func _on_b4_button_down():
  90. glow4=1.0
  91. glow4b=true
  92. func _on_b4_button_up():
  93. glow4b=false
  94. func _on_b4_mouse_entered():
  95. glow4b=true
  96. func _on_b4_mouse_exited():
  97. glow4b=false