- fixing hindernis speed
- Biom implementation - Better Graphics - again icon fix
This commit is contained in:
parent
431fb8220e
commit
21e927966d
25 changed files with 312 additions and 65 deletions
105
scenes/Main.tscn
105
scenes/Main.tscn
|
@ -1,8 +1,8 @@
|
|||
[gd_scene load_steps=37 format=3 uid="uid://bb5qp5868y5i"]
|
||||
[gd_scene load_steps=39 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="Texture2D" uid="uid://dgfvf2ta4lc4e" path="res://assets/Ground/stars.png" id="2_ohf2r"]
|
||||
[ext_resource type="Texture2D" uid="uid://dgfvf2ta4lc4e" path="res://assets/stars.png" id="2_ohf2r"]
|
||||
[ext_resource type="Script" path="res://scenes/ground/spawner/ground_spawner.gd" id="3_va7mo"]
|
||||
[ext_resource type="Script" path="res://scenes/hindernis/Spawner/hindernis_spawner.gd" id="4_oc6me"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjq8kb0mhjh8r" path="res://scenes/ground/ground.tscn" id="4_tt0te"]
|
||||
|
@ -27,33 +27,81 @@
|
|||
[ext_resource type="AudioStream" uid="uid://c4wrtvywao1jn" path="res://assets/audio/duckrun.wav" id="22_ijpe0"]
|
||||
[ext_resource type="Script" path="res://code/score.gd" id="22_m4aei"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_n8ktn"]
|
||||
length = 0.001
|
||||
tracks/0/type = "bezier"
|
||||
[sub_resource type="Animation" id="Animation_4fx6d"]
|
||||
resource_name = "Fade"
|
||||
length = 0.45
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:color:r")
|
||||
tracks/0/path = NodePath("..:modulate")
|
||||
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)
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(0, 0, 0, 1)]
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_j0xom"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("..:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_otim5"]
|
||||
resource_name = "change_time"
|
||||
length = 3.0
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 2.8),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.162512, 0.669077, 0.79808, 1), Color(0.0375358, 0.131849, 0.373243, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:color:g")
|
||||
tracks/1/path = NodePath("..:modulate")
|
||||
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)
|
||||
"times": PackedFloat32Array(0, 3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(0.493545, 0.493546, 0.493546, 1)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../Background/Stars:modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7cwe6"]
|
||||
resource_name = "change_time"
|
||||
resource_name = "change_timeold"
|
||||
length = 6.0
|
||||
step = 0.25
|
||||
tracks/0/type = "bezier"
|
||||
|
@ -136,8 +184,10 @@ tracks/6/keys = {
|
|||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_c30x0"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_n8ktn"),
|
||||
"change_time": SubResource("Animation_7cwe6")
|
||||
"Fade": SubResource("Animation_4fx6d"),
|
||||
"RESET": SubResource("Animation_j0xom"),
|
||||
"change_time": SubResource("Animation_otim5"),
|
||||
"change_timeold": SubResource("Animation_7cwe6")
|
||||
}
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_rkc4w"]
|
||||
|
@ -210,9 +260,9 @@ autostart = true
|
|||
script = SubResource("GDScript_rkc4w")
|
||||
|
||||
[node name="BackgroundRect" type="ColorRect" parent="Screen"]
|
||||
offset_right = 1264.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 97.0
|
||||
color = Color(0.560784, 0.937255, 0.937255, 1)
|
||||
color = Color(0.162512, 0.669077, 0.79808, 1)
|
||||
|
||||
[node name="Background" type="Node2D" parent="Screen"]
|
||||
|
||||
|
@ -221,6 +271,13 @@ modulate = Color(1, 1, 1, 0)
|
|||
position = Vector2(130, 50)
|
||||
texture = ExtResource("2_ohf2r")
|
||||
|
||||
[node name="WolkenSpawner" type="Marker2D" parent="Screen/Background"]
|
||||
position = Vector2(485, 0)
|
||||
script = ExtResource("11_x2wm3")
|
||||
|
||||
[node name="WolkenTimer" type="Timer" parent="Screen/Background/WolkenSpawner"]
|
||||
autostart = true
|
||||
|
||||
[node name="GroundSpawner" type="Node2D" parent="Screen/Background"]
|
||||
position = Vector2(0, 8)
|
||||
script = ExtResource("3_va7mo")
|
||||
|
@ -245,20 +302,12 @@ position = Vector2(21, 91)
|
|||
position = Vector2(485, 92)
|
||||
script = ExtResource("4_oc6me")
|
||||
|
||||
[node name="WolkenSpawner" type="Marker2D" parent="Screen"]
|
||||
position = Vector2(485, 0)
|
||||
script = ExtResource("11_x2wm3")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[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="Gui" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
@ -538,12 +587,12 @@ autoplay = true
|
|||
bus = &"Background"
|
||||
|
||||
[connection signal="timeout" from="Screen/Day-NightTimer" to="Screen/Day-NightTimer" method="_change_time"]
|
||||
[connection signal="timeout" from="Screen/Background/WolkenSpawner/WolkenTimer" to="Screen/Background/WolkenSpawner" method="_spawn"]
|
||||
[connection signal="screen_entered" from="Screen/Background/GroundSpawner/Ground" to="Screen/Background/GroundSpawner" method="_on_ground_sprite_screen_entered"]
|
||||
[connection signal="gameover" from="Screen/Duck" to="Gui/HiscoreContainer/hiscore" method="set_new_hiscore"]
|
||||
[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="value_changed" from="Gui/Settings/VolumeSlider" to="Gui/Settings" method="_volume_slider_changed"]
|
||||
|
|
|
@ -5,9 +5,8 @@ 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)
|
||||
$WolkenTimer.wait_time = randf_range(0.5,1.5)
|
||||
add_child(wolke)
|
||||
|
|
|
@ -2,50 +2,104 @@ extends Node2D
|
|||
|
||||
var texture_new_sprite : Texture
|
||||
|
||||
var biom_n_w = preload("res://assets/Ground/transisions/n_w.png")
|
||||
var biom_w_n = preload("res://assets/Ground/transisions/w_n.png")
|
||||
var biom_n_s = preload("res://assets/Ground/transisions/n_s.png")
|
||||
var biom_s_n = preload("res://assets/Ground/transisions/s_n.png")
|
||||
|
||||
var biom_n = preload("res://assets/Ground/n.png")
|
||||
var biom_n_w = preload("res://assets/Ground/n_w.png")
|
||||
var biom_w_n = preload("res://assets/Ground/w_n.png")
|
||||
var biom_w = preload("res://assets/Ground/w.png")
|
||||
var biom_s = preload("res://assets/Ground/s.png")
|
||||
var biom_f = preload("res://assets/Ground/f.png")
|
||||
|
||||
var active_biom = "n"
|
||||
var biom_type = "n"#normal,o=other,ui=übergangin,uo=übergangout
|
||||
var change_in = 3
|
||||
var passed
|
||||
|
||||
|
||||
func probability(prozent):
|
||||
return randf() > 1-(0.01*20) # 20% warscheinlichkeit um biom zu tauschen
|
||||
return randf() > 1 - (0.01 * prozent)
|
||||
|
||||
func change_biom():
|
||||
#if active_biom == "w_n":
|
||||
# active_biom = "n"
|
||||
#elif active_biom == "s_n":
|
||||
# active_biom = "n"
|
||||
#elif active_biom == "n_w":
|
||||
# active_biom = "w"
|
||||
#elif active_biom == "n_s":
|
||||
# active_biom = "s"
|
||||
|
||||
if biom_type == "n":
|
||||
change_in -= 1
|
||||
if probability(60):
|
||||
active_biom = "n"
|
||||
else:
|
||||
active_biom = "f"
|
||||
elif biom_type == "o":
|
||||
change_in -= 1
|
||||
biom_type = "o"
|
||||
elif biom_type == "ui":
|
||||
if active_biom == "n_w":
|
||||
active_biom = "w"
|
||||
elif active_biom == "n_s":
|
||||
active_biom = "s"
|
||||
biom_type = "o"
|
||||
elif biom_type == "uo":
|
||||
if active_biom == "w":
|
||||
active_biom = "w_n"
|
||||
biom_type = "n"
|
||||
elif active_biom == "s":
|
||||
active_biom = "s_n"
|
||||
biom_type = "n"
|
||||
biom_type = "n"
|
||||
|
||||
if change_in <= 0: # bei übergängen
|
||||
change_in = randi_range(3,7)
|
||||
if biom_type == "n": #bei normalen biom auf neues biom oder wald
|
||||
if probability(10): # 50% auf Biomwechsel
|
||||
biom_type = "n"
|
||||
else:
|
||||
biom_type = "ui" #übergang in anderes biom
|
||||
if probability(50):
|
||||
active_biom = "n_w"
|
||||
else:
|
||||
active_biom = "n_s"
|
||||
elif biom_type == "o": #bei anderen biomen auf normale Biome
|
||||
biom_type = "uo"
|
||||
|
||||
#print("type : ", biom_type)
|
||||
#print("active: ", active_biom)
|
||||
#print("change: ", change_in)
|
||||
#print(" ")
|
||||
|
||||
func handle_biom_change():
|
||||
if active_biom == "n":
|
||||
if probability(20):
|
||||
active_biom = "n_w"
|
||||
elif active_biom == "n_w":
|
||||
active_biom = "w"
|
||||
elif active_biom == "w":
|
||||
active_biom = "w_n"
|
||||
elif active_biom == "w_n":
|
||||
active_biom = "n"
|
||||
set_biom_texture()
|
||||
|
||||
func set_biom_texture():
|
||||
#print("activebiom_s: " + active_biom)
|
||||
if active_biom == "w":
|
||||
texture_new_sprite = biom_w
|
||||
elif active_biom == "n":
|
||||
texture_new_sprite = biom_n
|
||||
elif active_biom == "s":
|
||||
texture_new_sprite = biom_s
|
||||
elif active_biom == "f":
|
||||
texture_new_sprite = biom_f
|
||||
elif active_biom == "w_n":
|
||||
texture_new_sprite = biom_w_n
|
||||
elif active_biom == "n_w":
|
||||
texture_new_sprite = biom_n_w
|
||||
|
||||
|
||||
elif active_biom == "s_n":
|
||||
texture_new_sprite = biom_s_n
|
||||
elif active_biom == "n_s":
|
||||
texture_new_sprite = biom_n_s
|
||||
func _spawn(last_x_position) -> void:
|
||||
var new_ground = preload("res://scenes/ground/ground.tscn").instantiate()
|
||||
new_ground.texture = texture_new_sprite
|
||||
new_ground.global_position.x = last_x_position+400
|
||||
new_ground.global_position.x = last_x_position + 400
|
||||
add_child(new_ground)
|
||||
new_ground.connect("screen_entered",_on_ground_sprite_screen_entered)
|
||||
|
||||
new_ground.connect("screen_entered", _on_ground_sprite_screen_entered)
|
||||
|
||||
func _on_ground_sprite_screen_entered() -> void:
|
||||
handle_biom_change()
|
||||
change_biom()
|
||||
$"/root/Global".active_biom = active_biom
|
||||
set_biom_texture()
|
||||
_spawn(get_child(0).position.x)
|
||||
|
|
|
@ -4,10 +4,15 @@ extends CharacterBody2D
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
$"Sprite".frame = randi_range(0,4)
|
||||
if $"/root/Global".active_biom == "w":
|
||||
$"Sprite".frame = randi_range(5,9)
|
||||
if $"/root/Global".active_biom == "s":
|
||||
$"Sprite".frame = randi_range(10,12)
|
||||
else:
|
||||
$"Sprite".frame = randi_range(0,4)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
speed = $"..".speed
|
||||
speed = $"/root/Global".speed
|
||||
global_position.x -= speed*delta
|
||||
if global_position.x < -30:
|
||||
queue_free()
|
||||
|
|
|
@ -16,11 +16,14 @@ script = ExtResource("1_e0hqe")
|
|||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
position = Vector2(0, -7)
|
||||
position = Vector2(0, -8)
|
||||
texture = ExtResource("2_thg8w")
|
||||
offset = Vector2(0, 0.5)
|
||||
hframes = 5
|
||||
frame = 3
|
||||
vframes = 3
|
||||
frame = 9
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 80, 48)
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 2.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue