This commit is contained in:
megamichi 2024-10-01 15:56:30 +02:00
commit 80f2563cdc
95 changed files with 3327 additions and 0 deletions

42
scenes/Duck/Duck.gd Normal file
View file

@ -0,0 +1,42 @@
extends CharacterBody2D
const JUMP_VELOCITY = -230.0
signal gameover
@onready var alive = true
func die():
print("die")
gameover.emit()
alive = false
func start():
global_position = Vector2(21,91)
alive = true
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta
if Input.is_action_pressed("jump") and is_on_floor() and alive and $"/root/Global".gamerunning:
velocity.y = JUMP_VELOCITY
move_and_slide()
func _process(_delta: float) -> void:
if position.x < -20:
if alive:
die()
if not $"/root/Global".gamerunning:
$AnimationPlayer.play("idle")
elif 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()

136
scenes/Duck/Duck.tscn Normal file
View file

@ -0,0 +1,136 @@
[gd_scene load_steps=11 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"]
[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/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [4]
}
[sub_resource type="Animation" id="6"]
resource_name = "die"
length = 0.3
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [5]
}
[sub_resource type="Animation" id="7"]
resource_name = "fly"
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [2]
}
[sub_resource type="Animation" id="2"]
resource_name = "idle"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [0, 1]
}
[sub_resource type="Animation" id="3"]
resource_name = "walk"
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [3, 4]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rcmnp"]
_data = {
"RESET": SubResource("5"),
"die": SubResource("6"),
"fly": SubResource("7"),
"idle": SubResource("2"),
"walk": SubResource("3")
}
[sub_resource type="CircleShape2D" id="CircleShape2D_1551i"]
radius = 1.21655
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_46c8m"]
radius = 6.0
height = 14.0
[node name="Duck" type="CharacterBody2D"]
script = ExtResource("1_pvotk")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../hitbox")
libraries = {
"": SubResource("AnimationLibrary_rcmnp")
}
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 3
position = Vector2(0, -7)
texture = ExtResource("1")
hframes = 3
vframes = 2
frame = 4
[node name="physicsbox" type="CollisionShape2D" parent="."]
position = Vector2(2.38419e-07, -6)
scale = Vector2(5, 5)
shape = SubResource("CircleShape2D_1551i")
[node name="hitbox" type="Area2D" parent="."]
position = Vector2(13, -2)
collision_layer = 2
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"]
position = Vector2(-13, -4)
shape = SubResource("CapsuleShape2D_46c8m")
debug_color = Color(0.906661, 0.254677, 0.42413, 0.42)
[connection signal="area_entered" from="hitbox" to="." method="_collide_with_hindernis"]

BIN
scenes/Duck/ente.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

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

344
scenes/Main.tscn Normal file
View file

@ -0,0 +1,344 @@
[gd_scene load_steps=22 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"]
[ext_resource type="Script" path="res://code/score.gd" id="2_4em51"]
[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"]
[ext_resource type="Script" path="res://scenes/easteregg/Spawner/easteregg_spawner.gd" id="8_awkaj"]
[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://bj7bgtdcbdald" path="res://assets/GUI/logo.png" id="14_4hepj"]
[sub_resource type="Animation" id="Animation_n8ktn"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:color:r")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0.560784, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:color:g")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0.937255, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_7cwe6"]
resource_name = "change_time"
length = 6.0
step = 0.25
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("..:modulate:r")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.5, 0, 1, 0, 0.6, -1, 0, 0.5, 0),
"times": PackedFloat32Array(0, 6)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("..:modulate:g")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.5, 0, 1, 0, 0.6, -1, 0, 0.5, 0),
"times": PackedFloat32Array(0, 6)
}
tracks/2/type = "bezier"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("..:modulate:b")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.5, 0, 1, 0, 0.6, -1, 0, 0.5, 0),
"times": PackedFloat32Array(0, 6)
}
tracks/3/type = "bezier"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".:color:r")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0.560784, -0.25, 0, 0.25, 0, 0.1, -0.5, 0, 0.25, 0),
"times": PackedFloat32Array(0, 6)
}
tracks/4/type = "bezier"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath(".:color:g")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0.937255, -0.25, 0, 0.25, 0, 0.1, -0.5, 0, 0.25, 0),
"times": PackedFloat32Array(0, 6)
}
tracks/5/type = "bezier"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath(".:color:b")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0.937255, -0.25, 0, 0.25, 0, 0.3, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 6)
}
tracks/6/type = "bezier"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("../Background/Stars:modulate:a")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 1, 0, 1, -1, 0, 0.25, 0),
"times": PackedFloat32Array(0, 6)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_c30x0"]
_data = {
"RESET": SubResource("Animation_n8ktn"),
"change_time": SubResource("Animation_7cwe6")
}
[sub_resource type="GDScript" id="GDScript_rkc4w"]
script/source = "extends Timer
var day = true
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _change_time() -> void:
print(day)
if day:
$\"../AnimationPlayer\".play(\"change_time\")
day = not day
else:
$\"../AnimationPlayer\".play_backwards(\"change_time\")
day = not day
"
[sub_resource type="RectangleShape2D" id="RectangleShape2D_o05as"]
size = Vector2(4, 15)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0a3yj"]
size = Vector2(361, 8)
[node name="Game" type="Node"]
script = ExtResource("1_ar2ah")
[node name="Screen" type="Node2D" parent="."]
[node name="AnimationPlayer" type="AnimationPlayer" parent="Screen"]
root_node = NodePath("../BackgroundRect")
libraries = {
"": SubResource("AnimationLibrary_c30x0")
}
[node name="Day-NightTimer" type="Timer" parent="Screen"]
wait_time = 12.0
autostart = true
script = SubResource("GDScript_rkc4w")
[node name="BackgroundRect" type="ColorRect" parent="Screen"]
offset_right = 801.0
offset_bottom = 97.0
color = Color(0.560784, 0.937255, 0.937255, 1)
[node name="Background" type="Node2D" parent="Screen"]
[node name="Stars" type="Sprite2D" parent="Screen/Background"]
modulate = Color(1, 1, 1, 0)
position = Vector2(85, 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)
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")
[node name="Floor" type="StaticBody2D" parent="Screen/Background"]
[node name="EasterEggFixCollision" type="CollisionShape2D" parent="Screen/Background/Floor"]
position = Vector2(-2, 83.5)
shape = SubResource("RectangleShape2D_o05as")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Screen/Background/Floor"]
position = Vector2(101.5, 96)
shape = SubResource("RectangleShape2D_0a3yj")
[node name="HindernissSpawner" type="Marker2D" parent="Screen"]
position = Vector2(446, 92)
script = ExtResource("4_oc6me")
[node name="Duck" parent="Screen" instance=ExtResource("2")]
position = Vector2(21, 91)
[node name="WolkenSpawner" type="Marker2D" parent="Screen"]
position = Vector2(485, -1)
script = ExtResource("11_x2wm3")
[node name="LevelUpTimer" type="Timer" parent="Screen"]
wait_time = 5.0
[node name="SpawnTimer" type="Timer" parent="Screen"]
wait_time = 1.6
[node name="WolkenTimer" type="Timer" parent="Screen"]
autostart = true
[node name="EastereggSpawner" type="Marker2D" parent="Screen"]
position = Vector2(81, -18)
script = ExtResource("8_awkaj")
[node name="Gui" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="GameOverSchild" parent="Gui" instance=ExtResource("5_ewtcf")]
visible = false
position = Vector2(279, 0)
[node name="Restart" type="TextureButton" parent="Gui/GameOverSchild"]
texture_repeat = 2
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
grow_horizontal = 2
grow_vertical = 2
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)
script = ExtResource("10_tn1on")
[node name="Start" type="TextureButton" parent="Gui/StartSchild"]
texture_repeat = 2
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
scale = Vector2(3, 3)
texture_normal = ExtResource("11_4sha5")
stretch_mode = 1
[node name="Logo" type="TextureButton" parent="Gui/StartSchild"]
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
grow_horizontal = 2
grow_vertical = 2
rotation = -0.397935
texture_normal = ExtResource("14_4hepj")
[node name="Score" type="Label" parent="Gui"]
layout_mode = 1
anchors_preset = 13
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -0.5
offset_top = 12.0
offset_right = 0.5
offset_bottom = 12.0
grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource("2_m1hnc")
text = "
"
script = ExtResource("2_4em51")
[node name="ScoreCounter" type="Timer" parent="Gui/Score"]
wait_time = 0.1
autostart = true
[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/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/Logo" to="Screen/EastereggSpawner" method="_spawn"]
[connection signal="timeout" from="Gui/Score/ScoreCounter" to="." method="_score"]

View file

@ -0,0 +1,13 @@
extends Marker2D
var speed
func _ready() -> void:
speed = $"/root/Global".speed
func _spawn() -> void:
var wolke = preload("res://scenes/Wolke/wolke.tscn").instantiate()
wolke.global_position.y = randi_range(0,50)
$"../WolkenTimer".wait_time = randf_range(0.5,1.5)
add_child(wolke)

13
scenes/Wolke/wolke.gd Normal file
View file

@ -0,0 +1,13 @@
extends Sprite2D
#var sca: float
var speed: float
# Initialisierung in der _ready Methode
func _ready() -> void:
speed = 10*randi_range(1, 5)
frame = randi_range(0,4)
self_modulate = Color(1,1,1,randf_range(0,0.5))
func _process(delta: float) -> void:
global_position.x -= speed * delta

10
scenes/Wolke/wolke.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://bky81sd1m7fm7"]
[ext_resource type="Texture2D" uid="uid://b03sbc7akorka" path="res://scenes/Wolke/wolken.png" id="1_c6lhp"]
[ext_resource type="Script" path="res://scenes/Wolke/wolke.gd" id="2_tsh5n"]
[node name="Wolke" type="Sprite2D"]
texture_filter = 1
texture = ExtResource("1_c6lhp")
hframes = 5
script = ExtResource("2_tsh5n")

BIN
scenes/Wolke/wolken.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

View file

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

View file

@ -0,0 +1,9 @@
extends Marker2D
func _spawn() -> void:
var easteregg = preload("res://scenes/easteregg/easteregg.tscn").instantiate()
add_child(easteregg)
func del_all():
for child in get_children():
child.queue_free()

View file

@ -0,0 +1,12 @@
extends RigidBody2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Sprite.frame = randi_range(0,4)
position.x += randi_range(-10,10)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View file

@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=3 uid="uid://co76l7v0x2t8t"]
[ext_resource type="Script" path="res://scenes/easteregg/easteregg.gd" id="1_3dnpr"]
[ext_resource type="Texture2D" uid="uid://bp48x77dixrme" path="res://scenes/hindernis/hindernisse.png" id="1_al4up"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ruej1"]
radius = 8.06226
[node name="RigidBody2D" type="RigidBody2D"]
script = ExtResource("1_3dnpr")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -7)
shape = SubResource("CircleShape2D_ruej1")
[node name="Sprite" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -7)
texture = ExtResource("1_al4up")
offset = Vector2(0, 0.5)
hframes = 5
frame = 3

View file

@ -0,0 +1,24 @@
extends Marker2D
var speed
func _ready() -> void:
speed = $"/root/Global".speed #get_parent().speed
func _spawn() -> void:
var hindernis = preload("res://scenes/hindernis/hindernis.tscn").instantiate()
speed = $"/root/Global".speed
hindernis.speed = speed
var v1 = 1.5 - (speed / 260)
var v2 = 2.0 - (speed / 260)
print(str(v1)," ",str(v2))
$"../SpawnTimer".wait_time = randf_range(v1,v2)
print("speed: ",speed)
add_child(hindernis)
func del_all():
for child in get_children():
child.queue_free()

View file

@ -0,0 +1,11 @@
extends CharacterBody2D
@onready var speed = 0
func _ready() -> void:
$"Sprite".frame = randi_range(0,4)
func _process(delta: float) -> void:
speed = $"..".speed
global_position.x -= speed*delta

View file

@ -0,0 +1,36 @@
[gd_scene load_steps=5 format=3 uid="uid://cp43g3amm8a6f"]
[ext_resource type="Script" path="res://scenes/hindernis/hindernis.gd" id="1_e0hqe"]
[ext_resource type="Texture2D" uid="uid://bp48x77dixrme" path="res://scenes/hindernis/hindernisse.png" id="2_thg8w"]
[sub_resource type="CircleShape2D" id="CircleShape2D_orpyb"]
radius = 5.0
[sub_resource type="CircleShape2D" id="CircleShape2D_r1tmj"]
radius = 5.0
[node name="CharacterBody2D" type="CharacterBody2D"]
collision_layer = 3
collision_mask = 3
script = ExtResource("1_e0hqe")
[node name="Sprite" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -7)
texture = ExtResource("2_thg8w")
offset = Vector2(0, 0.5)
hframes = 5
frame = 3
[node name="collision" type="CollisionShape2D" parent="."]
position = Vector2(0, -7)
shape = SubResource("CircleShape2D_orpyb")
[node name="Area2D" type="Area2D" parent="."]
position = Vector2(0, -7)
collision_layer = 3
collision_mask = 3
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_r1tmj")
debug_color = Color(0.906661, 0.254677, 0.42413, 0.42)

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

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

89
scenes/schild.tscn Normal file
View file

@ -0,0 +1,89 @@
[gd_scene load_steps=7 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
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, 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]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n8lkd"]
_data = {
"RESET": SubResource("Animation_2ygp6"),
"in": SubResource("Animation_2vs66"),
"out": SubResource("Animation_2eby2")
}
[node name="Schild" type="Sprite2D"]
texture_filter = 1
texture = ExtResource("1_wyhk0")
script = ExtResource("2_pxsow")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_n8lkd")
}