Settings Menü und Color slider

This commit is contained in:
megamichi 2024-10-03 21:12:20 +02:00
parent 29ffdc2846
commit 9dadc9b486
17 changed files with 370 additions and 114 deletions

BIN
assets/GUI/back button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://nvn254p6tk8j"
path="res://.godot/imported/back button.png-60c5e1569912a9f358510f65653b65f0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/GUI/back button.png"
dest_files=["res://.godot/imported/back button.png-60c5e1569912a9f358510f65653b65f0.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dqvnnd3o1eele"
path="res://.godot/imported/settings button.png-12a80936bbb56afb3f9f9a68d2cdda65.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/GUI/settings button.png"
dest_files=["res://.godot/imported/settings button.png-12a80936bbb56afb3f9f9a68d2cdda65.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bf82voofmvdj4"
path="res://.godot/imported/slider.png-77782bbc585b1cc04d83aca1b1d1b243.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/GUI/theme_slider/slider.png"
dest_files=["res://.godot/imported/slider.png-77782bbc585b1cc04d83aca1b1d1b243.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

View file

@ -1,20 +1,24 @@
extends Sprite2D
extends TextureRect
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
global_position.y = -80
#global_position.y = -80
hide()
func _process(_delta: float) -> void:
global_position.x = get_viewport().get_visible_rect().size.x * 0.5
pass
#global_position.x = get_viewport().get_visible_rect().size.x * 0.5
func _on_duck_gameover() -> void:
$AnimationPlayer.play("in")
$AnimationPlayer.play_backwards("out-in")
show()
func _on_restart_pressed() -> void:
$"../..".start_game()
$AnimationPlayer.play("out")
$AnimationPlayer.play("out-in")
await $AnimationPlayer.animation_finished
hide()

View file

@ -0,0 +1,21 @@
extends TextureRect
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$AnimationPlayer.play_backwards("out-in")
hide()
func _process(_delta: float) -> void:
global_position.x = get_viewport().get_visible_rect().size.x -100
#$Logo.global_position.x = 0
func open():
show()
$AnimationPlayer.play_backwards("out-in")
func _on_back_pressed() -> void:
$AnimationPlayer.play("out-in")
await $AnimationPlayer.animation_finished
hide()
$"../StartSchild"._ready()

View file

@ -1,18 +1,25 @@
extends Sprite2D
extends TextureRect
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$AnimationPlayer.play("in")
$AnimationPlayer.play_backwards("out-in")
show()
func _process(_delta: float) -> void:
global_position.x = get_viewport().get_visible_rect().size.x -51
global_position.x = get_viewport().get_visible_rect().size.x -100
$Logo.global_position.x = 0
func _on_start_pressed() -> void:
$"../..".start_game()
$AnimationPlayer.play("out")
$AnimationPlayer.play("out-in")
await $AnimationPlayer.animation_finished
hide()
func _on_settings_pressed() -> void:
$AnimationPlayer.play("out-in")
await $AnimationPlayer.animation_finished
hide()
$"../Settings".open()

View file

@ -226,7 +226,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
export_path="builds/DuckRun_v2.0.4.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

@ -5,6 +5,7 @@ const JUMP_VELOCITY = -230.0
signal gameover
@onready var alive = true
var state = "main-menu"
func die():
print("die")
@ -27,16 +28,30 @@ func _process(_delta: float) -> void:
if position.x < -20:
if alive:
die()
if not $"/root/Global".gamerunning:
if $"/root/Global".gamerunning:
state = "game"
if state == "main-menu" :
$AnimationPlayer.play("idle")
elif not is_on_floor():
$AnimationPlayer.play("fly")
elif not alive:
$AnimationPlayer.play("die")
else:
$AnimationPlayer.play("walk")
elif state == "game":
if not is_on_floor():
$AnimationPlayer.play("fly")
elif not alive:
$AnimationPlayer.play("die")
else:
$AnimationPlayer.play("walk")
func _collide_with_hindernis(_body: Node2D) -> void:
print("colide")
if alive:
die()
func _color_slider_changed(value) -> void:
print($"../../Gui/Settings/ColorSlider".value*0.01)
$EnteSprite/EnteColormask.modulate.h = $"../../Gui/Settings/ColorSlider".value*0.01
func _on_ente_sprite_frame_changed() -> void:
$EnteSprite/EnteColormask.frame = $EnteSprite.frame

View file

@ -1,14 +1,15 @@
[gd_scene load_steps=11 format=3 uid="uid://8v5mbbnddorh"]
[gd_scene load_steps=12 format=3 uid="uid://8v5mbbnddorh"]
[ext_resource type="Texture2D" uid="uid://dc6grg2oaq3a6" path="res://scenes/Duck/ente.png" id="1"]
[ext_resource type="Script" path="res://scenes/Duck/Duck.gd" id="1_pvotk"]
[ext_resource type="Texture2D" uid="uid://dsifqpp5l00cr" path="res://scenes/Duck/ente_colormask.png" id="3_a4v8w"]
[sub_resource type="Animation" id="5"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/path = NodePath("../EnteSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
@ -25,7 +26,7 @@ loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/path = NodePath("../EnteSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
@ -42,7 +43,7 @@ loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/path = NodePath("../EnteSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
@ -58,7 +59,7 @@ loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/path = NodePath("../EnteSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
@ -75,7 +76,7 @@ loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/path = NodePath("../EnteSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
@ -110,7 +111,7 @@ libraries = {
"": SubResource("AnimationLibrary_rcmnp")
}
[node name="Sprite2D" type="Sprite2D" parent="."]
[node name="EnteSprite" type="Sprite2D" parent="."]
texture_filter = 3
position = Vector2(0, -7)
texture = ExtResource("1")
@ -118,6 +119,12 @@ hframes = 3
vframes = 2
frame = 4
[node name="EnteColormask" type="Sprite2D" parent="EnteSprite"]
modulate = Color(1, 1, 0, 1)
texture = ExtResource("3_a4v8w")
hframes = 3
vframes = 2
[node name="physicsbox" type="CollisionShape2D" parent="."]
position = Vector2(2.38419e-07, -6)
scale = Vector2(5, 5)
@ -133,4 +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="area_entered" from="hitbox" to="." method="_collide_with_hindernis"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dsifqpp5l00cr"
path="res://.godot/imported/ente_colormask.png-2d37b08b1228794ae82f602e7c4e215c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/Duck/ente_colormask.png"
dest_files=["res://.godot/imported/ente_colormask.png-2d37b08b1228794ae82f602e7c4e215c.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=1
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

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://bb5qp5868y5i"]
[gd_scene load_steps=30 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"]
@ -14,7 +14,11 @@
[ext_resource type="Script" path="res://code/GUI/startschild.gd" id="10_tn1on"]
[ext_resource type="Texture2D" uid="uid://d2i2d0rmdtklc" path="res://assets/GUI/start button.png" id="11_4sha5"]
[ext_resource type="Script" path="res://scenes/Wolke/Spawner/wolken_spawner.gd" id="11_x2wm3"]
[ext_resource type="Texture2D" uid="uid://dqvnnd3o1eele" path="res://assets/GUI/settings button.png" id="13_0b7u8"]
[ext_resource type="Texture2D" uid="uid://bj7bgtdcbdald" path="res://assets/GUI/logo.png" id="14_4hepj"]
[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"]
[sub_resource type="Animation" id="Animation_n8ktn"]
length = 0.001
@ -160,6 +164,29 @@ size = Vector2(4, 15)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0a3yj"]
size = Vector2(361, 8)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jin1w"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g0rdc"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xb3tf"]
bg_color = Color(1, 0.50219, 0, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(1, 1, 1, 1)
corner_detail = 1
expand_margin_top = 1.0
expand_margin_bottom = 2.0
anti_aliasing = false
[sub_resource type="Theme" id="Theme_0130c"]
HSlider/icons/grabber = ExtResource("17_41xdg")
HSlider/icons/grabber_highlight = ExtResource("17_41xdg")
HSlider/styles/grabber_area = SubResource("StyleBoxEmpty_jin1w")
HSlider/styles/grabber_area_highlight = SubResource("StyleBoxEmpty_g0rdc")
HSlider/styles/slider = SubResource("StyleBoxFlat_xb3tf")
[node name="Game" type="Node"]
script = ExtResource("1_ar2ah")
@ -259,59 +286,141 @@ grow_vertical = 2
[node name="GameOverSchild" parent="Gui" instance=ExtResource("5_ewtcf")]
visible = false
position = Vector2(279, 0)
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -53.0
offset_top = -69.0
offset_right = 47.0
offset_bottom = 81.0
grow_horizontal = 2
[node name="Restart" type="TextureButton" parent="Gui/GameOverSchild"]
texture_repeat = 2
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.77
anchor_top = 0.762
anchor_right = 0.5
anchor_bottom = 0.77
offset_left = -73.5
offset_top = -91.5
offset_right = -58.5
offset_bottom = -76.5
grow_horizontal = 2
grow_vertical = 2
anchor_bottom = 0.762
offset_left = -23.0
offset_top = -23.3
offset_right = -8.0
offset_bottom = -8.3
scale = Vector2(3, 3)
texture_normal = ExtResource("6_boo0r")
stretch_mode = 1
metadata/_edit_use_anchors_ = true
[node name="StartSchild" parent="Gui" instance=ExtResource("5_ewtcf")]
visible = false
position = Vector2(63, 0)
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("10_tn1on")
[node name="Start" type="TextureButton" parent="Gui/StartSchild"]
texture_repeat = 2
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.77
anchor_right = 0.5
anchor_bottom = 0.77
offset_left = -73.5
offset_top = -91.5
offset_right = -58.5
offset_bottom = -76.5
anchor_top = 0.777
anchor_right = 0.505
anchor_bottom = 0.777
offset_left = -1.0
offset_top = -23.55
offset_right = 13.5
offset_bottom = -8.55
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(3, 3)
texture_normal = ExtResource("11_4sha5")
stretch_mode = 1
[node name="Settings" type="TextureButton" parent="Gui/StartSchild"]
texture_repeat = 2
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.777
anchor_right = 0.505
anchor_bottom = 0.777
offset_left = -44.0
offset_top = -23.55
offset_right = -29.5
offset_bottom = -8.55
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(3, 3)
texture_normal = ExtResource("13_0b7u8")
stretch_mode = 1
[node name="Logo" type="TextureButton" parent="Gui/StartSchild"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -140.0
offset_top = 40.0
offset_right = -112.0
offset_bottom = -81.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
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
@ -340,5 +449,8 @@ autostart = true
[connection signal="timeout" from="Screen/WolkenTimer" to="Screen/WolkenSpawner" method="_spawn"]
[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"]

View file

@ -1,52 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://dm307sj4nenjt"]
[gd_scene load_steps=6 format=3 uid="uid://dm307sj4nenjt"]
[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_2ygp6"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_2vs66"]
resource_name = "in"
length = 0.2
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 2),
"points": PackedFloat32Array(-98.5, -0.25, 0, 0.0666667, -21, 2.5, -0.2, 2, 0, 0),
"times": PackedFloat32Array(0, 0.2)
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_2eby2"]
resource_name = "out"
length = 0.2
[sub_resource type="Animation" id="Animation_wgvxk"]
resource_name = "out-in"
length = 0.3
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
@ -55,35 +14,29 @@ tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(-0.5, -0.25, 0, 0.25, 0, -100, -0.0666667, 3, 0, 0),
"times": PackedFloat32Array(0, 0.2)
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.233333),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
"points": PackedFloat32Array(-67, -0.25, 0, 0.2, -2.53268, -250.023, -0.1, 2.25394, 0.25, 0),
"times": PackedFloat32Array(0, 0.3)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n8lkd"]
[sub_resource type="Animation" id="Animation_hmob6"]
length = 0.001
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ur3ij"]
_data = {
"RESET": SubResource("Animation_2ygp6"),
"in": SubResource("Animation_2vs66"),
"out": SubResource("Animation_2eby2")
"RESET": SubResource("Animation_hmob6"),
"out-in": SubResource("Animation_wgvxk")
}
[node name="Schild" type="Sprite2D"]
texture_filter = 1
[node name="Schild" type="TextureRect"]
offset_left = -48.0
offset_top = -67.0
offset_right = 52.0
offset_bottom = 83.0
size_flags_horizontal = 4
texture = ExtResource("1_wyhk0")
script = ExtResource("2_pxsow")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_n8lkd")
"": SubResource("AnimationLibrary_ur3ij")
}