diff --git a/assets/Ground/background.png b/assets/Ground/background.png index 8734864..94408ef 100644 Binary files a/assets/Ground/background.png and b/assets/Ground/background.png differ diff --git a/assets/Ground/ground.png b/assets/Ground/ground.png deleted file mode 100644 index 1e4ca32..0000000 Binary files a/assets/Ground/ground.png and /dev/null differ diff --git a/assets/Ground/ground.png.import b/assets/Ground/ground.png.import deleted file mode 100644 index dfd5542..0000000 --- a/assets/Ground/ground.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://bmklwmjrtynqo" -path="res://.godot/imported/ground.png-673271eeeb2d2777787f0fa18dd4ce4d.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/Ground/ground.png" -dest_files=["res://.godot/imported/ground.png-673271eeeb2d2777787f0fa18dd4ce4d.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/code/GUI/restartschild.gd b/code/GUI/restartschild.gd index ab4f945..141ab47 100644 --- a/code/GUI/restartschild.gd +++ b/code/GUI/restartschild.gd @@ -12,12 +12,15 @@ func _process(_delta: float) -> void: func _on_duck_gameover() -> void: $AnimationPlayer.play_backwards("out-in") + $"../../Audio/GameOver".play() + $"../../Audio/Gui-in".play() show() func _on_restart_pressed() -> void: $"../..".start_game() $AnimationPlayer.play("out-in") + $"../../Audio/Gui-out".play() await $AnimationPlayer.animation_finished hide() diff --git a/code/GUI/settingsschild.gd b/code/GUI/settingsschild.gd index 550dce0..9c611a0 100644 --- a/code/GUI/settingsschild.gd +++ b/code/GUI/settingsschild.gd @@ -13,9 +13,11 @@ func _process(_delta: float) -> void: func open(): show() $AnimationPlayer.play_backwards("out-in") + $"../../Audio/Gui-in".play() func _on_back_pressed() -> void: $AnimationPlayer.play("out-in") + $"../../Audio/Gui-out".play() await $AnimationPlayer.animation_finished hide() $"../StartSchild"._ready() diff --git a/code/GUI/startschild.gd b/code/GUI/startschild.gd index e249b77..64c3273 100644 --- a/code/GUI/startschild.gd +++ b/code/GUI/startschild.gd @@ -4,22 +4,24 @@ extends TextureRect # Called when the node enters the scene tree for the first time. func _ready() -> void: $AnimationPlayer.play_backwards("out-in") + $"../../Audio/Gui-in".play() show() -func _process(_delta: float) -> void: - global_position.x = get_viewport().get_visible_rect().size.x -100 - $Logo.global_position.x = 0 +func _process(delta: float) -> void: + $Logo.global_position.x = -5 func _on_start_pressed() -> void: $"../..".start_game() $AnimationPlayer.play("out-in") + $"../../Audio/Gui-out".play() await $AnimationPlayer.animation_finished hide() func _on_settings_pressed() -> void: $AnimationPlayer.play("out-in") + $"../../Audio/Gui-out".play() await $AnimationPlayer.animation_finished hide() $"../Settings".open() diff --git a/code/main.gd b/code/main.gd index d734d61..b78cf23 100644 --- a/code/main.gd +++ b/code/main.gd @@ -30,8 +30,14 @@ func _score() -> void: func _process(delta): - if $"/root/Global".gamerunning: - $Screen/Background/Sprites.position.x -= $"/root/Global".speed*delta - if $Screen/Background/Sprites.position.x <= -200: - $Screen/Background/Sprites.position.x = 0 + var background_size_x = $Screen/Background/Sprite.texture.get_size().x + + + var bla = (background_size_x) + $Screen/Background/Sprite.position.x + print(background_size_x) + print(bla) + if $"/root/Global".gamerunning: + $Screen/Background/Sprite.position.x -= $"/root/Global".speed*delta + if bla <= 0: + $Screen/Background/Sprite.position.x = 0 diff --git a/project.godot b/project.godot index acc5f9b..0667d4a 100644 --- a/project.godot +++ b/project.godot @@ -19,7 +19,7 @@ config/icon="res://icon.png" [autoload] -Global="*res://code/global.gd" +Global="*res://scenes/global.gd" [display] diff --git a/scenes/Duck/Duck.gd b/scenes/Duck/Duck.gd index 32d1c40..b3ad055 100644 --- a/scenes/Duck/Duck.gd +++ b/scenes/Duck/Duck.gd @@ -50,8 +50,8 @@ func _collide_with_hindernis(_body: Node2D) -> void: func _color_slider_changed(value) -> void: print($"../../Gui/Settings/ColorSlider".value*0.01) - $EnteSprite/EnteColormask.modulate.h = $"../../Gui/Settings/ColorSlider".value*0.01 + $EnteConstantSprite/EnteColormask.modulate.h = $"../../Gui/Settings/ColorSlider".value*0.01 func _on_ente_sprite_frame_changed() -> void: - $EnteSprite/EnteColormask.frame = $EnteSprite.frame + $EnteConstantSprite/EnteColormask.frame = $EnteConstantSprite.frame diff --git a/scenes/Duck/Duck.tscn b/scenes/Duck/Duck.tscn index 7d8c0ac..cbc47ed 100644 --- a/scenes/Duck/Duck.tscn +++ b/scenes/Duck/Duck.tscn @@ -9,7 +9,7 @@ length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("../EnteSprite:frame") +tracks/0/path = NodePath("../EnteConstantSprite:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -26,7 +26,7 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("../EnteSprite:frame") +tracks/0/path = NodePath("../EnteConstantSprite:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -43,7 +43,7 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("../EnteSprite:frame") +tracks/0/path = NodePath("../EnteConstantSprite:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -59,7 +59,7 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("../EnteSprite:frame") +tracks/0/path = NodePath("../EnteConstantSprite:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -76,7 +76,7 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("../EnteSprite:frame") +tracks/0/path = NodePath("../EnteConstantSprite:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -111,7 +111,7 @@ libraries = { "": SubResource("AnimationLibrary_rcmnp") } -[node name="EnteSprite" type="Sprite2D" parent="."] +[node name="EnteConstantSprite" type="Sprite2D" parent="."] texture_filter = 3 position = Vector2(0, -7) texture = ExtResource("1") @@ -119,7 +119,7 @@ hframes = 3 vframes = 2 frame = 4 -[node name="EnteColormask" type="Sprite2D" parent="EnteSprite"] +[node name="EnteColormask" type="Sprite2D" parent="EnteConstantSprite"] modulate = Color(1, 1, 0, 1) texture = ExtResource("3_a4v8w") hframes = 3 @@ -140,5 +140,5 @@ position = Vector2(-13, -4) shape = SubResource("CapsuleShape2D_46c8m") debug_color = Color(0.906661, 0.254677, 0.42413, 0.42) -[connection signal="frame_changed" from="EnteSprite" to="." method="_on_ente_sprite_frame_changed"] +[connection signal="frame_changed" from="EnteConstantSprite" to="." method="_on_ente_sprite_frame_changed"] [connection signal="area_entered" from="hitbox" to="." method="_collide_with_hindernis"] diff --git a/scenes/Duck/ente.png b/scenes/Duck/ente.png index b9baf17..6508c04 100644 Binary files a/scenes/Duck/ente.png and b/scenes/Duck/ente.png differ diff --git a/scenes/Duck/ente_colormask.png b/scenes/Duck/ente_colormask.png index ba78dd4..37f6757 100644 Binary files a/scenes/Duck/ente_colormask.png and b/scenes/Duck/ente_colormask.png differ diff --git a/scenes/Main.tscn b/scenes/Main.tscn index 860f0ca..6c522d3 100644 --- a/scenes/Main.tscn +++ b/scenes/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=30 format=3 uid="uid://bb5qp5868y5i"] +[gd_scene load_steps=33 format=3 uid="uid://bb5qp5868y5i"] [ext_resource type="Script" path="res://code/main.gd" id="1_ar2ah"] [ext_resource type="PackedScene" uid="uid://8v5mbbnddorh" path="res://scenes/Duck/Duck.tscn" id="2"] @@ -6,7 +6,6 @@ [ext_resource type="FontFile" uid="uid://ddcous2vnc3ux" path="res://m5x7.ttf" id="2_m1hnc"] [ext_resource type="Texture2D" uid="uid://dgfvf2ta4lc4e" path="res://assets/Ground/stars.png" id="2_ohf2r"] [ext_resource type="Texture2D" uid="uid://bg78j6xxw3ck4" path="res://assets/Ground/background.png" id="3"] -[ext_resource type="Texture2D" uid="uid://bmklwmjrtynqo" path="res://assets/Ground/ground.png" id="3_vc02h"] [ext_resource type="Script" path="res://scenes/hindernis/Spawner/hindernis_spawner.gd" id="4_oc6me"] [ext_resource type="PackedScene" uid="uid://dm307sj4nenjt" path="res://scenes/schild.tscn" id="5_ewtcf"] [ext_resource type="Texture2D" uid="uid://do0okfxenx2ci" path="res://assets/GUI/restart button.png" id="6_boo0r"] @@ -19,6 +18,9 @@ [ext_resource type="Texture2D" uid="uid://nvn254p6tk8j" path="res://assets/GUI/back button.png" id="15_wi7xd"] [ext_resource type="Script" path="res://code/GUI/settingsschild.gd" id="16_0wi25"] [ext_resource type="Texture2D" uid="uid://bf82voofmvdj4" path="res://assets/GUI/theme_slider/slider.png" id="17_41xdg"] +[ext_resource type="AudioStream" uid="uid://drriw1cka4m3" path="res://assets/audio/gui-in.ogg" id="20_eihxi"] +[ext_resource type="AudioStream" uid="uid://ctt1kb2a66yyl" path="res://assets/audio/boing.mp3" id="21_ch5yv"] +[ext_resource type="AudioStream" uid="uid://bktthpfrs0118" path="res://assets/audio/gui-out.ogg" id="21_frskh"] [sub_resource type="Animation" id="Animation_n8ktn"] length = 0.001 @@ -164,6 +166,20 @@ size = Vector2(4, 15) [sub_resource type="RectangleShape2D" id="RectangleShape2D_0a3yj"] size = Vector2(361, 8) +[sub_resource type="GDScript" id="GDScript_5rki8"] +script/source = "extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + show() + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta: float) -> void: +# pass +" + [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jin1w"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g0rdc"] @@ -204,7 +220,7 @@ autostart = true script = SubResource("GDScript_rkc4w") [node name="BackgroundRect" type="ColorRect" parent="Screen"] -offset_right = 801.0 +offset_right = 1138.0 offset_bottom = 97.0 color = Color(0.560784, 0.937255, 0.937255, 1) @@ -212,44 +228,24 @@ color = Color(0.560784, 0.937255, 0.937255, 1) [node name="Stars" type="Sprite2D" parent="Screen/Background"] modulate = Color(1, 1, 1, 0) -position = Vector2(85, 50) +position = Vector2(130, 50) texture = ExtResource("2_ohf2r") -[node name="Sprites" type="Node2D" parent="Screen/Background"] -position = Vector2(79, 96) - -[node name="Background" type="Sprite2D" parent="Screen/Background/Sprites"] -position = Vector2(21, -37) +[node name="Sprite" type="TextureRect" parent="Screen/Background"] +offset_top = 8.0 +offset_right = 1134.0 +offset_bottom = 300.0 texture = ExtResource("3") - -[node name="Background2" type="Sprite2D" parent="Screen/Background/Sprites"] -position = Vector2(221, -37) -texture = ExtResource("3") - -[node name="Background3" type="Sprite2D" parent="Screen/Background/Sprites"] -position = Vector2(421, -37) -texture = ExtResource("3") - -[node name="Ground" type="Sprite2D" parent="Screen/Background/Sprites"] -position = Vector2(21, -2) -texture = ExtResource("3_vc02h") - -[node name="Ground2" type="Sprite2D" parent="Screen/Background/Sprites"] -position = Vector2(221, -2) -texture = ExtResource("3_vc02h") - -[node name="Ground3" type="Sprite2D" parent="Screen/Background/Sprites"] -position = Vector2(421, -2) -texture = ExtResource("3_vc02h") +stretch_mode = 1 [node name="Floor" type="StaticBody2D" parent="Screen/Background"] [node name="EasterEggFixCollision" type="CollisionShape2D" parent="Screen/Background/Floor"] -position = Vector2(-2, 83.5) +position = Vector2(-2, 83) shape = SubResource("RectangleShape2D_o05as") [node name="CollisionShape2D" type="CollisionShape2D" parent="Screen/Background/Floor"] -position = Vector2(101.5, 96) +position = Vector2(176, 96) shape = SubResource("RectangleShape2D_0a3yj") [node name="HindernissSpawner" type="Marker2D" parent="Screen"] @@ -283,18 +279,72 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = SubResource("GDScript_5rki8") + +[node name="Settings" parent="Gui" instance=ExtResource("5_ewtcf")] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 0.0 +offset_left = -102.0 +offset_top = -68.0 +offset_right = -2.0 +offset_bottom = 82.0 +grow_horizontal = 0 +size_flags_horizontal = 8 +size_flags_vertical = 4 +stretch_mode = 2 +script = ExtResource("16_0wi25") + +[node name="BackButton" type="TextureButton" parent="Gui/Settings"] +layout_mode = 1 +offset_left = 2.0 +offset_top = 79.0 +offset_right = 17.0 +offset_bottom = 94.0 +texture_normal = ExtResource("15_wi7xd") + +[node name="ColorSlider" type="HSlider" parent="Gui/Settings"] +layout_mode = 1 +anchors_preset = -1 +anchor_right = 0.699 +anchor_bottom = 0.5 +offset_left = 31.0 +offset_top = 93.0 +offset_right = 25.1 +offset_bottom = 34.0 +theme = SubResource("Theme_0130c") +value = 17.0 +allow_greater = true +allow_lesser = true + +[node name="ColorLabel" type="Label" parent="Gui/Settings"] +layout_mode = 0 +offset_left = 4.0 +offset_top = 93.0 +offset_right = 44.0 +offset_bottom = 116.0 +theme_override_fonts/font = ExtResource("2_m1hnc") +text = "Color" [node name="GameOverSchild" parent="Gui" instance=ExtResource("5_ewtcf")] visible = false layout_mode = 1 -anchors_preset = -1 +anchors_preset = 8 anchor_left = 0.5 +anchor_top = 0.5 anchor_right = 0.5 -offset_left = -53.0 -offset_top = -69.0 -offset_right = 47.0 -offset_bottom = 81.0 +anchor_bottom = 0.5 +offset_left = -51.0 +offset_top = -116.0 +offset_right = 49.0 +offset_bottom = 34.0 grow_horizontal = 2 +grow_vertical = 2 +size_flags_vertical = 4 +stretch_mode = 2 [node name="Restart" type="TextureButton" parent="Gui/GameOverSchild"] texture_repeat = 2 @@ -313,18 +363,21 @@ texture_normal = ExtResource("6_boo0r") stretch_mode = 1 [node name="StartSchild" parent="Gui" instance=ExtResource("5_ewtcf")] +visible = false layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 +anchors_preset = 6 +anchor_left = 1.0 anchor_top = 0.5 -anchor_right = 0.5 +anchor_right = 1.0 anchor_bottom = 0.5 -offset_left = -26.0 -offset_top = -118.0 -offset_right = 74.0 -offset_bottom = 32.0 -grow_horizontal = 2 +offset_left = -101.0 +offset_top = -114.0 +offset_right = -1.0 +offset_bottom = 36.0 +grow_horizontal = 0 grow_vertical = 2 +size_flags_vertical = 4 +stretch_mode = 2 script = ExtResource("10_tn1on") [node name="Start" type="TextureButton" parent="Gui/StartSchild"] @@ -365,62 +418,22 @@ stretch_mode = 1 [node name="Logo" type="TextureButton" parent="Gui/StartSchild"] layout_mode = 1 -anchors_preset = 15 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -92.0 -offset_top = 111.0 -offset_right = -64.0 -offset_bottom = -10.0 -grow_horizontal = 2 -grow_vertical = 2 -rotation = -0.397935 +offset_left = -177.0 +offset_top = -38.0 +offset_right = -49.0 +offset_bottom = -9.0 +grow_horizontal = 0 +grow_vertical = 0 +rotation = -0.413643 +size_flags_horizontal = 4 +size_flags_vertical = 4 texture_normal = ExtResource("14_4hepj") -[node name="Settings" parent="Gui" instance=ExtResource("5_ewtcf")] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -26.0 -offset_top = -118.0 -offset_right = 74.0 -offset_bottom = 32.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("16_0wi25") - -[node name="BackButton" type="TextureButton" parent="Gui/Settings"] -layout_mode = 1 -offset_left = 2.0 -offset_top = 79.0 -offset_right = 17.0 -offset_bottom = 94.0 -texture_normal = ExtResource("15_wi7xd") - -[node name="ColorSlider" type="HSlider" parent="Gui/Settings"] -layout_mode = 1 -anchors_preset = -1 -anchor_right = 0.699 -anchor_bottom = 0.5 -offset_left = 34.0 -offset_top = 93.0 -offset_right = 22.1 -offset_bottom = 34.0 -theme = SubResource("Theme_0130c") -value = 16.0 - -[node name="ColorLabel" type="Label" parent="Gui/Settings"] -layout_mode = 0 -offset_left = 4.0 -offset_top = 93.0 -offset_right = 44.0 -offset_bottom = 116.0 -theme_override_fonts/font = ExtResource("2_m1hnc") -text = "Farbe" - [node name="Score" type="Label" parent="Gui"] layout_mode = 1 anchors_preset = 13 @@ -442,15 +455,26 @@ script = ExtResource("2_4em51") wait_time = 0.1 autostart = true +[node name="Audio" type="Node" parent="."] + +[node name="Gui-in" type="AudioStreamPlayer" parent="Audio"] +stream = ExtResource("20_eihxi") + +[node name="Gui-out" type="AudioStreamPlayer" parent="Audio"] +stream = ExtResource("21_frskh") + +[node name="GameOver" type="AudioStreamPlayer" parent="Audio"] +stream = ExtResource("21_ch5yv") + [connection signal="timeout" from="Screen/Day-NightTimer" to="Screen/Day-NightTimer" method="_change_time"] [connection signal="gameover" from="Screen/Duck" to="Gui/GameOverSchild" method="_on_duck_gameover"] [connection signal="timeout" from="Screen/LevelUpTimer" to="." method="_on_level_up_timer_timeout"] [connection signal="timeout" from="Screen/SpawnTimer" to="Screen/HindernissSpawner" method="_spawn"] [connection signal="timeout" from="Screen/WolkenTimer" to="Screen/WolkenSpawner" method="_spawn"] +[connection signal="pressed" from="Gui/Settings/BackButton" to="Gui/Settings" method="_on_back_pressed"] +[connection signal="value_changed" from="Gui/Settings/ColorSlider" to="Screen/Duck" method="_color_slider_changed"] [connection signal="pressed" from="Gui/GameOverSchild/Restart" to="Gui/GameOverSchild" method="_on_restart_pressed"] [connection signal="pressed" from="Gui/StartSchild/Start" to="Gui/StartSchild" method="_on_start_pressed"] [connection signal="pressed" from="Gui/StartSchild/Settings" to="Gui/StartSchild" method="_on_settings_pressed"] [connection signal="pressed" from="Gui/StartSchild/Logo" to="Screen/EastereggSpawner" method="_spawn"] -[connection signal="pressed" from="Gui/Settings/BackButton" to="Gui/Settings" method="_on_back_pressed"] -[connection signal="value_changed" from="Gui/Settings/ColorSlider" to="Screen/Duck" method="_color_slider_changed"] [connection signal="timeout" from="Gui/Score/ScoreCounter" to="." method="_score"] diff --git a/code/global.gd b/scenes/global.gd similarity index 100% rename from code/global.gd rename to scenes/global.gd diff --git a/scenes/schild.tscn b/scenes/schild.tscn index dcedd5e..21a79a6 100644 --- a/scenes/schild.tscn +++ b/scenes/schild.tscn @@ -3,6 +3,9 @@ [ext_resource type="Texture2D" uid="uid://cfmflpkl335e3" path="res://assets/GUI/schild.png" id="1_wyhk0"] [ext_resource type="Script" path="res://code/GUI/restartschild.gd" id="2_pxsow"] +[sub_resource type="Animation" id="Animation_hmob6"] +length = 0.001 + [sub_resource type="Animation" id="Animation_wgvxk"] resource_name = "out-in" length = 0.3 @@ -18,9 +21,6 @@ tracks/0/keys = { "times": PackedFloat32Array(0, 0.3) } -[sub_resource type="Animation" id="Animation_hmob6"] -length = 0.001 - [sub_resource type="AnimationLibrary" id="AnimationLibrary_ur3ij"] _data = { "RESET": SubResource("Animation_hmob6"), @@ -28,10 +28,15 @@ _data = { } [node name="Schild" type="TextureRect"] -offset_left = -48.0 -offset_top = -67.0 -offset_right = 52.0 -offset_bottom = 83.0 +anchors_preset = -1 +anchor_left = -0.259 +anchor_top = 0.14 +anchor_right = 0.282 +anchor_bottom = 0.79 +offset_left = -3.97 +offset_top = -81.0 +offset_right = 4.06 +offset_bottom = 4.0 size_flags_horizontal = 4 texture = ExtResource("1_wyhk0") script = ExtResource("2_pxsow")