You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
823 B
31 lines
823 B
extends Node2D
|
|
class_name GGameState
|
|
|
|
signal restore_checkpoint(level)
|
|
|
|
var level_rising_height_now = 0
|
|
var level_rising_height_at_death = 0
|
|
|
|
var player_position_at_checkpoint = Vector2(0, 0)
|
|
|
|
var must_restore_checkpoint = false
|
|
|
|
func reset():
|
|
level_rising_height_now = 0
|
|
level_rising_height_at_death = 0
|
|
|
|
func save_level_rising_height(now):
|
|
if must_restore_checkpoint:
|
|
restore_checkpoint_now()
|
|
must_restore_checkpoint = false
|
|
else :
|
|
level_rising_height_now = now
|
|
|
|
func checkpoint(player_position):
|
|
level_rising_height_at_death = level_rising_height_now
|
|
player_position_at_checkpoint = player_position
|
|
|
|
func restore_checkpoint_now():
|
|
prints('restoring with', level_rising_height_at_death)
|
|
level_rising_height_now = level_rising_height_at_death
|
|
emit_signal("restore_checkpoint", level_rising_height_at_death)
|
|
|