1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-24 09:04:21 +00:00

Add invicibility cheat

This commit is contained in:
Steffo 2021-06-10 18:15:15 +02:00
parent 4730621df0
commit eea7ba9c2f
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 22 additions and 6 deletions

View file

@ -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
@ -77,6 +78,15 @@ func _process(delta):
$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):
var up_normal = up_normal()
@ -128,12 +138,13 @@ 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)
print("You collected %d loops." % loops_collected)
if not invincible:
$Body.visible = false
$Donut.visible = false
$Legs.visible = false

View file

@ -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]