Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Commit

Permalink
Fix bug where evolve timer was not stopped on unevolve
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
Jacalz committed May 7, 2021
1 parent 356cbad commit 1bd84c5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
11 changes: 6 additions & 5 deletions Enteties/Chameleon/Chameleon.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ animations = [ {
"name": "Idle_evolved",
"speed": 5.0
}, {
"frames": [ ExtResource( 10 ) ],
"loop": false,
"name": "Jump",
"speed": 1.0
}, {
"frames": [ ExtResource( 2 ), ExtResource( 3 ) ],
"loop": true,
"name": "Walk",
Expand All @@ -42,6 +37,11 @@ animations = [ {
"name": "Idle",
"speed": 1.0
}, {
"frames": [ ExtResource( 10 ) ],
"loop": false,
"name": "Jump",
"speed": 1.0
}, {
"frames": [ ExtResource( 6 ), ExtResource( 9 ) ],
"loop": true,
"name": "Walk_evolved",
Expand Down Expand Up @@ -185,6 +185,7 @@ margin_right = 12.0
margin_bottom = 20.0
custom_fonts/font = SubResource( 6 )
text = " Exit to titlescreen "

[connection signal="on_grounded_updated" from="." to="Camera2D" method="_on_Chameleon_on_grounded_updated"]
[connection signal="timeout" from="Camouflage/Timer" to="Camouflage" method="_on_Timer_timeout"]
[connection signal="timeout" from="EvolveTimer" to="." method="_on_Initial_timeout"]
Expand Down
4 changes: 4 additions & 0 deletions Enteties/Chameleon/chameleon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ var velocity = Vector2()
var evolve_anim = ""
var flip_h = true

func _on_unevolving():
evolve_timer.stop()
_on_Evolve_timeout()

func _on_Initial_timeout():
# Flicker 4 times
for i in 4:
Expand Down
2 changes: 1 addition & 1 deletion Enteties/Enemies/AloeVera/aloevera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ func _on_Area2D_body_entered(body):
yield(get_tree().create_timer(0.25), "timeout")
assert(get_tree().reload_current_scene() == OK)
else:
body.evolve_anim = ""
body._on_unevolving()
2 changes: 1 addition & 1 deletion Enteties/Enemies/Lizard/lizard.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func _on_Area2D_body_entered(body):
assert(get_tree().reload_current_scene() == OK)
elif body.flip_h != ASprite.flip_h: # Player is looking away if flip_h values are not equal
ASprite.play("block")
body.evolve_anim = ""
body._on_unevolving()
ASprite.play("move")
else:
queue_free()
2 changes: 1 addition & 1 deletion Enteties/Enemies/Scorpion/scorpion.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func _on_KillerInstinct_body_entered(body):
elif body.flip_h == ASprite.flip_h: # Player is looking away if flip_h values are equal
ASprite.position.y += 15
ASprite.play("attack")
body.evolve_anim = ""
body._on_unevolving()
ASprite.position.y -= 15
ASprite.play("move")
else:
Expand Down

0 comments on commit 1bd84c5

Please sign in to comment.