Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Scenes/Gameplay/Level1/Level1.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,13 @@ valign = 1

[node name="BackgroundMusic" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 7 )
autoplay = true
volume_db = -80.0
autoplay = true

[node name="HUD" parent="." instance=ExtResource( 8 )]

[node name="Tween" type="Tween" parent="."]

[connection signal="damage_taken" from="Spaceship" to="HUD" method="_on_Spaceship_damage_taken"]
[connection signal="damage_taken" from="Spaceship" to="ShakeCamera" method="_on_Spaceship_damage_taken"]
[connection signal="game_over" from="HUD" to="ShakeCamera" method="_on_HUD_game_over"]
[connection signal="game_over" from="HUD" to="Spaceship" method="_on_game_over"]
[connection signal="game_over" from="HUD" to="ShakeCamera" method="_on_HUD_game_over"]
2 changes: 1 addition & 1 deletion Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ volume_db = -40.0
autoplay = true

[node name="Tween" type="Tween" parent="."]
[connection signal="transition_updated" from="ScrollingBackground" to="ScrollingFarBuildings" method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="ScrollingBuildings" method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="ScrollingFarBuildings" method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="." method="_on_ScrollingBackground_transition_updated"]
[connection signal="transition_updated" from="ScrollingBackground" to="UILayer/MainButtons" method="_on_ScrollingBackground_transition_updated"]
[connection signal="optionsButtonClicked" from="UILayer/MainButtons" to="UILayer" method="_on_MainButtons_optionsButtonClicked"]
Expand Down
9 changes: 3 additions & 6 deletions Scenes/Spaceship/Spaceship.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export(float, 0, 10, .5) var recovery_time = 3

enum State {IDLE, RECOVERY, DEAD}
export(State) var current_state = State.IDLE
var lives = 5

var next_shot = 0
var viewport_size
Expand Down Expand Up @@ -63,7 +62,6 @@ func _on_PowerupTimer_timeout() -> void:


func _on_game_over():
lives = 0
current_state = State.DEAD
$ExplosionParticleSystem/ExplosionSound.play()
$ExplosionParticleSystem.start_emission()
Expand All @@ -74,12 +72,11 @@ func _on_game_over():


func handle_collision():
if(lives != 0 && current_state == State.IDLE):
lives=lives-1
emit_signal("damage_taken")
if(current_state == State.IDLE):
$HitSound.play()
recovery_timer.start()
current_state = State.RECOVERY
emit_signal("damage_taken")


func init_controls():
Expand Down Expand Up @@ -123,7 +120,7 @@ func handle_damage_visual_effects():


func handle_movement(d):
if lives != 0:
if current_state != State.DEAD:
var direction = Vector2(0, 0)
if get_command("W").isPressed():
direction.y =- 1
Expand Down