diff --git a/assets/bg_layer_1.png b/assets/bg_layer_1.png new file mode 100644 index 0000000..160bbb9 Binary files /dev/null and b/assets/bg_layer_1.png differ diff --git a/assets/bg_layer_1.png.import b/assets/bg_layer_1.png.import new file mode 100644 index 0000000..53735d5 --- /dev/null +++ b/assets/bg_layer_1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://g72h528mv865" +path="res://.godot/imported/bg_layer_1.png-8aa06c673d4d479858fe120eb3580956.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/bg_layer_1.png" +dest_files=["res://.godot/imported/bg_layer_1.png-8aa06c673d4d479858fe120eb3580956.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 diff --git a/assets/bg_layer_2.png b/assets/bg_layer_2.png new file mode 100644 index 0000000..5e3f013 Binary files /dev/null and b/assets/bg_layer_2.png differ diff --git a/assets/bg_layer_2.png.import b/assets/bg_layer_2.png.import new file mode 100644 index 0000000..62c6607 --- /dev/null +++ b/assets/bg_layer_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d4hor7kdbyuee" +path="res://.godot/imported/bg_layer_2.png-70aef8dc03bd50cb9a332df4e578dab2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/bg_layer_2.png" +dest_files=["res://.godot/imported/bg_layer_2.png-70aef8dc03bd50cb9a332df4e578dab2.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 diff --git a/assets/dumpster.png b/assets/dumpster.png index f035f94..aee7211 100644 Binary files a/assets/dumpster.png and b/assets/dumpster.png differ diff --git a/assets/fallen_trash_bin.png b/assets/fallen_trash_bin.png new file mode 100644 index 0000000..2e4fc70 Binary files /dev/null and b/assets/fallen_trash_bin.png differ diff --git a/assets/fallen_trash_bin.png.import b/assets/fallen_trash_bin.png.import new file mode 100644 index 0000000..9a2a1c7 --- /dev/null +++ b/assets/fallen_trash_bin.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ggokg3argpbk" +path="res://.godot/imported/fallen_trash_bin.png-22c9a3dc66092b01faf9cc9dd979a89c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/fallen_trash_bin.png" +dest_files=["res://.godot/imported/fallen_trash_bin.png-22c9a3dc66092b01faf9cc9dd979a89c.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 diff --git a/assets/floor.png b/assets/floor.png index 2914b40..ffdf8c1 100644 Binary files a/assets/floor.png and b/assets/floor.png differ diff --git a/assets/kickflip.png b/assets/kickflip.png new file mode 100644 index 0000000..9374ea4 Binary files /dev/null and b/assets/kickflip.png differ diff --git a/assets/kickflip.png.import b/assets/kickflip.png.import new file mode 100644 index 0000000..660b212 --- /dev/null +++ b/assets/kickflip.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cs1aswuagw3d5" +path="res://.godot/imported/kickflip.png-57f5795c54b8adfaec426da4840ba0fd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/kickflip.png" +dest_files=["res://.godot/imported/kickflip.png-57f5795c54b8adfaec426da4840ba0fd.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 diff --git a/assets/kickflip_anim.png.png b/assets/kickflip_anim.png.png new file mode 100644 index 0000000..140a3ec Binary files /dev/null and b/assets/kickflip_anim.png.png differ diff --git a/assets/kickflip_anim.png.png.import b/assets/kickflip_anim.png.png.import new file mode 100644 index 0000000..e6a0aa1 --- /dev/null +++ b/assets/kickflip_anim.png.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://vqxrxcbghjq1" +path="res://.godot/imported/kickflip_anim.png.png-83de4fce51ea95ff362ba51d74537709.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/kickflip_anim.png.png" +dest_files=["res://.godot/imported/kickflip_anim.png.png-83de4fce51ea95ff362ba51d74537709.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 diff --git a/assets/skate_dude_gray.png b/assets/skate_dude_gray.png index a7b2b3c..7f6b588 100644 Binary files a/assets/skate_dude_gray.png and b/assets/skate_dude_gray.png differ diff --git a/assets/traffic_cone.png b/assets/traffic_cone.png new file mode 100644 index 0000000..ad90bc3 Binary files /dev/null and b/assets/traffic_cone.png differ diff --git a/assets/traffic_cone.png.import b/assets/traffic_cone.png.import new file mode 100644 index 0000000..83063ca --- /dev/null +++ b/assets/traffic_cone.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://br5fxiry2swpn" +path="res://.godot/imported/traffic_cone.png-e0fb7ebc04fd69b5864bd396516ebcb2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/traffic_cone.png" +dest_files=["res://.godot/imported/traffic_cone.png-e0fb7ebc04fd69b5864bd396516ebcb2.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 diff --git a/assets/traffic_cone_placeholder.png b/assets/traffic_cone_placeholder.png index f1f0e5b..3ff9b59 100644 Binary files a/assets/traffic_cone_placeholder.png and b/assets/traffic_cone_placeholder.png differ diff --git a/assets/trash_bin.png b/assets/trash_bin.png index 323ecb0..b1ab2fd 100644 Binary files a/assets/trash_bin.png and b/assets/trash_bin.png differ diff --git a/project.godot b/project.godot index d958d9d..6a15a4e 100644 --- a/project.godot +++ b/project.godot @@ -38,4 +38,4 @@ ui_up={ [rendering] textures/canvas_textures/default_texture_filter=0 -environment/defaults/default_clear_color=Color(0.899258, 0.899258, 0.899258, 1) +environment/defaults/default_clear_color=Color(0.87451, 0.87451, 0.87451, 1) diff --git a/scenes/chunk.tscn b/scenes/chunk.tscn index e2c316d..1a35556 100644 --- a/scenes/chunk.tscn +++ b/scenes/chunk.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://d1ye7lacsmglb"] [ext_resource type="Script" path="res://scripts/chunk.gd" id="1_t73m7"] -[ext_resource type="Texture2D" uid="uid://fotmrav530xb" path="res://assets/road.png" id="2_k5wgc"] +[ext_resource type="Texture2D" uid="uid://diblvp3gxsr6q" path="res://assets/floor.png" id="2_v0ykj"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_5jwgi"] size = Vector2(640, 640) @@ -20,100 +20,8 @@ position = Vector2(320, 320) scale = Vector2(1.1, 1) shape = SubResource("RectangleShape2D_5jwgi") -[node name="Sprite2D9" type="Sprite2D" parent="Floor"] -position = Vector2(-48, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D10" type="Sprite2D" parent="Floor"] -position = Vector2(-16, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D11" type="Sprite2D" parent="Floor"] -position = Vector2(16, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D12" type="Sprite2D" parent="Floor"] -position = Vector2(48, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D13" type="Sprite2D" parent="Floor"] -position = Vector2(80, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D14" type="Sprite2D" parent="Floor"] -position = Vector2(112, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D15" type="Sprite2D" parent="Floor"] -position = Vector2(144, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D16" type="Sprite2D" parent="Floor"] -position = Vector2(176, -289) -texture = ExtResource("2_k5wgc") - [node name="Sprite2D" type="Sprite2D" parent="Floor"] -position = Vector2(-304, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D2" type="Sprite2D" parent="Floor"] -position = Vector2(-272, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D3" type="Sprite2D" parent="Floor"] -position = Vector2(-240, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D4" type="Sprite2D" parent="Floor"] -position = Vector2(-208, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D5" type="Sprite2D" parent="Floor"] -position = Vector2(-176, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D6" type="Sprite2D" parent="Floor"] -position = Vector2(-144, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D7" type="Sprite2D" parent="Floor"] -position = Vector2(-112, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D8" type="Sprite2D" parent="Floor"] -position = Vector2(-80, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D17" type="Sprite2D" parent="Floor"] -position = Vector2(208, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D18" type="Sprite2D" parent="Floor"] -position = Vector2(240, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D19" type="Sprite2D" parent="Floor"] -position = Vector2(272, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D20" type="Sprite2D" parent="Floor"] -position = Vector2(304, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D21" type="Sprite2D" parent="Floor"] -position = Vector2(336, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D22" type="Sprite2D" parent="Floor"] -position = Vector2(368, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D23" type="Sprite2D" parent="Floor"] -position = Vector2(-368, -289) -texture = ExtResource("2_k5wgc") - -[node name="Sprite2D24" type="Sprite2D" parent="Floor"] -position = Vector2(-336, -289) -texture = ExtResource("2_k5wgc") +scale = Vector2(1.1, 1) +texture = ExtResource("2_v0ykj") [connection signal="tree_exited" from="." to="." method="_on_tree_exited"] diff --git a/scenes/dumpster.tscn b/scenes/dumpster.tscn index 3f4ac3d..333fb2c 100644 --- a/scenes/dumpster.tscn +++ b/scenes/dumpster.tscn @@ -4,19 +4,20 @@ [ext_resource type="Script" path="res://scripts/obstacle.gd" id="1_875mt"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_gu0a6"] -size = Vector2(44, 30) +size = Vector2(60, 44) [node name="Dumpster" type="StaticBody2D"] script = ExtResource("1_875mt") [node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(0, -16) scale = Vector2(2, 2) texture = ExtResource("1_2cg1o") [node name="Area2D" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2(0, 1) +position = Vector2(0, -6) shape = SubResource("RectangleShape2D_gu0a6") [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/scenes/fallen_trash_bin.tscn b/scenes/fallen_trash_bin.tscn new file mode 100644 index 0000000..46cd96f --- /dev/null +++ b/scenes/fallen_trash_bin.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=4 format=3 uid="uid://cbp36gw8aqkpq"] + +[ext_resource type="Script" path="res://scripts/obstacle.gd" id="1_8pcuq"] +[ext_resource type="Texture2D" uid="uid://ggokg3argpbk" path="res://assets/fallen_trash_bin.png" id="2_pahix"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_ehy2f"] +radius = 14.0 + +[node name="Fallen_Trash_Bin" type="StaticBody2D"] +script = ExtResource("1_8pcuq") + +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-3.425, -16) +scale = Vector2(2, 2) +texture = ExtResource("2_pahix") + +[node name="Area2D" type="Area2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +position = Vector2(1, 2) +shape = SubResource("CircleShape2D_ehy2f") + +[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/scenes/player.tscn b/scenes/player.tscn index 94ac877..34917a6 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,13 +1,13 @@ -[gd_scene load_steps=18 format=3 uid="uid://cpos732lfps07"] +[gd_scene load_steps=17 format=3 uid="uid://cpos732lfps07"] [ext_resource type="Script" path="res://scripts/player.gd" id="1_nc2u8"] -[ext_resource type="Texture2D" uid="uid://b85cbrudora1x" path="res://assets/idle_anim.png" id="2_owago"] +[ext_resource type="Texture2D" uid="uid://cs1aswuagw3d5" path="res://assets/kickflip.png" id="3_80mky"] [ext_resource type="Texture2D" uid="uid://c1aadu4ibolyb" path="res://assets/skate_dude_gray.png" id="4_jgj0f"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_s0f7d"] -[sub_resource type="Animation" id="Animation_hv44y"] -resource_name = "idle_anim" +[sub_resource type="Animation" id="Animation_rqdn3"] +length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -30,7 +30,7 @@ tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [15] +"values": [11] } tracks/2/type = "value" tracks/2/imported = false @@ -57,8 +57,11 @@ tracks/3/keys = { "values": [0] } -[sub_resource type="Animation" id="Animation_rqdn3"] -length = 0.001 +[sub_resource type="Animation" id="Animation_a2wt3"] +resource_name = "fall_anim" +length = 0.13334 +loop_mode = 1 +step = 0.0666667 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -69,7 +72,7 @@ tracks/0/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [ExtResource("2_owago")] +"values": [ExtResource("4_jgj0f")] } tracks/1/type = "value" tracks/1/imported = false @@ -81,8 +84,59 @@ tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, +"values": [9] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Sprite2D:vframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, "values": [1] } +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Sprite2D:frame") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [8] +} + +[sub_resource type="Animation" id="Animation_hv44y"] +resource_name = "idle_anim" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [ExtResource("3_80mky")] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite2D:hframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [6] +} tracks/2/type = "value" tracks/2/imported = false tracks/2/enabled = true @@ -110,7 +164,7 @@ tracks/3/keys = { [sub_resource type="Animation" id="Animation_peq0d"] resource_name = "jump_anim" -length = 0.73334 +length = 0.53334 step = 0.0666667 tracks/0/type = "value" tracks/0/imported = false @@ -134,7 +188,7 @@ tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [15] +"values": [9] } tracks/2/type = "value" tracks/2/imported = false @@ -155,15 +209,15 @@ tracks/3/path = NodePath("Sprite2D:frame") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { -"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333, 0.4, 0.466667, 0.533333, 0.6, 0.666667), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), +"times": PackedFloat32Array(0, 0.066666, 0.133333, 0.2, 0.266666, 0.333333, 0.4, 0.466667), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1), "update": 1, -"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +"values": [1, 2, 3, 4, 5, 6, 7, 8] } -[sub_resource type="Animation" id="Animation_a2wt3"] -resource_name = "fall_anim" -length = 0.13334 +[sub_resource type="Animation" id="Animation_ru3gh"] +resource_name = "kickflip" +length = 0.400007 step = 0.0666667 tracks/0/type = "value" tracks/0/imported = false @@ -175,7 +229,7 @@ tracks/0/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [ExtResource("4_jgj0f")] +"values": [ExtResource("3_80mky")] } tracks/1/type = "value" tracks/1/imported = false @@ -187,7 +241,7 @@ tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [15] +"values": [6] } tracks/2/type = "value" tracks/2/imported = false @@ -208,10 +262,10 @@ tracks/3/path = NodePath("Sprite2D:frame") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { -"times": PackedFloat32Array(0, 0.0666667), -"transitions": PackedFloat32Array(1, 1), +"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), "update": 1, -"values": [13, 14] +"values": [0, 1, 2, 3, 4, 5] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_b4cbu"] @@ -219,48 +273,41 @@ _data = { "RESET": SubResource("Animation_rqdn3"), "fall_anim": SubResource("Animation_a2wt3"), "idle_anim": SubResource("Animation_hv44y"), -"jump_anim": SubResource("Animation_peq0d") +"jump_anim": SubResource("Animation_peq0d"), +"kickflip": SubResource("Animation_ru3gh") } -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ohqf5"] -animation = &"fall_anim" - [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_px8r0"] animation = &"idle_anim" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6bnqg"] -animation = &"jump_anim" +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_qqsi6"] +animation = &"kickflip" [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_sjec6"] advance_mode = 2 -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lcoik"] +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rxn5g"] -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4ucyu"] -switch_mode = 2 -advance_mode = 2 - -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_nbp7g"] +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ki3dc"] switch_mode = 2 advance_mode = 2 [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_io5t7"] states/Start/position = Vector2(266, 109) -states/fall_anim/node = SubResource("AnimationNodeAnimation_ohqf5") -states/fall_anim/position = Vector2(361, 230) states/idle_anim/node = SubResource("AnimationNodeAnimation_px8r0") states/idle_anim/position = Vector2(456, 109) -states/jump_anim/node = SubResource("AnimationNodeAnimation_6bnqg") -states/jump_anim/position = Vector2(568, 230) -transitions = ["Start", "idle_anim", SubResource("AnimationNodeStateMachineTransition_sjec6"), "idle_anim", "jump_anim", SubResource("AnimationNodeStateMachineTransition_lcoik"), "jump_anim", "fall_anim", SubResource("AnimationNodeStateMachineTransition_4ucyu"), "fall_anim", "idle_anim", SubResource("AnimationNodeStateMachineTransition_nbp7g")] -graph_offset = Vector2(-256, 86) +states/kickflip/node = SubResource("AnimationNodeAnimation_qqsi6") +states/kickflip/position = Vector2(517, 206) +transitions = ["Start", "idle_anim", SubResource("AnimationNodeStateMachineTransition_sjec6"), "idle_anim", "kickflip", SubResource("AnimationNodeStateMachineTransition_rxn5g"), "kickflip", "idle_anim", SubResource("AnimationNodeStateMachineTransition_ki3dc")] +graph_offset = Vector2(-115, 16) [node name="Player" type="CharacterBody2D"] script = ExtResource("1_nc2u8") [node name="Sprite2D" type="Sprite2D" parent="."] scale = Vector2(2, 2) -texture = ExtResource("2_owago") +texture = ExtResource("4_jgj0f") +hframes = 11 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, 18) @@ -274,3 +321,5 @@ libraries = { [node name="AnimationTree" type="AnimationTree" parent="."] tree_root = SubResource("AnimationNodeStateMachine_io5t7") anim_player = NodePath("../AnimationPlayer") + +[connection signal="animation_finished" from="AnimationTree" to="." method="_on_animation_tree_animation_finished"] diff --git a/scenes/traffic_cone.tscn b/scenes/traffic_cone.tscn index a29b3ec..35999e5 100644 --- a/scenes/traffic_cone.tscn +++ b/scenes/traffic_cone.tscn @@ -1,23 +1,24 @@ [gd_scene load_steps=4 format=3 uid="uid://cprufv651ifle"] -[ext_resource type="Texture2D" uid="uid://bnxkjag7lwjgx" path="res://assets/traffic_cone_placeholder.png" id="1_bo7m2"] [ext_resource type="Script" path="res://scripts/obstacle.gd" id="1_vfbeq"] +[ext_resource type="Texture2D" uid="uid://br5fxiry2swpn" path="res://assets/traffic_cone.png" id="2_gf4au"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bpx8e"] radius = 6.0 -height = 20.0 +height = 34.0 [node name="Traffic_Cone" type="StaticBody2D"] script = ExtResource("1_vfbeq") [node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(0, -16) scale = Vector2(2, 2) -texture = ExtResource("1_bo7m2") +texture = ExtResource("2_gf4au") [node name="Area2D" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2(0.85, 6.505) +position = Vector2(-1, -1) shape = SubResource("CapsuleShape2D_bpx8e") [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/scenes/trash_bin.tscn b/scenes/trash_bin.tscn index 5650569..bd7787a 100644 --- a/scenes/trash_bin.tscn +++ b/scenes/trash_bin.tscn @@ -4,20 +4,21 @@ [ext_resource type="Texture2D" uid="uid://ura1rws1kt66" path="res://assets/trash_bin.png" id="1_bst32"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ge82x"] -radius = 9.0 -height = 22.0 +radius = 13.0 +height = 36.0 [node name="Trash_Bin" type="StaticBody2D"] script = ExtResource("1_7patp") [node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-3.425, -16) scale = Vector2(2, 2) texture = ExtResource("1_bst32") [node name="Area2D" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2(1, 6) +position = Vector2(1, -3) shape = SubResource("CapsuleShape2D_ge82x") [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/scenes/world.tscn b/scenes/world.tscn index bffbc50..a1adf9b 100644 --- a/scenes/world.tscn +++ b/scenes/world.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=4 format=3 uid="uid://1y6mjtlgxsvj"] +[gd_scene load_steps=6 format=3 uid="uid://1y6mjtlgxsvj"] [ext_resource type="Script" path="res://scripts/world.gd" id="1_n02te"] [ext_resource type="FontFile" uid="uid://b51saovrvm1yv" path="res://assets/fonts/Minecraft.ttf" id="2_5ehxf"] [ext_resource type="PackedScene" uid="uid://cpos732lfps07" path="res://scenes/player.tscn" id="2_ctbnd"] +[ext_resource type="Texture2D" uid="uid://g72h528mv865" path="res://assets/bg_layer_1.png" id="4_0hnt7"] +[ext_resource type="Texture2D" uid="uid://d4hor7kdbyuee" path="res://assets/bg_layer_2.png" id="5_63neo"] [node name="World" type="Node2D"] script = ExtResource("1_n02te") @@ -15,7 +17,7 @@ offset_left = 214.0 offset_top = -176.0 offset_right = 317.0 offset_bottom = -152.0 -theme_override_colors/font_color = Color(0.32549, 0.32549, 0.32549, 1) +theme_override_colors/font_color = Color(0.12549, 0.12549, 0.12549, 1) theme_override_fonts/font = ExtResource("2_5ehxf") horizontal_alignment = 2 @@ -24,7 +26,7 @@ offset_left = -316.0 offset_top = -176.0 offset_right = -209.0 offset_bottom = -151.0 -theme_override_colors/font_color = Color(0.32549, 0.32549, 0.32549, 1) +theme_override_colors/font_color = Color(0.12549, 0.12549, 0.12549, 1) theme_override_fonts/font = ExtResource("2_5ehxf") [node name="Chunks" type="Node" parent="."] @@ -33,3 +35,21 @@ theme_override_fonts/font = ExtResource("2_5ehxf") top_level = true position = Vector2(100, -100) World = NodePath("..") + +[node name="ParallaxBackground" type="ParallaxBackground" parent="."] + +[node name="MiddleLayer" type="ParallaxLayer" parent="ParallaxBackground"] +motion_scale = Vector2(0.6, 0.6) +motion_mirroring = Vector2(640, 0) + +[node name="Sprite2D" type="Sprite2D" parent="ParallaxBackground/MiddleLayer"] +position = Vector2(320, -60) +texture = ExtResource("5_63neo") + +[node name="FrontLayer" type="ParallaxLayer" parent="ParallaxBackground"] +motion_scale = Vector2(0.8, 0.8) +motion_mirroring = Vector2(640, 0) + +[node name="Sprite2D" type="Sprite2D" parent="ParallaxBackground/FrontLayer"] +position = Vector2(320, -120) +texture = ExtResource("4_0hnt7") diff --git a/scripts/chunk.gd b/scripts/chunk.gd index 6bc678a..0911e2a 100644 --- a/scripts/chunk.gd +++ b/scripts/chunk.gd @@ -4,7 +4,8 @@ extends Node2D var Trash_Bin: PackedScene = load("res://scenes/trash_bin.tscn") var Traffic_Cone: PackedScene = load("res://scenes/traffic_cone.tscn") var Dumpster: PackedScene = load("res://scenes/dumpster.tscn") -var obstacle_types: Array = [Trash_Bin, Traffic_Cone, Dumpster] +var Fallen_Trash_Bin: PackedScene = load("res://scenes/fallen_trash_bin.tscn") +var obstacle_types: Array = [Trash_Bin, Traffic_Cone, Dumpster, Fallen_Trash_Bin] var obstacles: Array = [] const START_X: int = 40; @@ -28,3 +29,7 @@ func create_obstacle(x_position: int) -> Node2D: obstacles.append(create_obstacle(obstacle.position.x + 200)) Obstacles.add_child(obstacle) return obstacle + +func new_obstacle(obstacle_name: String): + if obstacle_name == "Dumpster": + obstacle_types.append(Dumpster) diff --git a/scripts/player.gd b/scripts/player.gd index 016f60e..953417e 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -2,37 +2,42 @@ extends CharacterBody2D @onready var state_machine = $AnimationTree["parameters/playback"] @export var World: Node2D -const JUMP_VELOCITY = -300.0 +const JUMP_VELOCITY = -400.0 # Get the gravity from the project settings to be synced with RigidBody nodes. -var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") -@export var antiGravity: float = -400.0 - +var gravity = 2000 #ProjectSettings.get_setting("physics/2d/default_gravity") +@export var antiGravity: float = -1100.0 func _physics_process(delta): # Add the gravity. if not is_on_floor(): velocity.y += gravity * delta + else: + state_machine.travel('idle_anim') # Handle jump. if Input.is_action_just_pressed("ui_accept") and is_on_floor(): jump() # if jump is held, jump higher by reducing gravity - if(!is_on_floor() && Input.is_action_pressed("ui_accept") && velocity.y < 0): + if (!is_on_floor() && Input.is_action_pressed("ui_accept") && velocity.y < 0) or is_pressed: velocity.y += antiGravity * delta - - + move_and_slide() func jump(): velocity.y = JUMP_VELOCITY - state_machine.travel("jump_anim") + state_machine.travel("kickflip") func damage(): World.reset() +var is_pressed = false func _unhandled_input(event): if event is InputEventScreenTouch and is_on_floor(): jump() + if event is InputEventScreenTouch and event.pressed: + is_pressed = true + else: + is_pressed = false diff --git a/scripts/world.gd b/scripts/world.gd index e33aeac..128ee8e 100644 --- a/scripts/world.gd +++ b/scripts/world.gd @@ -7,6 +7,7 @@ extends Node2D @onready var Chunks = $Chunks @onready var Score = $Camera2D/Score @onready var HighScore = $Camera2D/HighScore +@onready var Background = $ParallaxBackground var ChunkScene: PackedScene = preload("res://scenes/chunk.tscn") var ChunkNoObstacleScene: PackedScene = preload("res://scenes/chunk_no_obstacles.tscn") var chunks: Array = []; @@ -29,11 +30,15 @@ func _process(delta): Score.text = str(total_score) update_chunks() move_chunks(speed, delta) + move_background(speed, delta) func move_chunks(speed: int, delta: float): for chunk in chunks: chunk.position.x -= speed * delta; +func move_background(speed: int, delta: float): + Background.scroll_base_offset.x -= speed * delta; + func update_chunks(): for chunk in chunks: if chunk.position.x < UNLOAD_CHUNK_X: