Player bump now moves with camera transition.

This commit is contained in:
Nitsud Yarg 2024-06-23 11:00:07 -07:00
parent 0194c26e8e
commit 87c0e8f05f

View File

@ -58,7 +58,17 @@ func update_grid_position():
jump_to_grid_position() jump_to_grid_position()
#wait for stability. #wait for stability.
player_node.global_translate(Vector2(0,-10)) player_node.global_translate(Vector2(0,-10))
yield(timer, "timeout") var a_tenth_of_the_time = int((timer.time_left / timer.wait_time) * 10)
while a_tenth_of_the_time != 0:
#print(a_tenth_of_the_time)
var time_ticks = int((timer.time_left / timer.wait_time) * 10)
if time_ticks != a_tenth_of_the_time:
print("Shifting Player Downward :", a_tenth_of_the_time)
a_tenth_of_the_time = time_ticks
player_node.global_translate(Vector2(0,-5))
# WEIRD!? You have to add this at the end of a while loop or it gets stuck.
yield(get_tree(), "idle_frame")
#yield(timer, "timeout")
$Camera2D.smoothing_enabled = false $Camera2D.smoothing_enabled = false
get_tree().paused = false get_tree().paused = false
elif !$Down.is_colliding() and grid_position.y < new_grid_position.y: elif !$Down.is_colliding() and grid_position.y < new_grid_position.y:
@ -68,10 +78,17 @@ func update_grid_position():
$Camera2D.smoothing_enabled = true $Camera2D.smoothing_enabled = true
jump_to_grid_position() jump_to_grid_position()
# FINALLY Got one that works. I tried all sorts of stuff to move this thing!? # FINALLY Got one that works. I tried all sorts of stuff to move this thing!?
player_node.global_translate(Vector2(0,10)) var a_tenth_of_the_time = int((timer.time_left / timer.wait_time) * 10)
# while(timer.time_left > 0): while a_tenth_of_the_time != 0:
# timer.time_left / timer.wait_time #print(a_tenth_of_the_time)
yield(timer, "timeout") var time_ticks = int((timer.time_left / timer.wait_time) * 10)
if time_ticks != a_tenth_of_the_time:
print("Shifting Player Downward :", a_tenth_of_the_time)
a_tenth_of_the_time = time_ticks
player_node.global_translate(Vector2(0,2))
# WEIRD!? You have to add this at the end of a while loop or it gets stuck.
yield(get_tree(), "idle_frame")
#yield(timer, "timeout")
$Camera2D.smoothing_enabled = false $Camera2D.smoothing_enabled = false
get_tree().paused = false get_tree().paused = false
else: else: