adding instructions for sound
This commit is contained in:
parent
f7235f1796
commit
60c688ee51
75
februarygodotgame/Readme.md
Normal file
75
februarygodotgame/Readme.md
Normal file
@ -0,0 +1,75 @@
|
||||
## Stretch Goals
|
||||
|
||||
For this game I set two stretch goals for myself based on popular requests:
|
||||
|
||||
1. Sound Integration
|
||||
2. Bad Guy Death
|
||||
|
||||
|
||||
### Sound Integration
|
||||
|
||||
I wanted two kinds of sounds in the game, namely music tracks and sound effects for things like footsteps while running.
|
||||
|
||||
For both, I was able to use the normal AudioStreamPlayer node.
|
||||
|
||||
### Game Music
|
||||
|
||||
I implemented one AudioStreamPlayer as a child of the SceneManager. This is a good place to control the playing of background audio tracks.
|
||||
|
||||
Two audio tracks are in assets/audio/music. These are ogg-vorbis encoded music tracks.
|
||||
|
||||
I want to have the ability to play a different track of my choosing per game level. So I add the resource paths to the GameController.
|
||||
|
||||
`var soundtracks = ["res://assets/audio/music/CrashingOut.ogg","res://assets/audio/music/DragAndDreadTheme.ogg", "res://assets/audio/music/CrashingOut.ogg"]
|
||||
`
|
||||
|
||||
The SceneManager already calls the GameController's reset function when it loads up, so I gave that function a return value passing the track that the SceneManager should play for that level.
|
||||
|
||||
```
|
||||
func reset():
|
||||
countdown = timers[currentLevel]
|
||||
player.health = player.max_health
|
||||
coinsCollected = 0
|
||||
return(soundtracks[currentLevel])
|
||||
```
|
||||
|
||||
This is important, because the SceneManager should not try to play a track until the level has fully loaded.
|
||||
|
||||
To play the track, the SceneManager needs to load the track using the string supplied by the GameController.
|
||||
|
||||
```
|
||||
func _ready() -> void:
|
||||
buildLevel()
|
||||
var track = Gamecontroller.reset()
|
||||
var audiofile = load(track)
|
||||
audio_stream_player.stream = audiofile
|
||||
audio_stream_player.play()
|
||||
```
|
||||
|
||||
We can now have an audio track per level!
|
||||
|
||||
Possible improvements to this would be to have the sound tracks have a transition like a cross-fade.
|
||||
|
||||
### Game SFX
|
||||
|
||||
An AudioStreamPlayer node was added as a child of the Player scene.
|
||||
|
||||
Audio files for SFX were added directly to the player, using preload.
|
||||
|
||||
```
|
||||
@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer
|
||||
|
||||
const GRASS_RUNNING = preload("res://assets/audio/footsteps/Grass Running.wav")
|
||||
```
|
||||
|
||||
It was then relatively easy to have the footsteps audio play, considering that our code is already tracking if the player is running in order to play the "run" animation. The update looks like this:
|
||||
|
||||
```
|
||||
if direction:
|
||||
if not isJumping:
|
||||
playerGraphic.play("run")
|
||||
if not audio_stream_player.playing:
|
||||
audio_stream_player.stream=GRASS_RUNNING
|
||||
audio_stream_player.playing=true
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=27 format=4 uid="uid://bt6uaac8wfn8k"]
|
||||
[gd_scene load_steps=24 format=4 uid="uid://bt6uaac8wfn8k"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="2_05t6n"]
|
||||
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="2_k4vve"]
|
||||
@ -12,8 +12,6 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="5_4ta71"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="5_7ribr"]
|
||||
[ext_resource type="Script" uid="uid://dcxab0c313bxk" path="res://scripts/scene_manager.gd" id="5_xhw0f"]
|
||||
[ext_resource type="AudioStream" uid="uid://y4ivd6jojrx2" path="res://assets/audio/music/CrashingOut.ogg" id="12_tencs"]
|
||||
[ext_resource type="AudioStream" uid="uid://dfidsrbun4b67" path="res://assets/audio/music/DragAndDreadTheme.ogg" id="13_bb4js"]
|
||||
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_vf7vr"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_nv7k0"]
|
||||
[ext_resource type="PackedScene" uid="uid://bv622vne87h0h" path="res://scenes/ui.tscn" id="15_2y4bi"]
|
||||
@ -394,11 +392,6 @@ sources/3 = SubResource("TileSetAtlasSource_hir5y")
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ggdp1"]
|
||||
size = Vector2(72, 20)
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_3a348"]
|
||||
streams_count = 2
|
||||
stream_0/stream = ExtResource("12_tencs")
|
||||
stream_1/stream = ExtResource("13_bb4js")
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_opmvx"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1ymsv"]
|
||||
@ -490,7 +483,6 @@ unique_name_in_owner = true
|
||||
script = ExtResource("5_xhw0f")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="SceneManager"]
|
||||
stream = SubResource("AudioStreamRandomizer_3a348")
|
||||
autoplay = true
|
||||
|
||||
[node name="triggers" type="Node2D" parent="."]
|
||||
|
@ -1,23 +1,23 @@
|
||||
[gd_scene load_steps=24 format=4 uid="uid://3ljjb5fedpwn"]
|
||||
[gd_scene load_steps=24 format=4 uid="uid://blxc0o65buwix"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_bdipr"]
|
||||
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_adtlj"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_ichdk"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_5617y"]
|
||||
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_4jks0"]
|
||||
[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_g06l8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_iwifl"]
|
||||
[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_myql4"]
|
||||
[ext_resource type="Script" uid="uid://byf3jbnel85px" path="res://scripts/crate.gd" id="9_l5pic"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_5xft3"]
|
||||
[ext_resource type="Script" uid="uid://dcxab0c313bxk" path="res://scripts/scene_manager.gd" id="11_fw3pc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_ve30e"]
|
||||
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_4tfwl"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_nm2am"]
|
||||
[ext_resource type="PackedScene" uid="uid://bv622vne87h0h" path="res://scenes/ui.tscn" id="15_0c22k"]
|
||||
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_cleqw"]
|
||||
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_wvb8j"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_g8vcy"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_cqal4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_o3sye"]
|
||||
[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_24ks5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_s4es8"]
|
||||
[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_63e4f"]
|
||||
[ext_resource type="Script" uid="uid://byf3jbnel85px" path="res://scripts/crate.gd" id="9_y6lc1"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_ekhvm"]
|
||||
[ext_resource type="Script" uid="uid://dcxab0c313bxk" path="res://scripts/scene_manager.gd" id="11_nflru"]
|
||||
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_ikw2v"]
|
||||
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_cgqhq"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_ttvjw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bv622vne87h0h" path="res://scenes/ui.tscn" id="15_ac7c3"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"]
|
||||
texture = ExtResource("5_4jks0")
|
||||
texture = ExtResource("5_o3sye")
|
||||
texture_region_size = Vector2i(32, 32)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
@ -356,14 +356,14 @@ texture_region_size = Vector2i(32, 32)
|
||||
16:4/0/terrains_peering_bit/top_side = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7tjg7"]
|
||||
texture = ExtResource("6_g06l8")
|
||||
texture = ExtResource("6_24ks5")
|
||||
texture_region_size = Vector2i(32, 32)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
0:0/0/terrain = 1
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hir5y"]
|
||||
texture = ExtResource("7_iwifl")
|
||||
texture = ExtResource("7_s4es8")
|
||||
texture_region_size = Vector2i(32, 32)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
@ -405,7 +405,7 @@ metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="sky"]
|
||||
position = Vector2(160, 90)
|
||||
texture = ExtResource("1_bdipr")
|
||||
texture = ExtResource("1_cleqw")
|
||||
|
||||
[node name="farbg" type="Parallax2D" parent="."]
|
||||
scroll_scale = Vector2(0.5, 1)
|
||||
@ -414,7 +414,7 @@ metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="farbg"]
|
||||
position = Vector2(160, 410)
|
||||
texture = ExtResource("2_adtlj")
|
||||
texture = ExtResource("2_wvb8j")
|
||||
|
||||
[node name="midground" type="Parallax2D" parent="."]
|
||||
repeat_size = Vector2(320, 0)
|
||||
@ -422,7 +422,7 @@ metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="midground"]
|
||||
position = Vector2(160, 420)
|
||||
texture = ExtResource("3_ichdk")
|
||||
texture = ExtResource("3_g8vcy")
|
||||
|
||||
[node name="foreground" type="Parallax2D" parent="."]
|
||||
scroll_scale = Vector2(1.5, 1)
|
||||
@ -430,7 +430,7 @@ repeat_size = Vector2(320, 0)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="foreground"]
|
||||
position = Vector2(160, 420)
|
||||
texture = ExtResource("4_5617y")
|
||||
texture = ExtResource("4_cqal4")
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
texture_filter = 1
|
||||
@ -456,43 +456,46 @@ shape = SubResource("RectangleShape2D_ggdp1")
|
||||
|
||||
[node name="crates" type="Node2D" parent="."]
|
||||
|
||||
[node name="crate1" parent="crates" instance=ExtResource("8_myql4")]
|
||||
[node name="crate1" parent="crates" instance=ExtResource("8_63e4f")]
|
||||
position = Vector2(481, 369)
|
||||
script = ExtResource("9_l5pic")
|
||||
script = ExtResource("9_y6lc1")
|
||||
|
||||
[node name="crate2" parent="crates" instance=ExtResource("8_myql4")]
|
||||
[node name="crate2" parent="crates" instance=ExtResource("8_63e4f")]
|
||||
position = Vector2(534, 397)
|
||||
rotation = 0.380482
|
||||
script = ExtResource("9_l5pic")
|
||||
script = ExtResource("9_y6lc1")
|
||||
|
||||
[node name="crate4" parent="crates" instance=ExtResource("8_myql4")]
|
||||
[node name="crate4" parent="crates" instance=ExtResource("8_63e4f")]
|
||||
position = Vector2(683, 338)
|
||||
rotation = 0.380482
|
||||
script = ExtResource("9_l5pic")
|
||||
script = ExtResource("9_y6lc1")
|
||||
|
||||
[node name="crate3" parent="crates" instance=ExtResource("8_myql4")]
|
||||
[node name="crate3" parent="crates" instance=ExtResource("8_63e4f")]
|
||||
position = Vector2(693, 255)
|
||||
rotation = -0.760964
|
||||
script = ExtResource("9_l5pic")
|
||||
script = ExtResource("9_y6lc1")
|
||||
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("10_5xft3")]
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("10_ekhvm")]
|
||||
position = Vector2(586, 347)
|
||||
|
||||
[node name="SceneManager" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("11_fw3pc")
|
||||
script = ExtResource("11_nflru")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="SceneManager"]
|
||||
autoplay = true
|
||||
|
||||
[node name="triggers" type="Node2D" parent="."]
|
||||
|
||||
[node name="Trigger" parent="triggers" instance=ExtResource("12_ve30e")]
|
||||
position = Vector2(697, 465)
|
||||
[node name="Trigger" parent="triggers" instance=ExtResource("12_ikw2v")]
|
||||
position = Vector2(632, 372)
|
||||
effect = "destroy"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/Trigger"]
|
||||
shape = SubResource("CircleShape2D_opmvx")
|
||||
debug_color = Color(0.731092, 0.294274, 0.91724, 0.42)
|
||||
|
||||
[node name="powerup" parent="triggers" instance=ExtResource("12_ve30e")]
|
||||
[node name="powerup" parent="triggers" instance=ExtResource("12_ikw2v")]
|
||||
position = Vector2(791, 407)
|
||||
effect = "powerup"
|
||||
|
||||
@ -503,20 +506,23 @@ debug_color = Color(0.156093, 0.622347, 0.484765, 0.42)
|
||||
|
||||
[node name="coins" type="Node2D" parent="."]
|
||||
|
||||
[node name="Area2D" parent="coins" instance=ExtResource("13_4tfwl")]
|
||||
[node name="Area2D" parent="coins" instance=ExtResource("13_cgqhq")]
|
||||
position = Vector2(616, 455)
|
||||
|
||||
[node name="Area2D2" parent="coins" instance=ExtResource("13_4tfwl")]
|
||||
[node name="Area2D2" parent="coins" instance=ExtResource("13_cgqhq")]
|
||||
position = Vector2(685, 411)
|
||||
|
||||
[node name="Area2D3" parent="coins" instance=ExtResource("13_4tfwl")]
|
||||
[node name="Area2D3" parent="coins" instance=ExtResource("13_cgqhq")]
|
||||
position = Vector2(814, 411)
|
||||
|
||||
[node name="badguys" type="Node2D" parent="."]
|
||||
|
||||
[node name="Area2D" parent="badguys" instance=ExtResource("14_nm2am")]
|
||||
[node name="Area2D" parent="badguys" instance=ExtResource("14_ttvjw")]
|
||||
position = Vector2(562, 469)
|
||||
|
||||
[node name="Area2D2" parent="badguys" instance=ExtResource("14_ttvjw")]
|
||||
position = Vector2(498, 405)
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_0c22k")]
|
||||
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_ac7c3")]
|
||||
|
@ -1,23 +1,23 @@
|
||||
[gd_scene load_steps=24 format=4 uid="uid://csinr866d53j5"]
|
||||
[gd_scene load_steps=24 format=4 uid="uid://bi48ftblw1oob"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_guqk6"]
|
||||
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_kf82u"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_sfwji"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_3vafi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_hojom"]
|
||||
[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_7nnrj"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_nvu0v"]
|
||||
[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_omegn"]
|
||||
[ext_resource type="Script" uid="uid://byf3jbnel85px" path="res://scripts/crate.gd" id="9_egdbr"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_o6q0w"]
|
||||
[ext_resource type="Script" uid="uid://dcxab0c313bxk" path="res://scripts/scene_manager.gd" id="11_nqywm"]
|
||||
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_lqaop"]
|
||||
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_vgo8v"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_rox0s"]
|
||||
[ext_resource type="PackedScene" uid="uid://bv622vne87h0h" path="res://scenes/ui.tscn" id="15_8ylp1"]
|
||||
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_e40mx"]
|
||||
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_a114e"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_y1e0c"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_s4dsi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_07lh1"]
|
||||
[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_6uuvf"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_x008a"]
|
||||
[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_atr84"]
|
||||
[ext_resource type="Script" uid="uid://byf3jbnel85px" path="res://scripts/crate.gd" id="9_qyu38"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_8vbrh"]
|
||||
[ext_resource type="Script" uid="uid://dcxab0c313bxk" path="res://scripts/scene_manager.gd" id="11_d5gix"]
|
||||
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_7hs6g"]
|
||||
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_yeq8b"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_invaa"]
|
||||
[ext_resource type="PackedScene" uid="uid://bv622vne87h0h" path="res://scenes/ui.tscn" id="15_88b2t"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"]
|
||||
texture = ExtResource("5_hojom")
|
||||
texture = ExtResource("5_07lh1")
|
||||
texture_region_size = Vector2i(32, 32)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
@ -356,14 +356,14 @@ texture_region_size = Vector2i(32, 32)
|
||||
16:4/0/terrains_peering_bit/top_side = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7tjg7"]
|
||||
texture = ExtResource("6_7nnrj")
|
||||
texture = ExtResource("6_6uuvf")
|
||||
texture_region_size = Vector2i(32, 32)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
0:0/0/terrain = 1
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hir5y"]
|
||||
texture = ExtResource("7_nvu0v")
|
||||
texture = ExtResource("7_x008a")
|
||||
texture_region_size = Vector2i(32, 32)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
@ -405,7 +405,7 @@ metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="sky"]
|
||||
position = Vector2(160, 90)
|
||||
texture = ExtResource("1_guqk6")
|
||||
texture = ExtResource("1_e40mx")
|
||||
|
||||
[node name="farbg" type="Parallax2D" parent="."]
|
||||
scroll_scale = Vector2(0.5, 1)
|
||||
@ -414,7 +414,7 @@ metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="farbg"]
|
||||
position = Vector2(160, 410)
|
||||
texture = ExtResource("2_kf82u")
|
||||
texture = ExtResource("2_a114e")
|
||||
|
||||
[node name="midground" type="Parallax2D" parent="."]
|
||||
repeat_size = Vector2(320, 0)
|
||||
@ -422,7 +422,7 @@ metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="midground"]
|
||||
position = Vector2(160, 420)
|
||||
texture = ExtResource("3_sfwji")
|
||||
texture = ExtResource("3_y1e0c")
|
||||
|
||||
[node name="foreground" type="Parallax2D" parent="."]
|
||||
scroll_scale = Vector2(1.5, 1)
|
||||
@ -430,7 +430,7 @@ repeat_size = Vector2(320, 0)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="foreground"]
|
||||
position = Vector2(160, 420)
|
||||
texture = ExtResource("4_3vafi")
|
||||
texture = ExtResource("4_s4dsi")
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
texture_filter = 1
|
||||
@ -456,43 +456,46 @@ shape = SubResource("RectangleShape2D_ggdp1")
|
||||
|
||||
[node name="crates" type="Node2D" parent="."]
|
||||
|
||||
[node name="crate1" parent="crates" instance=ExtResource("8_omegn")]
|
||||
[node name="crate1" parent="crates" instance=ExtResource("8_atr84")]
|
||||
position = Vector2(481, 369)
|
||||
script = ExtResource("9_egdbr")
|
||||
script = ExtResource("9_qyu38")
|
||||
|
||||
[node name="crate2" parent="crates" instance=ExtResource("8_omegn")]
|
||||
[node name="crate2" parent="crates" instance=ExtResource("8_atr84")]
|
||||
position = Vector2(534, 397)
|
||||
rotation = 0.380482
|
||||
script = ExtResource("9_egdbr")
|
||||
script = ExtResource("9_qyu38")
|
||||
|
||||
[node name="crate4" parent="crates" instance=ExtResource("8_omegn")]
|
||||
[node name="crate4" parent="crates" instance=ExtResource("8_atr84")]
|
||||
position = Vector2(683, 338)
|
||||
rotation = 0.380482
|
||||
script = ExtResource("9_egdbr")
|
||||
script = ExtResource("9_qyu38")
|
||||
|
||||
[node name="crate3" parent="crates" instance=ExtResource("8_omegn")]
|
||||
[node name="crate3" parent="crates" instance=ExtResource("8_atr84")]
|
||||
position = Vector2(693, 255)
|
||||
rotation = -0.760964
|
||||
script = ExtResource("9_egdbr")
|
||||
script = ExtResource("9_qyu38")
|
||||
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("10_o6q0w")]
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("10_8vbrh")]
|
||||
position = Vector2(586, 347)
|
||||
|
||||
[node name="SceneManager" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("11_nqywm")
|
||||
script = ExtResource("11_d5gix")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="SceneManager"]
|
||||
autoplay = true
|
||||
|
||||
[node name="triggers" type="Node2D" parent="."]
|
||||
|
||||
[node name="Trigger" parent="triggers" instance=ExtResource("12_lqaop")]
|
||||
position = Vector2(697, 465)
|
||||
[node name="Trigger" parent="triggers" instance=ExtResource("12_7hs6g")]
|
||||
position = Vector2(632, 372)
|
||||
effect = "destroy"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/Trigger"]
|
||||
shape = SubResource("CircleShape2D_opmvx")
|
||||
debug_color = Color(0.731092, 0.294274, 0.91724, 0.42)
|
||||
|
||||
[node name="powerup" parent="triggers" instance=ExtResource("12_lqaop")]
|
||||
[node name="powerup" parent="triggers" instance=ExtResource("12_7hs6g")]
|
||||
position = Vector2(791, 407)
|
||||
effect = "powerup"
|
||||
|
||||
@ -503,20 +506,23 @@ debug_color = Color(0.156093, 0.622347, 0.484765, 0.42)
|
||||
|
||||
[node name="coins" type="Node2D" parent="."]
|
||||
|
||||
[node name="Area2D" parent="coins" instance=ExtResource("13_vgo8v")]
|
||||
[node name="Area2D" parent="coins" instance=ExtResource("13_yeq8b")]
|
||||
position = Vector2(616, 455)
|
||||
|
||||
[node name="Area2D2" parent="coins" instance=ExtResource("13_vgo8v")]
|
||||
[node name="Area2D2" parent="coins" instance=ExtResource("13_yeq8b")]
|
||||
position = Vector2(685, 411)
|
||||
|
||||
[node name="Area2D3" parent="coins" instance=ExtResource("13_vgo8v")]
|
||||
[node name="Area2D3" parent="coins" instance=ExtResource("13_yeq8b")]
|
||||
position = Vector2(814, 411)
|
||||
|
||||
[node name="badguys" type="Node2D" parent="."]
|
||||
|
||||
[node name="Area2D" parent="badguys" instance=ExtResource("14_rox0s")]
|
||||
[node name="Area2D" parent="badguys" instance=ExtResource("14_invaa")]
|
||||
position = Vector2(562, 469)
|
||||
|
||||
[node name="Area2D2" parent="badguys" instance=ExtResource("14_invaa")]
|
||||
position = Vector2(498, 405)
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_8ylp1")]
|
||||
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_88b2t")]
|
||||
|
@ -19,7 +19,7 @@ signal coinCountSignal(collected, available)
|
||||
#level info
|
||||
var timer:= Timer.new()
|
||||
var levels = ["res://scenes/game.tscn","res://scenes/level2.tscn","res://scenes/level3.tscn"]
|
||||
var soundtracks = ["res://assets/audio/music/CrashingOut.ogg","res://assets/audio/music/DragAndDreadTheme.ogg"]
|
||||
var soundtracks = ["res://assets/audio/music/CrashingOut.ogg","res://assets/audio/music/DragAndDreadTheme.ogg", "res://assets/audio/music/CrashingOut.ogg"]
|
||||
var timers = [20,15,25]
|
||||
var currentLevel = 0
|
||||
var countdown=0
|
||||
@ -42,6 +42,7 @@ func reset():
|
||||
countdown = timers[currentLevel]
|
||||
player.health = player.max_health
|
||||
coinsCollected = 0
|
||||
return(soundtracks[currentLevel])
|
||||
|
||||
func secondCounter():
|
||||
countdown -=1
|
||||
|
@ -90,8 +90,11 @@ func loadLevel(level):
|
||||
|
||||
func _ready() -> void:
|
||||
buildLevel()
|
||||
Gamecontroller.reset()
|
||||
audio_stream_player.play
|
||||
var track = Gamecontroller.reset()
|
||||
var audiofile = load(track)
|
||||
audio_stream_player.stream = audiofile
|
||||
audio_stream_player.play()
|
||||
|
||||
func playerHurt(health, _maxHealth):
|
||||
player.hurtPlayer(health)
|
||||
func playerKill():
|
||||
|
Loading…
Reference in New Issue
Block a user