1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-24 21:54:18 +00:00

🐛 Fix replay button

This commit is contained in:
Steffo 2022-04-05 01:32:49 +02:00
parent f9857e700c
commit ac65b1a446
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 22 additions and 10 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://src/entities/players/AbstractPlayer.tscn" type="PackedScene" id=1] [ext_resource path="res://src/entities/players/AbstractPlayer.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/behaviours/spawning/ShootOnClick.tscn" type="PackedScene" id=2] [ext_resource path="res://src/behaviours/spawning/ShootOnClick.tscn" type="PackedScene" id=2]
@ -7,6 +7,7 @@
[ext_resource path="res://src/entities/players/CharacterFrontLeft.png" type="Texture" id=5] [ext_resource path="res://src/entities/players/CharacterFrontLeft.png" type="Texture" id=5]
[ext_resource path="res://src/entities/players/CharacterFront.png" type="Texture" id=6] [ext_resource path="res://src/entities/players/CharacterFront.png" type="Texture" id=6]
[ext_resource path="res://src/behaviours/graphics/FourSidedSprite.gd" type="Script" id=7] [ext_resource path="res://src/behaviours/graphics/FourSidedSprite.gd" type="Script" id=7]
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=8]
[sub_resource type="CapsuleShape2D" id=3] [sub_resource type="CapsuleShape2D" id=3]
radius = 9.0 radius = 9.0
@ -59,4 +60,9 @@ container_name = "Bullets"
[node name="ShootOnClick" parent="SpawnOnShoot" index="2" instance=ExtResource( 2 )] [node name="ShootOnClick" parent="SpawnOnShoot" index="2" instance=ExtResource( 2 )]
[node name="Light" type="Light2D" parent="." index="5"]
texture = ExtResource( 8 )
texture_scale = 0.1
color = Color( 1, 1, 1, 0.12549 )
[connection signal="moved_in_direction" from="PlayerMovement" to="Shape/FourSidedSprite" method="_on_PlayerMovement_moved_in_direction"] [connection signal="moved_in_direction" from="PlayerMovement" to="Shape/FourSidedSprite" method="_on_PlayerMovement_moved_in_direction"]

View file

@ -4,13 +4,15 @@ extends Node2D
export(PackedScene) var main_menu = preload("res://src/levels/mainmenu/MainMenu.tscn") export(PackedScene) var main_menu = preload("res://src/levels/mainmenu/MainMenu.tscn")
export(PackedScene) var phase_one = preload("res://src/levels/phaseone/PhaseOne.tscn") export(PackedScene) var phase_one = preload("res://src/levels/phaseone/PhaseOne.tscn")
export(PackedScene) var user_interface = preload("res://src/levels/ui/UserInterface.tscn") export(PackedScene) var user_interface = preload("res://src/levels/ui/UserInterface.tscn")
export(PackedScene) var bad_ending = preload("res://src/levels/endings/BadEnding.tscn")
export(PackedScene) var good_ending = preload("res://src/levels/endings/GoodEnding.tscn")
func _ready(): func _ready():
print("Starting from the menu!") print("Starting from the menu!")
add_child(main_menu.instance()) add_child(main_menu.instance())
# warning-ignore: RETURN_VALUE_DISCARDED # warning-ignore: RETURN_VALUE_DISCARDED
$MainMenu/TheDarkNightUI/Play.connect("pressed", self, "_on_MainMenu_Play_pressed") $MainMenu/TheDarkNightUI/Play.connect("pressed", self, "_on_MainMenu_Play_pressed", [])
func _on_MainMenu_Play_pressed(): func _on_MainMenu_Play_pressed():
@ -19,25 +21,27 @@ func _on_MainMenu_Play_pressed():
func _on_Fire_died(_origin, _value): func _on_Fire_died(_origin, _value):
print("Should move to the second phase...")
$PhaseOne.queue_free() $PhaseOne.queue_free()
$UserInterface.queue_free()
add_child(bad_ending.instance()) add_child(bad_ending.instance())
# warning-ignore: RETURN_VALUE_DISCARDED # warning-ignore: RETURN_VALUE_DISCARDED
$BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed") $BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed", [])
func _on_Player_died(_origin, _value): func _on_Player_died(_origin, _value):
print("Should display a bad end...") print("Should display a bad end...")
$PhaseOne.queue_free() $PhaseOne.queue_free()
$UserInterface.queue_free()
add_child(bad_ending.instance()) add_child(bad_ending.instance())
# warning-ignore: RETURN_VALUE_DISCARDED # warning-ignore: RETURN_VALUE_DISCARDED
$BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed") $BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed", [])
func _on_BadEnding_Replay_pressed(): func _on_BadEnding_Replay_pressed():
$BadEnding.queue_free() $BadEnding.queue_free()
_on_Play_pressed() _on_Play_pressed()
func _on_Play_pressed(): func _on_Play_pressed():
print("Moving to the first phase...") print("Moving to the first phase...")
add_child(phase_one.instance()) add_child(phase_one.instance())
@ -52,3 +56,5 @@ func _on_Play_pressed():
$UserInterface/TheDarkNightUI/MuteButton.connect("toggled", $Music, "_on_MuteButton_toggled") $UserInterface/TheDarkNightUI/MuteButton.connect("toggled", $Music, "_on_MuteButton_toggled")
# warning-ignore: RETURN_VALUE_DISCARDED # warning-ignore: RETURN_VALUE_DISCARDED
$PhaseOne/Entities/PhaseOnePlayer/Damageable.connect("health_changed", $UserInterface/TheDarkNightUI/HealthBar, "_on_PhaseOnePlayer_health_changed") $PhaseOne/Entities/PhaseOnePlayer/Damageable.connect("health_changed", $UserInterface/TheDarkNightUI/HealthBar, "_on_PhaseOnePlayer_health_changed")
# warning-ignore: RETURN_VALUE_DISCARDED
$PhaseOne/Entities/PhaseOnePlayer/Damageable.connect("health_reached_min", self, "_on_Player_died")

View file

@ -84,7 +84,7 @@ margin_top = 300.0
position = Vector2( 421, -275 ) position = Vector2( 421, -275 )
scale = Vector2( 4, 4 ) scale = Vector2( 4, 4 )
[node name="Damaging" parent="TheDarkNightUI/MenuFire" index="3"] [node name="FlameSprite" parent="TheDarkNightUI/MenuFire/Flame/Shape" index="0"]
damage = -5.0 frame = 0
[editable path="TheDarkNightUI/MenuFire"] [editable path="TheDarkNightUI/MenuFire"]

View file

@ -51,7 +51,7 @@ align = 2
valign = 1 valign = 1
script = ExtResource( 4 ) script = ExtResource( 4 )
[node name="TextureProgress" type="TextureProgress" parent="TheDarkNightUI"] [node name="HealthBar" type="TextureProgress" parent="TheDarkNightUI"]
margin_left = 15.0 margin_left = 15.0
margin_top = 15.0 margin_top = 15.0
margin_right = 365.0 margin_right = 365.0