add fade_node and input to Globals
This commit is contained in:
parent
a826f6a510
commit
7ca192026d
@ -36,6 +36,19 @@ project/assembly_name="Semi-Idle ARPG"
|
||||
|
||||
enabled=PackedStringArray("res://addons/godot-vim/plugin.cfg")
|
||||
|
||||
[input]
|
||||
|
||||
game_speed_fast={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":61,"key_label":0,"unicode":61,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
game_speed_normal={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":45,"key_label":0,"unicode":45,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
common/physics_ticks_per_second=120
|
||||
|
@ -2,6 +2,8 @@
|
||||
extends Node
|
||||
|
||||
|
||||
var debugSpeedEnabled : bool
|
||||
|
||||
class World:
|
||||
enum Zone {
|
||||
TUTORIAL,
|
||||
@ -50,3 +52,29 @@ class Ability:
|
||||
func debug_print(value: String) -> void:
|
||||
if OS.is_debug_build():
|
||||
print(value)
|
||||
|
||||
|
||||
func fade_node(node: Node, direction: String, duration: float) -> void:
|
||||
var modulation_step = 1.0 / (100 * duration)
|
||||
match direction:
|
||||
"in":
|
||||
node.modulate.a = 0
|
||||
node.show()
|
||||
while node.modulate.a < 1:
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
node.modulate.a += modulation_step
|
||||
"out":
|
||||
node.modulate.a = 1
|
||||
while node.modulate.a > 0:
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
node.modulate.a -= modulation_step
|
||||
node.hide()
|
||||
_:
|
||||
print("Unknown fade direction")
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("game_speed_fast"):
|
||||
Engine.time_scale = 10.0
|
||||
if event.is_action_pressed("game_speed_normal"):
|
||||
Engine.time_scale = 1.0
|
||||
|
@ -51,12 +51,14 @@ func _continue_button_show() -> void:
|
||||
# %UITop/ContinueButton.modulate.a += 0.05
|
||||
%UITop/ContinueButton.show()
|
||||
while %UITop/ContinueButton.modulate.a < 1:
|
||||
# 50 steps 1/100th of a second apart for a total 1/2 second animation
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
%UITop/ContinueButton.modulate.a += 0.02
|
||||
|
||||
|
||||
func _continue_button_hide() -> void:
|
||||
while %UITop/ContinueButton.modulate.a > 0:
|
||||
# 20 steps 1/100th of a second apart for a total 1/5 second animation
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
%UITop/ContinueButton.modulate.a -= 0.05
|
||||
%UITop/ContinueButton.hide()
|
||||
@ -75,7 +77,8 @@ func _go_next_area() -> void:
|
||||
# Globals.debug_print("gna quest queued to free")
|
||||
_create_area()
|
||||
# Globals.debug_print("gna new area created")
|
||||
_continue_button_hide()
|
||||
# _continue_button_hide()
|
||||
Globals.fade_node(%UITop/ContinueButton, "out", 0.5)
|
||||
canContinue = false
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user