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

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