diff --git a/Objects/SpecialObjects/Player.gd b/Objects/SpecialObjects/Player.gd index f1513d1..debcd4e 100644 --- a/Objects/SpecialObjects/Player.gd +++ b/Objects/SpecialObjects/Player.gd @@ -10,6 +10,7 @@ export(float) var jump_speed: float = 425 export(float) var jump_buffer_msec: float = 80 export(float) var quick_fall_gravity_multiplier: float = 4 export(bool) var stop_jump_on_bonk: bool = true +export(bool) var invincible: bool = false var speed: Vector2 = Vector2.ZERO var can_jump: bool = false @@ -76,6 +77,15 @@ func _process(delta): $Body.animation = "neutral" $Donut.animation = "neutral" $Legs.animation = "neutral" + + if Input.is_action_just_pressed("cheat_invincible"): + if invincible: + $Body.modulate = Color.white + $Legs.modulate = Color.white + else: + $Body.modulate = Color.cyan + $Legs.modulate = Color.cyan + invincible = not invincible func _physics_process(_delta): @@ -128,16 +138,17 @@ func _physics_process(_delta): func win(): print("YOU WIN!") - print("You collected %s loops." % loops_collected) + print("You collected %d loops." % loops_collected) $FadeTo/AnimationPlayer.play("FadeToWhite") func die(): print("YOU DIED") - print("You collected %s loops." % loops_collected) - $Body.visible = false - $Donut.visible = false - $Legs.visible = false - $FadeTo/AnimationPlayer.play("FadeToBlack") + print("You collected %d loops." % loops_collected) + if not invincible: + $Body.visible = false + $Donut.visible = false + $Legs.visible = false + $FadeTo/AnimationPlayer.play("FadeToBlack") func _on_WinDoor_body_entered(body): diff --git a/project.godot b/project.godot index 5dc2267..31b6ad1 100644 --- a/project.godot +++ b/project.godot @@ -184,6 +184,11 @@ cheat_slower={ "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777249,"unicode":0,"echo":false,"script":null) ] } +cheat_invincible={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777252,"unicode":0,"echo":false,"script":null) + ] +} [layer_names]