- fixing hindernis speed
- Biom implementation - Better Graphics - again icon fix
BIN
assets/Ground/f.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
34
assets/Ground/f.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bkvncdu12do8h"
|
||||
path="res://.godot/imported/f.png-0bb357aaad3f190d3595a1032c921bfe.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/f.png"
|
||||
dest_files=["res://.godot/imported/f.png-0bb357aaad3f190d3595a1032c921bfe.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
|
Before Width: | Height: | Size: 5.4 KiB |
BIN
assets/Ground/s.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
34
assets/Ground/s.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://h5lmps4jxju7"
|
||||
path="res://.godot/imported/s.png-0af6d1fd4a1289066043e7b0864be0eb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/s.png"
|
||||
dest_files=["res://.godot/imported/s.png-0af6d1fd4a1289066043e7b0864be0eb.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
|
BIN
assets/Ground/transisions/n_s.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
34
assets/Ground/transisions/n_s.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d3fy8kykhgook"
|
||||
path="res://.godot/imported/n_s.png-cfcc7a58229e689440ae0dbfa52dc24b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/transisions/n_s.png"
|
||||
dest_files=["res://.godot/imported/n_s.png-cfcc7a58229e689440ae0dbfa52dc24b.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
|
BIN
assets/Ground/transisions/n_w.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
|
@ -3,15 +3,15 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cthy542lxhe5q"
|
||||
path="res://.godot/imported/n_w.png-3366615037638c8fbe0a788e5097fd5c.ctex"
|
||||
path="res://.godot/imported/n_w.png-6b82a1e9d4c66f03fbccb2ea5d832613.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/n_w.png"
|
||||
dest_files=["res://.godot/imported/n_w.png-3366615037638c8fbe0a788e5097fd5c.ctex"]
|
||||
source_file="res://assets/Ground/transisions/n_w.png"
|
||||
dest_files=["res://.godot/imported/n_w.png-6b82a1e9d4c66f03fbccb2ea5d832613.ctex"]
|
||||
|
||||
[params]
|
||||
|
BIN
assets/Ground/transisions/s_n.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
34
assets/Ground/transisions/s_n.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c8g0plv3864sx"
|
||||
path="res://.godot/imported/s_n.png-c020b7ec12c669893cb80100a77473ac.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/transisions/s_n.png"
|
||||
dest_files=["res://.godot/imported/s_n.png-c020b7ec12c669893cb80100a77473ac.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
|
BIN
assets/Ground/transisions/w_n.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
|
@ -3,15 +3,15 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvel70kpfhdyx"
|
||||
path="res://.godot/imported/w_n.png-5b7c970c02b0839cd9da18edab137348.ctex"
|
||||
path="res://.godot/imported/w_n.png-c6ed57fb0761144dfd54fa145c0d35bb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/w_n.png"
|
||||
dest_files=["res://.godot/imported/w_n.png-5b7c970c02b0839cd9da18edab137348.ctex"]
|
||||
source_file="res://assets/Ground/transisions/w_n.png"
|
||||
dest_files=["res://.godot/imported/w_n.png-c6ed57fb0761144dfd54fa145c0d35bb.ctex"]
|
||||
|
||||
[params]
|
||||
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
@ -3,15 +3,15 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dgfvf2ta4lc4e"
|
||||
path="res://.godot/imported/stars.png-57bc8dc47b79b5d04d53ace720164aae.ctex"
|
||||
path="res://.godot/imported/stars.png-0cec3e64e602a6d2ff05e29e04abb435.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Ground/stars.png"
|
||||
dest_files=["res://.godot/imported/stars.png-57bc8dc47b79b5d04d53ace720164aae.ctex"]
|
||||
source_file="res://assets/stars.png"
|
||||
dest_files=["res://.godot/imported/stars.png-0cec3e64e602a6d2ff05e29e04abb435.ctex"]
|
||||
|
||||
[params]
|
||||
|
|
@ -8,6 +8,7 @@ signal start
|
|||
var maxspeed = 260
|
||||
var speed = 100
|
||||
var score = 0
|
||||
var active_biom
|
||||
var gamerunning = false
|
||||
|
||||
|
||||
|
|
BIN
icon_android.png
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 3 KiB |
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)
|
||||
|
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 2.8 KiB |