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

💥 AAAAAAAAAAAAAAAAAAA

This commit is contained in:
Steffo 2022-04-05 02:41:13 +02:00
parent 7efbf2b1b8
commit e9284b5f46
Signed by: steffo
GPG key ID: 6965406171929D01
18 changed files with 408 additions and 68 deletions

View file

@ -3,3 +3,11 @@ class_name Utils
static func is_between(m, val, x):
return (m < val) && (val <= x)
static func format_time(value):
var minutes: int = floor(value / 60)
var seconds_and_millis: float = value - minutes * 60
var seconds: int = int(seconds_and_millis)
var millis: int = int((seconds_and_millis - seconds) * 1000)
return "%01d:%02d.%03d" % ([minutes, seconds, millis])

View file

@ -6,4 +6,4 @@ onready var parent = get_parent()
func _process(_delta):
parent.shoot(parent.rotation)
parent.shoot(parent.parent.rotation)

View file

@ -10,5 +10,6 @@ script = ExtResource( 1 )
wait_time = 0.3
one_shot = true
[node name="Sound" type="AudioStreamPlayer2D" parent="."]
[node name="Sound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 2 )
volume_db = -8.0

View file

@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/entities/bullets/AbstractBullet.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/entities/bullets/MeltinatorLaserBeam.png" type="Texture" id=2]
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 6, 1.5 )
[node name="LaserBeam" instance=ExtResource( 1 )]
[node name="BulletMovement" parent="." index="0"]
movement_per_second = 800.0
[node name="Shape" type="CollisionShape2D" parent="." index="2"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
scale = Vector2( 12, 1 )
texture = ExtResource( 2 )
[node name="Light" type="Light2D" parent="." index="3"]
texture = ExtResource( 3 )
texture_scale = 0.15
color = Color( 1, 0.294118, 0, 1 )

View file

@ -19,7 +19,7 @@ compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/repeat=1
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false

View file

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/Snowflake.png-e248e372833c2aa730b5b6d333276836.stex"
path="res://.import/Snowflake.png-2ff4a87cc6064319f83f31f66c433ca5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/mechanics/Snowflake.png"
dest_files=[ "res://.import/Snowflake.png-e248e372833c2aa730b5b6d333276836.stex" ]
source_file="res://src/entities/bullets/Snowflake.png"
dest_files=[ "res://.import/Snowflake.png-2ff4a87cc6064319f83f31f66c433ca5.stex" ]
[params]

View file

@ -0,0 +1,21 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/entities/bullets/AbstractBullet.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/entities/bullets/Snowflake.png" type="Texture" id=2]
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 8.0
[node name="Snowflake" instance=ExtResource( 1 )]
[node name="Shape" type="CollisionShape2D" parent="." index="2"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
texture = ExtResource( 2 )
[node name="Light" type="Light2D" parent="Shape/Sprite" index="0"]
texture = ExtResource( 3 )
texture_scale = 0.02
color = Color( 0, 1, 0.976471, 1 )

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/entities/enemies/EnemySpider.png" type="Texture" id=1]
[ext_resource path="res://src/entities/enemies/EnemySpiderSanta.png" type="Texture" id=1]
[ext_resource path="res://src/entities/enemies/AbstractEnemy.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 33.0
@ -13,3 +14,9 @@ shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
texture = ExtResource( 1 )
[node name="Light" type="Light2D" parent="Shape/Sprite" index="0"]
position = Vector2( 1, 0 )
texture = ExtResource( 3 )
texture_scale = 0.3
color = Color( 0.666667, 0.901961, 0.878431, 1 )

View file

@ -1,49 +1,38 @@
extends Node2D
signal started_main_menu(origin)
signal started_phase_one(origin)
signal started_phase_two(origin)
signal started_bad_ending(origin)
signal started_good_ending(origin)
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_two = preload("res://src/levels/phasetwo/PhaseTwo.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")
var score
func _ready():
print("Starting from the menu!")
start_menu()
func start_menu():
add_child(main_menu.instance())
# warning-ignore: RETURN_VALUE_DISCARDED
$MainMenu/TheDarkNightUI/Play.connect("pressed", self, "_on_MainMenu_Play_pressed", [])
emit_signal("started_main_menu", self)
func _on_MainMenu_Play_pressed():
$MainMenu.queue_free()
_on_Play_pressed()
func _on_Fire_died(_origin, _value):
$PhaseOne.queue_free()
$UserInterface.queue_free()
add_child(bad_ending.instance())
# warning-ignore: RETURN_VALUE_DISCARDED
$BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed", [])
func _on_Player_died(_origin, _value):
print("Should display a bad end...")
$PhaseOne.queue_free()
$UserInterface.queue_free()
add_child(bad_ending.instance())
# warning-ignore: RETURN_VALUE_DISCARDED
$BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed", [])
func _on_BadEnding_Replay_pressed():
$BadEnding.queue_free()
_on_Play_pressed()
func _on_Play_pressed():
print("Moving to the first phase...")
func start_one():
print("Phase one!")
add_child(phase_one.instance())
add_child(user_interface.instance())
# warning-ignore: RETURN_VALUE_DISCARDED
@ -51,10 +40,55 @@ func _on_Play_pressed():
# warning-ignore: RETURN_VALUE_DISCARDED
$PhaseOne/Entities/Fire/Firepit/Damageable.connect("health_changed", $Music, "_on_Fire_intensity_changed")
# warning-ignore: RETURN_VALUE_DISCARDED
$PhaseOne/Entities/Fire/Firepit/Damageable.connect("health_reached_min", self, "_on_Fire_died")
$PhaseOne/Entities/Fire/Firepit/Damageable.connect("health_reached_min", self, "_on_Fire_died", [], CONNECT_ONESHOT)
# warning-ignore: RETURN_VALUE_DISCARDED
$UserInterface/TheDarkNightUI/MuteButton.connect("toggled", $Music, "_on_MuteButton_toggled")
# warning-ignore: RETURN_VALUE_DISCARDED
$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")
$PhaseOne/Entities/PhaseOnePlayer/Damageable.connect("health_reached_min", self, "_on_Player_died", [], CONNECT_ONESHOT)
emit_signal("started_phase_one", self)
func start_two():
print("Phase two!")
add_child(phase_two.instance())
emit_signal("started_phase_two", self)
func start_good():
print("Good ending!!!")
add_child(good_ending.instance())
emit_signal("started_good_ending", self)
func start_bad():
print("Bad ending...")
score = $PhaseOne.survival_seconds
add_child(bad_ending.instance())
# warning-ignore: RETURN_VALUE_DISCARDED
$BadEnding/TheDarkNightUI/Play.connect("pressed", self, "_on_BadEnding_Replay_pressed", [])
$BadEnding/TheDarkNightUI/Score.text = Utils.format_time(score)
emit_signal("started_bad_ending", self)
func _on_Fire_died(_origin, _value):
$PhaseOne.queue_free()
$UserInterface.queue_free()
start_bad()
func _on_Player_died(_origin, _value):
$PhaseOne.queue_free()
$UserInterface.queue_free()
start_bad()
func _on_MainMenu_Play_pressed():
$MainMenu.queue_free()
start_one()
func _on_BadEnding_Replay_pressed():
$BadEnding.queue_free()
start_one()

View file

@ -22,34 +22,31 @@ script = ExtResource( 11 )
[node name="Bell" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 20 )
volume_db = -80.0
autoplay = true
[node name="Choir" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 21 )
volume_db = -80.0
autoplay = true
[node name="Drum" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 19 )
volume_db = -80.0
autoplay = true
[node name="BossDrum" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 3 )
volume_db = -80.0
autoplay = true
[node name="BossGuitar" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 7 )
volume_db = -80.0
autoplay = true
[node name="FireCrackle" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 1 )
volume_db = -80.0
autoplay = true
[node name="Wind" type="AudioStreamPlayer" parent="Music"]
stream = ExtResource( 2 )
volume_db = -80.0
autoplay = true
[connection signal="started_bad_ending" from="." to="Music" method="_on_Game_started_bad_ending"]
[connection signal="started_main_menu" from="." to="Music" method="_on_Game_started_main_menu"]
[connection signal="started_phase_one" from="." to="Music" method="_on_Game_started_phase_one"]

View file

@ -8,13 +8,11 @@ export var bell_min: float = 40
export var bell_max: float = 100
export var drum_min: float = 100
export var drum_max: float = 160
export var crackle_min: float = 0
export var crackle_max: float = 170
export var muted: bool setget set_mute, get_mute
func _ready():
update_state()
func set_mute(value):
var index = AudioServer.get_bus_index("Master")
AudioServer.set_bus_mute(index, value)
@ -30,17 +28,48 @@ func update_state():
$Drum.bus = "Master" if $Drum.volume_db > -60 else "Mute"
$BossDrum.bus = "Master" if $BossDrum.volume_db > -60 else "Mute"
$BossGuitar.bus = "Master" if $BossGuitar.volume_db > -60 else "Mute"
$Wind.bus = "Master" if $Wind.volume_db > -60 else "Mute"
$FireCrackle.bus = "Master" if $FireCrackle.volume_db > -60 else "Mute"
func _on_Fire_intensity_changed(_origin, value):
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
$Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60
$Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60
$FireCrackle.volume_db = (smoothstep(crackle_min, crackle_max, value) - 1) * 60
update_state()
func _on_MuteButton_toggled(button_pressed):
set_mute(button_pressed)
func _on_Game_started_main_menu(_origin):
$Wind.play()
$Wind.volume_db = 0
$Wind.bus = "Master"
$FireCrackle.play()
$FireCrackle.volume_db = 0
$FireCrackle.bus = "Master"
func _on_Game_started_phase_one(_origin):
$Wind.stop()
$FireCrackle.stop()
$Choir.play()
$Bell.play()
$Drum.play()
$BossDrum.play()
$BossGuitar.play()
$FireCrackle.play()
$FireCrackle.volume_db = -60
update_state()
func _on_Game_started_bad_ending(_origin):
$Choir.stop()
$Bell.stop()
$Drum.stop()
$BossDrum.stop()
$BossGuitar.stop()
$FireCrackle.stop()
$Wind.play()
$Wind.volume_db = 0
$Wind.bus = "Master"

View file

@ -78,3 +78,13 @@ autowrap = true
[node name="Credits" parent="TheDarkNightUI/LabelTitle" instance=ExtResource( 5 )]
margin_top = 300.0
[node name="Score" type="Label" parent="TheDarkNightUI"]
margin_left = 341.0
margin_top = -209.0
margin_right = 505.0
margin_bottom = -158.0
custom_fonts/font = SubResource( 8 )
text = "0:00.000"
align = 1
autowrap = true

File diff suppressed because one or more lines are too long

View file

@ -3,8 +3,4 @@ extends Label
func _on_PhaseOne_survival_seconds_updated(_origin, value):
# warning-ignore:NARROWING_CONVERSION
var minutes: int = floor(value / 60)
var seconds_and_millis: float = value - minutes * 60
var seconds: int = int(seconds_and_millis)
var millis: int = int((seconds_and_millis - seconds) * 1000)
text = "%02d:%02d.%03d" % ([minutes, seconds, millis])
text = Utils.format_time(value)

View file

@ -1,11 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/behaviours/spawning/SpawnEveryPeriod.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/behaviours/movement/TeleportToScreenEdge.tscn" type="PackedScene" id=2]
[node name="ScreenEdgeSpawner" instance=ExtResource( 1 )]
[node name="TeleportToScreenEdge" parent="." index="1" instance=ExtResource( 2 )]
[connection signal="spawned" from="." to="TeleportToScreenEdge" method="_handle_spawned"]
[connection signal="timeout" from="Period" to="TeleportToScreenEdge" method="teleport"]

BIN
src/sounds/Laser.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
path="res://.import/Laser.mp3-951a71780d829695ac5edcf737d3cc9c.mp3str"
[deps]
source_file="res://src/sounds/Laser.mp3"
dest_files=[ "res://.import/Laser.mp3-951a71780d829695ac5edcf737d3cc9c.mp3str" ]
[params]
loop=false
loop_offset=0