added coins, new parallax graphics, etc.

This commit is contained in:
christophe 2025-08-25 21:06:35 -04:00
parent 2461fd278a
commit 2014ed0b37
28 changed files with 853 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://buxc3k748d7qn"
path="res://.godot/imported/forestbackground.png-1170ae197e211023a79091cf48300332.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/environment/backgrounds/forestbackground.png"
dest_files=["res://.godot/imported/forestbackground.png-1170ae197e211023a79091cf48300332.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bikjxvjmfsqyy"
path="res://.godot/imported/midground.png-4a4c3bbde0207f76d956700b0cb3d4e8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/environment/backgrounds/midground.png"
dest_files=["res://.godot/imported/midground.png-4a4c3bbde0207f76d956700b0cb3d4e8.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://26bbv4ejahja"
path="res://.godot/imported/sky.png-b132b9e240387925c40cca10d1d14c56.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/environment/backgrounds/sky.png"
dest_files=["res://.godot/imported/sky.png-b132b9e240387925c40cca10d1d14c56.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bfrdit16wfh65"
path="res://.godot/imported/mushroom_32x64.png-cefb137d64a82ca31a8f0068d916c09f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/environment/terrain/mushroom_32x64.png"
dest_files=["res://.godot/imported/mushroom_32x64.png-cefb137d64a82ca31a8f0068d916c09f.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbtwjiqoh4hov"
path="res://.godot/imported/veg_32x32.png-4b0b47ef99f3aa28e8f24956e44a31a5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/environment/terrain/veg_32x32.png"
dest_files=["res://.godot/imported/veg_32x32.png-4b0b47ef99f3aa28e8f24956e44a31a5.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dkeuhhrqbo1yg"
path="res://.godot/imported/bullet.png-5f5987acb2654c0a77d476af07009ff9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/objects/bullet.png"
dest_files=["res://.godot/imported/bullet.png-5f5987acb2654c0a77d476af07009ff9.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dsbx56twsvxsi"
path="res://.godot/imported/coin.png-2d6c2b0aa08ee4f85631b6030f7eff1b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/objects/coin.png"
dest_files=["res://.godot/imported/coin.png-2d6c2b0aa08ee4f85631b6030f7eff1b.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c3iluf42c2v3r"
path="res://.godot/imported/crate.png-b286bd97caa3cbc59746f2db7de46191.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/objects/crate.png"
dest_files=["res://.godot/imported/crate.png-b286bd97caa3cbc59746f2db7de46191.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

View File

@ -15,6 +15,14 @@ run/main_scene="uid://dk3bbsqf7yi08"
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=320
window/size/viewport_height=180
window/size/window_width_override=960
window/size/window_height_override=540
window/stretch/mode="viewport"
[input]
shove={
@ -27,3 +35,19 @@ shoot={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(92, 19),"global_position":Vector2(101, 67),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
move_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
jump={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://dmhto2dvjub1j"]
[gd_scene load_steps=4 format=3 uid="uid://dmhto2dvjub1j"]
[ext_resource type="Script" uid="uid://do4exob6g0cfd" path="res://scripts/bullet.gd" id="1_mkf8s"]
[ext_resource type="Texture2D" uid="uid://dkeuhhrqbo1yg" path="res://assets/graphics/objects/bullet.png" id="2_y25gk"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_h1aey"]
radius = 1.99136
@ -13,5 +14,12 @@ script = ExtResource("1_mkf8s")
rotation = 1.57936
shape = SubResource("CapsuleShape2D_h1aey")
[node name="BulletGraphic" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(-3, -3)
rotation = 3.14159
scale = Vector2(0.1, 0.1)
texture = ExtResource("2_y25gk")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="bulletHitSignal" from="." to="." method="_on_bullet_hit_signal"]

114
scenes/coin.tscn Normal file
View File

@ -0,0 +1,114 @@
[gd_scene load_steps=17 format=3 uid="uid://br6up8ears5fo"]
[ext_resource type="Script" uid="uid://t0jdd3a3km2a" path="res://scripts/coin.gd" id="1_i64fm"]
[ext_resource type="Texture2D" uid="uid://dsbx56twsvxsi" path="res://assets/graphics/objects/coin.png" id="1_rwqht"]
[sub_resource type="AtlasTexture" id="AtlasTexture_i64fm"]
atlas = ExtResource("1_rwqht")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_11l1o"]
atlas = ExtResource("1_rwqht")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_d14el"]
atlas = ExtResource("1_rwqht")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_1ikuy"]
atlas = ExtResource("1_rwqht")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_wnlwo"]
atlas = ExtResource("1_rwqht")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_jig8b"]
atlas = ExtResource("1_rwqht")
region = Rect2(80, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_xmuha"]
atlas = ExtResource("1_rwqht")
region = Rect2(96, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_kfxoj"]
atlas = ExtResource("1_rwqht")
region = Rect2(112, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_jsmju"]
atlas = ExtResource("1_rwqht")
region = Rect2(128, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_s0mny"]
atlas = ExtResource("1_rwqht")
region = Rect2(144, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_7cc30"]
atlas = ExtResource("1_rwqht")
region = Rect2(160, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_rojmm"]
atlas = ExtResource("1_rwqht")
region = Rect2(176, 0, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_ls27i"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i64fm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_11l1o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d14el")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1ikuy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wnlwo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jig8b")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xmuha")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kfxoj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jsmju")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_s0mny")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7cc30")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rojmm")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_ssuvv"]
[node name="coin" type="Area2D"]
script = ExtResource("1_i64fm")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_ls27i")
animation = &"idle"
autoplay = "idle"
frame_progress = 0.956959
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(0.463033, 0.565531)
shape = SubResource("CircleShape2D_ssuvv")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -1,14 +1,18 @@
[gd_scene load_steps=3 format=3 uid="uid://by6fag0gnv0r4"]
[gd_scene load_steps=4 format=3 uid="uid://by6fag0gnv0r4"]
[ext_resource type="Script" uid="uid://boay68qas1gpa" path="res://scripts/crate.gd" id="1_b66cd"]
[ext_resource type="Texture2D" uid="uid://c3iluf42c2v3r" path="res://assets/graphics/objects/crate.png" id="2_dwt0d"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"]
[node name="crate" type="RigidBody2D" groups=["shootable", "shovable"]]
rotation = -0.698132
script = ExtResource("1_b66cd")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_uwrxv")
debug_color = Color(0.841123, 0.368839, 0.275526, 0.42)
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.1, 0.1)
texture = ExtResource("2_dwt0d")

View File

@ -1,66 +1,409 @@
[gd_scene load_steps=11 format=3 uid="uid://dk3bbsqf7yi08"]
[gd_scene load_steps=19 format=4 uid="uid://dk3bbsqf7yi08"]
[ext_resource type="Script" uid="uid://c3o8iur48idhr" path="res://scripts/gamecontroller.gd" id="1_lnu2h"]
[ext_resource type="Script" uid="uid://vi7u52xttkpb" path="res://scripts/scene_manager.gd" id="2_iywne"]
[ext_resource type="PackedScene" uid="uid://by6fag0gnv0r4" path="res://scenes/crate.tscn" id="2_lbhrr"]
[ext_resource type="PackedScene" uid="uid://d4db6ttyltd56" path="res://scenes/player.tscn" id="2_lnu2h"]
[ext_resource type="PackedScene" uid="uid://e5y4obsl2kcv" path="res://scenes/trigger.tscn" id="2_yqjtg"]
[ext_resource type="Texture2D" uid="uid://26bbv4ejahja" path="res://assets/graphics/environment/backgrounds/sky.png" id="3_0tnpc"]
[ext_resource type="Texture2D" uid="uid://bior2r1hv1q0s" path="res://assets/graphics/environment/terrain/terrain_32x32.png" id="3_p57ef"]
[ext_resource type="Texture2D" uid="uid://bbtwjiqoh4hov" path="res://assets/graphics/environment/terrain/veg_32x32.png" id="4_gee14"]
[ext_resource type="Texture2D" uid="uid://buxc3k748d7qn" path="res://assets/graphics/environment/backgrounds/forestbackground.png" id="4_vtaks"]
[ext_resource type="Texture2D" uid="uid://bfrdit16wfh65" path="res://assets/graphics/environment/terrain/mushroom_32x64.png" id="5_0tnpc"]
[ext_resource type="Texture2D" uid="uid://bikjxvjmfsqyy" path="res://assets/graphics/environment/backgrounds/midground.png" id="5_kvpfn"]
[ext_resource type="PackedScene" uid="uid://br6up8ears5fo" path="res://scenes/coin.tscn" id="11_dinhu"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u5sy4"]
texture = ExtResource("3_p57ef")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/terrain = 0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -14.7212, 16, -14.8227, 16, 0.710678, -0.55839, 0.913729, -0.862967, 16, -16, 16)
0:0/0/terrains_peering_bit/right_side = 0
0:0/0/terrains_peering_bit/bottom_right_corner = 0
0:0/0/terrains_peering_bit/bottom_side = 0
1:0/0 = 0
1:0/0/terrain_set = 0
1:0/0/terrain = 0
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -5.68543, -16, -5.1778)
1:0/0/terrains_peering_bit/right_side = 0
1:0/0/terrains_peering_bit/bottom_right_corner = 0
1:0/0/terrains_peering_bit/bottom_side = 0
1:0/0/terrains_peering_bit/bottom_left_corner = 0
1:0/0/terrains_peering_bit/left_side = 0
2:0/0 = 0
2:0/0/terrain_set = 0
2:0/0/terrain = 0
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 2.48738, 16, 2.28432, -1.31983, -16, -1.52288)
2:0/0/terrains_peering_bit/bottom_side = 0
2:0/0/terrains_peering_bit/bottom_left_corner = 0
2:0/0/terrains_peering_bit/left_side = 0
4:0/0 = 0
4:0/0/terrain_set = 0
4:0/0/terrain = 0
4:0/0/terrains_peering_bit/bottom_side = 0
6:0/0 = 0
6:0/0/terrain_set = 0
6:0/0/terrain = 0
6:0/0/terrains_peering_bit/right_side = 0
6:0/0/terrains_peering_bit/bottom_side = 0
6:0/0/terrains_peering_bit/bottom_left_corner = 0
6:0/0/terrains_peering_bit/left_side = 0
6:0/0/terrains_peering_bit/top_left_corner = 0
6:0/0/terrains_peering_bit/top_side = 0
6:0/0/terrains_peering_bit/top_right_corner = 0
7:0/0 = 0
7:0/0/terrain_set = 0
7:0/0/terrain = 0
7:0/0/terrains_peering_bit/right_side = 0
7:0/0/terrains_peering_bit/bottom_right_corner = 0
7:0/0/terrains_peering_bit/bottom_side = 0
7:0/0/terrains_peering_bit/left_side = 0
7:0/0/terrains_peering_bit/top_left_corner = 0
7:0/0/terrains_peering_bit/top_side = 0
7:0/0/terrains_peering_bit/top_right_corner = 0
9:0/0 = 0
9:0/0/terrain_set = 0
9:0/0/terrain = 0
9:0/0/terrains_peering_bit/right_side = 0
9:0/0/terrains_peering_bit/bottom_right_corner = 0
9:0/0/terrains_peering_bit/bottom_side = 0
9:0/0/terrains_peering_bit/bottom_left_corner = 0
9:0/0/terrains_peering_bit/left_side = 0
9:0/0/terrains_peering_bit/top_side = 0
10:0/0 = 0
10:0/0/terrain_set = 0
10:0/0/terrain = 0
10:0/0/terrains_peering_bit/right_side = 0
10:0/0/terrains_peering_bit/bottom_side = 0
10:0/0/terrains_peering_bit/bottom_left_corner = 0
10:0/0/terrains_peering_bit/left_side = 0
10:0/0/terrains_peering_bit/top_left_corner = 0
10:0/0/terrains_peering_bit/top_side = 0
12:0/0 = 0
12:0/0/terrain_set = 0
12:0/0/terrain = 0
12:0/0/terrains_peering_bit/right_side = 0
12:0/0/terrains_peering_bit/bottom_right_corner = 0
12:0/0/terrains_peering_bit/bottom_side = 0
12:0/0/terrains_peering_bit/top_side = 0
13:0/0 = 0
13:0/0/terrain_set = 0
13:0/0/terrain = 0
13:0/0/terrains_peering_bit/right_side = 0
13:0/0/terrains_peering_bit/bottom_side = 0
13:0/0/terrains_peering_bit/bottom_left_corner = 0
13:0/0/terrains_peering_bit/left_side = 0
13:0/0/terrains_peering_bit/top_side = 0
15:0/0 = 0
15:0/0/terrain_set = 0
15:0/0/terrain = 0
15:0/0/terrains_peering_bit/right_side = 0
15:0/0/terrains_peering_bit/bottom_side = 0
15:0/0/terrains_peering_bit/top_side = 0
0:1/0 = 0
0:1/0/terrain_set = 0
0:1/0/terrain = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -0.0507622, -16, -0.355339, 16, -16, 16)
0:1/0/terrains_peering_bit/right_side = 0
0:1/0/terrains_peering_bit/bottom_right_corner = 0
0:1/0/terrains_peering_bit/bottom_side = 0
0:1/0/terrains_peering_bit/top_side = 0
0:1/0/terrains_peering_bit/top_right_corner = 0
1:1/0 = 0
1:1/0/terrain_set = 0
1:1/0/terrain = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
1:1/0/terrains_peering_bit/right_side = 0
1:1/0/terrains_peering_bit/bottom_right_corner = 0
1:1/0/terrains_peering_bit/bottom_side = 0
1:1/0/terrains_peering_bit/bottom_left_corner = 0
1:1/0/terrains_peering_bit/left_side = 0
1:1/0/terrains_peering_bit/top_left_corner = 0
1:1/0/terrains_peering_bit/top_side = 0
1:1/0/terrains_peering_bit/top_right_corner = 0
2:1/0 = 0
2:1/0/terrain_set = 0
2:1/0/terrain = 0
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 0.0507622, -16, 0.355339, 16, 16, 16)
2:1/0/terrains_peering_bit/bottom_side = 0
2:1/0/terrains_peering_bit/bottom_left_corner = 0
2:1/0/terrains_peering_bit/left_side = 0
2:1/0/terrains_peering_bit/top_left_corner = 0
2:1/0/terrains_peering_bit/top_side = 0
4:1/0 = 0
4:1/0/terrain_set = 0
4:1/0/terrain = 0
4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
4:1/0/terrains_peering_bit/bottom_side = 0
4:1/0/terrains_peering_bit/top_side = 0
6:1/0 = 0
6:1/0/terrain_set = 0
6:1/0/terrain = 0
6:1/0/terrains_peering_bit/right_side = 0
6:1/0/terrains_peering_bit/bottom_right_corner = 0
6:1/0/terrains_peering_bit/bottom_side = 0
6:1/0/terrains_peering_bit/bottom_left_corner = 0
6:1/0/terrains_peering_bit/left_side = 0
6:1/0/terrains_peering_bit/top_left_corner = 0
6:1/0/terrains_peering_bit/top_side = 0
7:1/0 = 0
7:1/0/terrain_set = 0
7:1/0/terrain = 0
7:1/0/terrains_peering_bit/right_side = 0
7:1/0/terrains_peering_bit/bottom_right_corner = 0
7:1/0/terrains_peering_bit/bottom_side = 0
7:1/0/terrains_peering_bit/bottom_left_corner = 0
7:1/0/terrains_peering_bit/left_side = 0
7:1/0/terrains_peering_bit/top_side = 0
7:1/0/terrains_peering_bit/top_right_corner = 0
9:1/0 = 0
9:1/0/terrain_set = 0
9:1/0/terrain = 0
9:1/0/terrains_peering_bit/right_side = 0
9:1/0/terrains_peering_bit/bottom_right_corner = 0
9:1/0/terrains_peering_bit/bottom_side = 0
9:1/0/terrains_peering_bit/top_side = 0
9:1/0/terrains_peering_bit/top_right_corner = 0
10:1/0 = 0
10:1/0/terrain_set = 0
10:1/0/terrain = 0
10:1/0/terrains_peering_bit/right_side = 0
10:1/0/terrains_peering_bit/bottom_side = 0
10:1/0/terrains_peering_bit/left_side = 0
10:1/0/terrains_peering_bit/top_left_corner = 0
10:1/0/terrains_peering_bit/top_side = 0
10:1/0/terrains_peering_bit/top_right_corner = 0
12:1/0 = 0
12:1/0/terrain_set = 0
12:1/0/terrain = 0
12:1/0/terrains_peering_bit/right_side = 0
12:1/0/terrains_peering_bit/bottom_side = 0
12:1/0/terrains_peering_bit/left_side = 0
12:1/0/terrains_peering_bit/top_side = 0
12:1/0/terrains_peering_bit/top_right_corner = 0
13:1/0 = 0
13:1/0/terrain_set = 0
13:1/0/terrain = 0
13:1/0/terrains_peering_bit/right_side = 0
13:1/0/terrains_peering_bit/bottom_side = 0
13:1/0/terrains_peering_bit/left_side = 0
13:1/0/terrains_peering_bit/top_left_corner = 0
13:1/0/terrains_peering_bit/top_side = 0
15:1/0 = 0
15:1/0/terrain_set = 0
15:1/0/terrain = 0
15:1/0/terrains_peering_bit/right_side = 0
15:1/0/terrains_peering_bit/bottom_side = 0
15:1/0/terrains_peering_bit/bottom_left_corner = 0
15:1/0/terrains_peering_bit/left_side = 0
15:1/0/terrains_peering_bit/top_side = 0
15:1/0/terrains_peering_bit/top_right_corner = 0
16:1/0 = 0
16:1/0/terrain_set = 0
16:1/0/terrain = 0
16:1/0/terrains_peering_bit/right_side = 0
16:1/0/terrains_peering_bit/bottom_right_corner = 0
16:1/0/terrains_peering_bit/bottom_side = 0
16:1/0/terrains_peering_bit/left_side = 0
16:1/0/terrains_peering_bit/top_left_corner = 0
16:1/0/terrains_peering_bit/top_side = 0
0:2/0 = 0
0:2/0/terrain_set = 0
0:2/0/terrain = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, -16, -16, -16, 8.42662, -10.8125, 16, 16, 16)
0:2/0/terrains_peering_bit/right_side = 0
0:2/0/terrains_peering_bit/top_side = 0
0:2/0/terrains_peering_bit/top_right_corner = 0
1:2/0 = 0
1:2/0/terrain_set = 0
1:2/0/terrain = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 0.203051, 16, -0.304577, 16, 16, -16, 16)
1:2/0/terrains_peering_bit/right_side = 0
1:2/0/terrains_peering_bit/left_side = 0
1:2/0/terrains_peering_bit/top_left_corner = 0
1:2/0/terrains_peering_bit/top_side = 0
1:2/0/terrains_peering_bit/top_right_corner = 0
2:2/0 = 0
2:2/0/terrain_set = 0
2:2/0/terrain = 0
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 8.42662, 10.8125, 16, -16, 16)
2:2/0/terrains_peering_bit/left_side = 0
2:2/0/terrains_peering_bit/top_left_corner = 0
2:2/0/terrains_peering_bit/top_side = 0
4:2/0 = 0
4:2/0/terrain_set = 0
4:2/0/terrain = 0
4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, -16, -16, -16, 8.42662, -10.8125, 16, 7.66518, 16, 16, 8.52814)
4:2/0/terrains_peering_bit/top_side = 0
6:3/0 = 0
6:3/0/terrain_set = 0
6:3/0/terrain = 0
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -0.0507622, -16, -0.355339, 16, -16, 16)
6:3/0/terrains_peering_bit/right_side = 0
6:3/0/terrains_peering_bit/bottom_side = 0
6:3/0/terrains_peering_bit/top_side = 0
6:3/0/terrains_peering_bit/top_right_corner = 0
7:3/0 = 0
7:3/0/terrain_set = 0
7:3/0/terrain = 0
7:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 0.0507622, -16, 0.355339, 16, 16, 16)
7:3/0/terrains_peering_bit/bottom_side = 0
7:3/0/terrains_peering_bit/left_side = 0
7:3/0/terrains_peering_bit/top_left_corner = 0
7:3/0/terrains_peering_bit/top_side = 0
9:3/0 = 0
9:3/0/terrain_set = 0
9:3/0/terrain = 0
9:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -5.68543, -16, -5.1778)
9:3/0/terrains_peering_bit/right_side = 0
9:3/0/terrains_peering_bit/bottom_side = 0
9:3/0/terrains_peering_bit/bottom_left_corner = 0
9:3/0/terrains_peering_bit/left_side = 0
10:3/0 = 0
10:3/0/terrain_set = 0
10:3/0/terrain = 0
10:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -5.68543, -16, -5.1778)
10:3/0/terrains_peering_bit/right_side = 0
10:3/0/terrains_peering_bit/bottom_right_corner = 0
10:3/0/terrains_peering_bit/bottom_side = 0
10:3/0/terrains_peering_bit/left_side = 0
12:3/0 = 0
12:3/0/terrain_set = 0
12:3/0/terrain = 0
12:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -0.0507622, -16, -0.355339, 16, -16, 16)
12:3/0/terrains_peering_bit/right_side = 0
12:3/0/terrains_peering_bit/bottom_side = 0
12:3/0/terrains_peering_bit/top_side = 0
13:3/0 = 0
13:3/0/terrain_set = 0
13:3/0/terrain = 0
13:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -5.68543, -16, -5.1778)
13:3/0/terrains_peering_bit/right_side = 0
13:3/0/terrains_peering_bit/bottom_side = 0
13:3/0/terrains_peering_bit/left_side = 0
15:3/0 = 0
15:3/0/terrain_set = 0
15:3/0/terrain = 0
15:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -14.7212, 16, -14.8227, 16, 0.710678, -0.55839, 0.913729, -0.862967, 16, -16, 16)
15:3/0/terrains_peering_bit/right_side = 0
15:3/0/terrains_peering_bit/bottom_side = 0
16:3/0 = 0
16:3/0/terrain_set = 0
16:3/0/terrain = 0
16:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 2.48738, 16, 2.28432, -1.31983, -16, -1.52288)
16:3/0/terrains_peering_bit/bottom_side = 0
16:3/0/terrains_peering_bit/left_side = 0
0:4/0 = 0
0:4/0/terrain_set = 0
0:4/0/terrain = 0
0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -6.9545, 16, -16, 7.30984)
0:4/0/terrains_peering_bit/right_side = 0
1:4/0 = 0
1:4/0/terrain_set = 0
1:4/0/terrain = 0
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
1:4/0/terrains_peering_bit/right_side = 0
1:4/0/terrains_peering_bit/left_side = 0
2:4/0 = 0
2:4/0/terrain_set = 0
2:4/0/terrain = 0
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 8.83272, 8.88348, 16, -16, 16)
2:4/0/terrains_peering_bit/left_side = 0
4:4/0 = 0
4:4/0/terrain_set = 0
4:4/0/terrain = 0
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 10.051, 9.89874, 16, -8.47738, 16, -16, 6.09153)
6:4/0 = 0
6:4/0/terrain_set = 0
6:4/0/terrain = 0
6:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -0.0507622, -16, -0.355339, 16, -16, 16)
6:4/0/terrains_peering_bit/right_side = 0
6:4/0/terrains_peering_bit/bottom_right_corner = 0
6:4/0/terrains_peering_bit/bottom_side = 0
6:4/0/terrains_peering_bit/top_side = 0
7:4/0 = 0
7:4/0/terrain_set = 0
7:4/0/terrain = 0
7:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 0.0507622, -16, 0.355339, 16, 16, 16)
7:4/0/terrains_peering_bit/bottom_side = 0
7:4/0/terrains_peering_bit/bottom_left_corner = 0
7:4/0/terrains_peering_bit/left_side = 0
7:4/0/terrains_peering_bit/top_side = 0
9:4/0 = 0
9:4/0/terrain_set = 0
9:4/0/terrain = 0
9:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, 16, 16, 0.0507622, -16, 0.355339, -16, 16)
9:4/0/terrains_peering_bit/right_side = 0
9:4/0/terrains_peering_bit/left_side = 0
9:4/0/terrains_peering_bit/top_left_corner = 0
9:4/0/terrains_peering_bit/top_side = 0
10:4/0 = 0
10:4/0/terrain_set = 0
10:4/0/terrain = 0
10:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, 16, 16, 0.0507622, -16, 0.355339, -16, 16)
10:4/0/terrains_peering_bit/right_side = 0
10:4/0/terrains_peering_bit/left_side = 0
10:4/0/terrains_peering_bit/top_side = 0
10:4/0/terrains_peering_bit/top_right_corner = 0
12:4/0 = 0
12:4/0/terrain_set = 0
12:4/0/terrain = 0
12:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, 16, 16, 0.0507622, -16, 0.355339, -16, 16)
12:4/0/terrains_peering_bit/right_side = 0
12:4/0/terrains_peering_bit/left_side = 0
12:4/0/terrains_peering_bit/top_side = 0
13:4/0 = 0
13:4/0/terrain_set = 0
13:4/0/terrain = 0
13:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 0.0507622, -16, 0.355339, 16, 16, 16)
13:4/0/terrains_peering_bit/bottom_side = 0
13:4/0/terrains_peering_bit/left_side = 0
13:4/0/terrains_peering_bit/top_side = 0
15:4/0 = 0
15:4/0/terrain_set = 0
15:4/0/terrain = 0
15:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, -16, -16, -16, 8.42662, -10.8125, 16, 16, 16)
15:4/0/terrains_peering_bit/right_side = 0
15:4/0/terrains_peering_bit/top_side = 0
16:4/0 = 0
16:4/0/terrain_set = 0
16:4/0/terrain = 0
16:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 8.42662, 10.8125, 16, -16, 16)
16:4/0/terrains_peering_bit/left_side = 0
16:4/0/terrains_peering_bit/top_side = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vtaks"]
texture = ExtResource("4_gee14")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/terrain = 1
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_kvpfn"]
texture = ExtResource("5_0tnpc")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/terrain = 1
0:0/0/terrains_peering_bit/bottom_side = 1
0:1/0 = 0
0:1/0/terrain_set = 0
0:1/0/terrain = 1
0:1/0/terrains_peering_bit/top_side = 1
[sub_resource type="TileSet" id="TileSet_gee14"]
tile_size = Vector2i(32, 32)
physics_layer_0/collision_layer = 1
terrain_set_0/mode = 0
terrain_set_0/terrain_0/name = "leafydirt"
terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1)
terrain_set_0/terrain_1/name = "vegetation"
terrain_set_0/terrain_1/color = Color(0.5, 0.4375, 0.25, 1)
sources/0 = SubResource("TileSetAtlasSource_u5sy4")
sources/1 = SubResource("TileSetAtlasSource_vtaks")
sources/2 = SubResource("TileSetAtlasSource_kvpfn")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"]
size = Vector2(144, 20)
@ -74,14 +417,41 @@ script = ExtResource("1_lnu2h")
unique_name_in_owner = true
script = ExtResource("2_iywne")
[node name="skylayer" type="Parallax2D" parent="."]
repeat_size = Vector2(320, 180)
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="skylayer"]
position = Vector2(160, 90)
texture = ExtResource("3_0tnpc")
[node name="farlayer" type="Parallax2D" parent="."]
texture_filter = 1
scroll_scale = Vector2(1.2, 1)
repeat_size = Vector2(320, 0)
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="farlayer"]
position = Vector2(160, 100)
texture = ExtResource("4_vtaks")
[node name="midground" type="Parallax2D" parent="."]
scroll_scale = Vector2(1.4, 1)
repeat_size = Vector2(160, 0)
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="midground"]
position = Vector2(160, 160)
texture = ExtResource("5_kvpfn")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
texture_filter = 1
position = Vector2(0, 8)
tile_map_data = PackedByteArray(0, 0, 13, 0, 10, 0, 0, 0, 4, 0, 4, 0, 0, 0, 14, 0, 10, 0, 0, 0, 4, 0, 4, 0, 0, 0, 15, 0, 10, 0, 0, 0, 4, 0, 4, 0, 0, 0, 16, 0, 10, 0, 0, 0, 4, 0, 4, 0, 0, 0, 17, 0, 10, 0, 0, 0, 4, 0, 4, 0, 0, 0)
position = Vector2(30, 31)
tile_map_data = PackedByteArray("AAAKAAkAAAABAAQAAAALAAkAAAABAAQAAAAMAAkAAAABAAQAAAANAAkAAAABAAQAAAAOAAkAAAABAAQAAAAPAAkAAAABAAQAAAAQAAkAAAABAAQAAAARAAkAAAABAAQAAAASAAkAAAABAAQAAAATAAkAAAABAAQAAAAUAAkAAAAQAAMAAAAUAAoAAAAPAAQAAAAVAAoAAAAQAAMAAAAVAAsAAAAEAAEAAAAVAAwAAAAPAAQAAAAWAAwAAAABAAQAAAAXAAwAAAABAAQAAAAYAAwAAAABAAQAAAAZAAwAAAABAAQAAAAaAAwAAAABAAQAAAAbAAwAAAABAAQAAAAcAAsAAAAPAAMAAAAdAAsAAAAQAAQAAAAdAAoAAAAPAAMAAAAeAAoAAAABAAQAAAAfAAoAAAAQAAQAAAAfAAkAAAAPAAMAAAAgAAkAAAAQAAQAAAAgAAgAAAAPAAMAAAAcAAwAAAAQAAQAAAAhAAgAAAABAAQAAAAiAAgAAAABAAQAAAAjAAgAAAABAAQAAAAkAAgAAAAQAAQAAAAeAAYAAAACAAQAAAAdAAYAAAABAAQAAAAcAAYAAAABAAQAAAAbAAYAAAABAAQAAAAaAAYAAAAAAAQAAAAZAAsAAQAAAAAAAAAdAAkAAQAAAAAAAAAcAAUAAQAAAAAAAAAhAAcAAQAAAAAAAAAOAAgAAQAAAAAAAAAPAAgAAQAAAAAAAAAQAAgAAQAAAAAAAAAVAAkAAQAAAAAAAAAXAAsAAgAAAAEAAAAXAAoAAgAAAAAAAAAaAAsAAQAAAAAAAAAYAAsAAgAAAAEAAAAYAAoAAgAAAAAAAAAdAAUAAgAAAAEAAAAdAAQAAgAAAAAAAAATAAgAAgAAAAEAAAATAAcAAgAAAAAAAAARAAgAAQAAAAAAAAANAAgAAgAAAAEAAAANAAcAAgAAAAAAAAAkAAcAAAAEAAEAAAAkAAYAAAAEAAEAAAAkAAUAAAAEAAEAAAAkAAQAAAAEAAEAAAAkAAMAAAAEAAEAAAAkAAIAAAAEAAEAAAAkAAEAAAAEAAEAAAAkAAAAAAAEAAAAAAAJAAkAAAABAAQAAAAIAAkAAAABAAQAAAAHAAkAAAABAAQAAAAGAAkAAAABAAQAAAAEAAkAAAABAAQAAAAFAAkAAAABAAQAAAADAAkAAAABAAQAAAACAAkAAAABAAQAAAABAAkAAAABAAQAAAAAAAkAAAABAAQAAAD//wkAAAAPAAQAAAD//wgAAAAEAAEAAAD//wcAAAAEAAEAAAD//wYAAAAEAAEAAAD//wUAAAAEAAEAAAD//wQAAAAEAAEAAAD//wMAAAAPAAMAAAAAAAMAAAAQAAQAAAAAAAIAAAAEAAEAAAAAAAEAAAAEAAEAAAAAAAAAAAAEAAAAAAADAAYAAAAAAAQAAAAEAAYAAAABAAQAAAAFAAYAAAACAAQAAAAIAAUAAAAAAAQAAAAJAAUAAAABAAQAAAAKAAUAAAACAAQAAAALAAYAAAAAAAQAAAAMAAYAAAABAAQAAAANAAYAAAABAAQAAAAOAAYAAAACAAQAAAA=")
tile_set = SubResource("TileSet_gee14")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
position = Vector2(496, 345)
position = Vector2(593, 539)
scale = Vector2(1.07507, 1.58955)
metadata/_edit_group_ = true
@ -102,7 +472,7 @@ metadata/_edit_group_ = true
shape = SubResource("WorldBoundaryShape2D_8cj0n")
[node name="player" parent="." instance=ExtResource("2_lnu2h")]
position = Vector2(478, 301)
position = Vector2(476, 279)
[node name="triggers" type="Node2D" parent="."]
@ -110,4 +480,21 @@ position = Vector2(478, 301)
position = Vector2(493, 422)
effect = "player_hurt"
[node name="coins" type="Node2D" parent="."]
[node name="coin" parent="coins" instance=ExtResource("11_dinhu")]
position = Vector2(426, 215)
[node name="coin5" parent="coins" instance=ExtResource("11_dinhu")]
position = Vector2(180, 211)
[node name="coin2" parent="coins" instance=ExtResource("11_dinhu")]
position = Vector2(577, 299)
[node name="coin3" parent="coins" instance=ExtResource("11_dinhu")]
position = Vector2(902, 211)
[node name="coin4" parent="coins" instance=ExtResource("11_dinhu")]
position = Vector2(1040, 308)
[connection signal="areaTriggerSignal" from="triggers/playerHurt" to="." method="_on_trigger"]

View File

@ -242,4 +242,7 @@ sprite_frames = SubResource("SpriteFrames_jej6c")
animation = &"damage"
autoplay = "idle"
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(0, -40)
[connection signal="animation_finished" from="PlayerGraphic" to="." method="_on_animation_finished"]

View File

@ -2,10 +2,16 @@ class_name Bullet extends Area2D
signal bulletHitSignal(body, bullet)
@onready var bullet_graphic: Sprite2D = $BulletGraphic
var SPEED: float = 700.0
func setSpeed(new_speed: float):
SPEED = new_speed
if new_speed < 0:
bullet_graphic.flip_h = true
if new_speed > 0:
bullet_graphic.flip_h = false
func _physics_process(delta: float) -> void:
position += transform.x * SPEED * delta

6
scripts/coin.gd Normal file
View File

@ -0,0 +1,6 @@
class_name Coin extends Area2D
signal coinCollectedSignal(body, coin)
func _on_body_entered(body: Node2D) -> void:
coinCollectedSignal.emit(body, self)

1
scripts/coin.gd.uid Normal file
View File

@ -0,0 +1 @@
uid://t0jdd3a3km2a

View File

@ -4,6 +4,8 @@ extends Node2D
signal playerDamage
var score := 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@ -24,3 +26,8 @@ func _on_trigger(effect: Variant, body: Variant) -> void:
func onBulletHitSignal(body: Node, bullet: Bullet):
body.queue_free()
func onCoinCollected(body, coin: Coin):
if body is Player:
score += 1
coin.queue_free()

View File

@ -94,12 +94,12 @@ func handle_movement(delta: float):
func handle_input():
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
if Input.is_action_just_pressed("jump") and is_on_floor():
jump_buffer.start()
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
direction = Input.get_axis("ui_left", "ui_right")
direction = Input.get_axis("move_left", "move_right")
if direction > 0:
facing = FaceDirection.RIGHT

View File

@ -5,25 +5,36 @@ const bullet_scene = preload("res://scenes/bullet.tscn")
@onready var game: Node2D = $".."
@onready var triggers: Node2D = $"../triggers"
@onready var coins: Node2D = $"../coins"
var MAX_BULLET := 50
var available_bullets = []
var score := 0
func _ready() -> void:
for i in range(MAX_BULLET):
var new_bullet = bullet_scene.instantiate()
new_bullet.bulletHitSignal.connect(game.onBulletHitSignal)
print(new_bullet.bullet_graphic)
available_bullets.push_front(new_bullet)
if triggers:
for trig in triggers.get_children():
if trig is Trigger:
trig.areaTriggerSignal.connect(game._on_trigger)
if coins:
for coin in coins.get_children():
if coin is Coin:
coin.coinCollectedSignal.connect(game.onCoinCollected)
func make_bullet(start_position: Transform2D, speed: int):
var new_bullet = bullet_factory(start_position, speed)
if new_bullet:
owner.add_child(new_bullet)
new_bullet.setSpeed(speed)
func reload_bullet(bullet: Bullet):
available_bullets.push(bullet)
@ -31,7 +42,6 @@ func reload_bullet(bullet: Bullet):
func bullet_factory(start_position: Transform2D, speed: int) -> Bullet:
var shot_bullet = available_bullets.pop_back()
shot_bullet.global_transform = start_position
shot_bullet.setSpeed(speed)
available_bullets.push_front(shot_bullet)