Added graphics animations, tilesets and tilemaps with physics layer, and player state machine.

This commit is contained in:
anthonyrusso 2026-07-06 20:58:50 -04:00
parent 458b3e25fc
commit f916237426
21 changed files with 1000 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpxe38xaahgyt"
path="res://.godot/imported/crate.png-3c788bb24b8188e6f11d4ace2d9118d8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/destructibles/crate.png"
dest_files=["res://.godot/imported/crate.png-3c788bb24b8188e6f11d4ace2d9118d8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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: 12 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bn4xd3wns5tfb"
path="res://.godot/imported/Terrain (32x32).png-7c65717e98f50801dcb0b6e4b7ea2dbc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/environment/Terrain (32x32).png"
dest_files=["res://.godot/imported/Terrain (32x32).png-7c65717e98f50801dcb0b6e4b7ea2dbc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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.2 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cbyg0w7shutqp"
path="res://.godot/imported/Player Punch 64x64.png-e81d95f7286a1f82c2b84ff5ac90cdcb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/player/charging/Player Punch 64x64.png"
dest_files=["res://.godot/imported/Player Punch 64x64.png-e81d95f7286a1f82c2b84ff5ac90cdcb.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://drblapyhrti2g"
path="res://.godot/imported/Player Idle 48x48.png-f4dc4a776c51960ade42b56516ebdf44.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/player/idle/Player Idle 48x48.png"
dest_files=["res://.godot/imported/Player Idle 48x48.png-f4dc4a776c51960ade42b56516ebdf44.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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: 1021 B

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bth27gwckesmw"
path="res://.godot/imported/player jump 48x48.png-76072e8defb6fa3b97cc972a34149281.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/player/jump_fall/player jump 48x48.png"
dest_files=["res://.godot/imported/player jump 48x48.png-76072e8defb6fa3b97cc972a34149281.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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.1 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dawy2436kryh5"
path="res://.godot/imported/player run 48x48.png-88a3d854902c0e89fc61b644954350dd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/player/run/player run 48x48.png"
dest_files=["res://.godot/imported/player run 48x48.png-88a3d854902c0e89fc61b644954350dd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://blnvrtl2me0c3"
path="res://.godot/imported/pixel_bullet.png-20ba33e0a261e4601930c0fd8abb422a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/projectiles/pixel_bullet.png"
dest_files=["res://.godot/imported/pixel_bullet.png-20ba33e0a261e4601930c0fd8abb422a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://vdkcnj4ebu6r"]
[ext_resource type="Script" uid="uid://dcqok1j5pliwd" path="res://scripts/bullet.gd" id="1_mkf8s"]
[ext_resource type="Texture2D" uid="uid://blnvrtl2me0c3" path="res://assets/projectiles/pixel_bullet.png" id="2_y25gk"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_h1aey"]
size = Vector2(10, 4)
@ -12,4 +13,11 @@ script = ExtResource("1_mkf8s")
shape = SubResource("RectangleShape2D_h1aey")
debug_color = Color(0.7560967, 0, 0.13750124, 0.41960785)
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=905758464]
texture_filter = 1
position = Vector2(-3, -2)
rotation = 3.1415927
scale = Vector2(0.079999864, 0.079999864)
texture = ExtResource("2_y25gk")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -1,14 +1,19 @@
[gd_scene format=3 uid="uid://b2rjhbe4f20hw"]
[ext_resource type="Script" uid="uid://uqo7d6vtae3w" path="res://scripts/crate.gd" id="1_b66cd"]
[ext_resource type="Texture2D" uid="uid://cpxe38xaahgyt" path="res://assets/destructibles/crate.png" id="2_dwt0d"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"]
[node name="Crate" type="RigidBody2D" unique_id=1451413033 groups=["shootable"]]
rotation = 0.7475211
script = ExtResource("1_b66cd")
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=112433967]
position = Vector2(0, 2)
scale = Vector2(0.07, 0.07)
texture = ExtResource("2_dwt0d")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=913096501]
shape = SubResource("RectangleShape2D_uwrxv")
debug_color = Color(0.80930483, 0.41273475, 0.03331322, 0.41960785)

View File

@ -1,11 +1,397 @@
[gd_scene format=3 uid="uid://cu1mgc6337asm"]
[gd_scene format=4 uid="uid://cu1mgc6337asm"]
[ext_resource type="Script" uid="uid://cv4ex134wdu7j" path="res://scripts/game.gd" id="1_lnu2h"]
[ext_resource type="Script" uid="uid://cclb4boli603j" path="res://scripts/scene_manager.gd" id="2_lbhrr"]
[ext_resource type="Texture2D" uid="uid://bn4xd3wns5tfb" path="res://assets/environment/Terrain (32x32).png" id="2_p57ef"]
[ext_resource type="PackedScene" uid="uid://b2rjhbe4f20hw" path="res://scenes/crate.tscn" id="3_iywne"]
[ext_resource type="PackedScene" uid="uid://csp8sgbqjmndx" path="res://scenes/player.tscn" id="5_iywne"]
[ext_resource type="PackedScene" uid="uid://cq5l3f6hna0kg" path="res://scenes/trigger.tscn" id="5_p57ef"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u5sy4"]
texture = ExtResource("2_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, -16, 16, -16, 16, 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, 16, -16, 16)
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, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/left_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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
15:0/0/terrains_peering_bit/right_side = 0
15:0/0/terrains_peering_bit/bottom_side = 0
15:0/0/terrains_peering_bit/left_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, 16, -16, 16, 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/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, 16, -16, 16, 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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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/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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
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, 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, -16, 16, -16, 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, 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, 16, -16, 16)
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, -2.5490456, -16, -2.2304153, 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(3.186306, -16, 16, -16, 16, 16, 3.186306, 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, 16, -16, 16)
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, 16, -16, 16)
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, 16, -16, 16, 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, 16, -16, 16)
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, -16, 16, -16, 16, 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, -16, 16)
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, -16, 16)
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, 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, 16, -16, 16)
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, -2.5490456, -16, -2.2304153, 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(3.186306, -16, 16, -16, 16, 16, 3.186306, 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, -16, 16, 16, -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, -16, 16, 16, -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, -16, 16, 16, -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, 16, -16, 16, 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, 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, 16, -16, 16)
16:4/0/terrains_peering_bit/left_side = 0
16:4/0/terrains_peering_bit/top_side = 0
[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 = "LeafyGreen"
terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1)
sources/0 = SubResource("TileSetAtlasSource_u5sy4")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_iywne"]
@ -13,6 +399,10 @@
[node name="Game" type="Node2D" unique_id=304719081]
script = ExtResource("1_lnu2h")
[node name="TileMapLayer" type="TileMapLayer" parent="." unique_id=34853801]
tile_map_data = PackedByteArray("AAADAA0AAAAAAAQAAAAEAA0AAAABAAQAAAAFAA0AAAABAAQAAAAGAA0AAAABAAQAAAAHAA0AAAABAAQAAAAIAA0AAAABAAQAAAAJAA0AAAABAAQAAAAKAA0AAAABAAQAAAALAA0AAAABAAQAAAAMAA0AAAABAAQAAAAJABAAAAABAAAAAAAKABAAAAACAAAAAAAGABAAAAAAAAAAAAAGABEAAAAKAAQAAAAFABEAAAABAAQAAAAEABEAAAABAAQAAAAIABAAAAABAAAAAAAIABEAAAABAAIAAAAJABEAAAAHAAAAAAAKABEAAAAGAAEAAAALABEAAAACAAAAAAALABIAAAAGAAEAAAAMABIAAAABAAAAAAANABIAAAACAAAAAAASABIAAAABAAQAAAATABIAAAAQAAQAAAATABEAAAAEAAEAAAATABAAAAAPAAMAAAAUABAAAAAQAAQAAAAUAA8AAAAGAAMAAAAVAA8AAAABAAIAAAAWAA8AAAACAAIAAAAWAA4AAAAJAAMAAAAXAA4AAAABAAQAAAAYAA4AAAACAAQAAAAVAA4AAAABAAAAAAAUAA4AAAAKAAMAAAATAA4AAAABAAQAAAASAA4AAAAAAAQAAAADABEAAAAPAAMAAAAHABAAAAABAAAAAAAHABEAAAABAAIAAAANABMAAAACAAIAAAAMABMAAAABAAIAAAALABMAAAABAAIAAAAKABMAAAAAAAIAAAAKABIAAAAHAAAAAAAJABIAAAAAAAIAAAARABIAAAAAAAQAAAAQAAsAAAABAAQAAAARAAsAAAABAAQAAAASAAsAAAABAAQAAAATAAsAAAABAAQAAAAPAAsAAAAPAAMAAAAPAAwAAAAQAAQAAAAOAAwAAAAPAAMAAAAOAA0AAAAQAAQAAAANAA0AAAABAAQAAAADABIAAAAQAAQAAAACABIAAAAAAAQAAAAeAA0AAAAEAAIAAAAeAAwAAAAEAAEAAAAeAAsAAAAEAAEAAAAeAAoAAAAEAAEAAAAeAAkAAAAEAAEAAAAeAAgAAAAEAAEAAAAeAAcAAAAEAAAAAAAUAAsAAAABAAQAAAAVAAsAAAABAAQAAAAWAAsAAAABAAQAAAAXAAsAAAABAAQAAAAYAAsAAAACAAQAAAA=")
tile_set = SubResource("TileSet_gee14")
[node name="SceneManager" type="Node2D" parent="." unique_id=277183513]
script = ExtResource("2_lbhrr")
@ -30,7 +420,7 @@ position = Vector2(622, 305)
[node name="LevelELements" type="Node2D" parent="." unique_id=715855559]
[node name="StaticBody2D" type="StaticBody2D" parent="LevelELements" unique_id=2124897251]
position = Vector2(265, 413)
position = Vector2(382, 204)
scale = Vector2(14.68, 1)
metadata/_edit_group_ = true
@ -38,7 +428,7 @@ metadata/_edit_group_ = true
shape = SubResource("RectangleShape2D_8cj0n")
[node name="StaticBody2D2" type="StaticBody2D" parent="LevelELements" unique_id=1217525521]
position = Vector2(673, 417)
position = Vector2(908.00006, 101)
scale = Vector2(14.68, 1)
metadata/_edit_group_ = true
@ -46,7 +436,7 @@ metadata/_edit_group_ = true
shape = SubResource("RectangleShape2D_8cj0n")
[node name="StaticBody2D3" type="StaticBody2D" parent="LevelELements" unique_id=160438336]
position = Vector2(474.00006, 331)
position = Vector2(566, 67)
scale = Vector2(4.880001, 1)
metadata/_edit_group_ = true
@ -63,7 +453,7 @@ metadata/_edit_group_ = true
[node name="Triggers" type="Node2D" parent="." unique_id=969407448]
[node name="Trigger" parent="Triggers" unique_id=1612521889 instance=ExtResource("5_p57ef")]
position = Vector2(-352, 112)
position = Vector2(-110, -370)
[node name="Trigger2" parent="Triggers" unique_id=260830386 instance=ExtResource("5_p57ef")]
position = Vector2(80, 134)

View File

@ -1,9 +1,221 @@
[gd_scene format=3 uid="uid://csp8sgbqjmndx"]
[ext_resource type="Script" uid="uid://dy5o70pk5y8b2" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://drblapyhrti2g" path="res://assets/player/idle/Player Idle 48x48.png" id="2_g2els"]
[ext_resource type="Texture2D" uid="uid://cbyg0w7shutqp" path="res://assets/player/charging/Player Punch 64x64.png" id="2_qlg0r"]
[ext_resource type="Texture2D" uid="uid://bth27gwckesmw" path="res://assets/player/jump_fall/player jump 48x48.png" id="3_dqkch"]
[ext_resource type="Texture2D" uid="uid://dawy2436kryh5" path="res://assets/player/run/player run 48x48.png" id="3_qhqgy"]
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
[sub_resource type="AtlasTexture" id="AtlasTexture_l71n6"]
atlas = ExtResource("2_qlg0r")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
atlas = ExtResource("3_dqkch")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
atlas = ExtResource("2_g2els")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
atlas = ExtResource("2_g2els")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qlg0r"]
atlas = ExtResource("2_g2els")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
atlas = ExtResource("2_g2els")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
atlas = ExtResource("2_g2els")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_smehm"]
atlas = ExtResource("2_g2els")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ur7pv"]
atlas = ExtResource("2_g2els")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
atlas = ExtResource("2_g2els")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
atlas = ExtResource("2_g2els")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"]
atlas = ExtResource("2_g2els")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
atlas = ExtResource("3_dqkch")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
atlas = ExtResource("3_dqkch")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
atlas = ExtResource("3_qhqgy")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"]
atlas = ExtResource("3_qhqgy")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"]
atlas = ExtResource("3_qhqgy")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"]
atlas = ExtResource("3_qhqgy")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"]
atlas = ExtResource("3_qhqgy")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fulsm"]
atlas = ExtResource("3_qhqgy")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_4r5pv"]
atlas = ExtResource("3_qhqgy")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_60mlk"]
atlas = ExtResource("3_qhqgy")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ke2ow"]
atlas = ExtResource("2_qlg0r")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ujl30"]
atlas = ExtResource("2_qlg0r")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_31cv2"]
atlas = ExtResource("2_qlg0r")
region = Rect2(320, 0, 64, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_jej6c"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_l71n6")
}],
"loop": false,
"name": &"charge",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_4ni07")
}],
"loop": false,
"name": &"fall",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qhqgy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dqkch")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qlg0r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tuyoq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fjrip")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_smehm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ur7pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4r1p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d2wvv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3v2ag")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i4ail")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a38lo")
}],
"loop": false,
"name": &"jump",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jej6c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ej7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oprun")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a8ls1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qfm1y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fulsm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4r5pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_60mlk")
}],
"loop": true,
"name": &"run",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ke2ow")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ujl30")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_31cv2")
}],
"loop": false,
"name": &"shove",
"speed": 12.0
}]
[node name="Player" type="CharacterBody2D" unique_id=589925870]
scale = Vector2(1.8000001, 1.8000001)
script = ExtResource("1_3vyb7")
@ -24,3 +236,14 @@ position = Vector2(12.777777, -7.777777)
[node name="LeftBulletSpawn" type="Marker2D" parent="." unique_id=794453359]
position = Vector2(-13.333332, -7.7777777)
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="." unique_id=1606379306]
texture_filter = 1
position = Vector2(1.6666665, -6.1111107)
sprite_frames = SubResource("SpriteFrames_jej6c")
animation = &"shove"
autoplay = "idle"
frame = 2
frame_progress = 1.0
[connection signal="animation_finished" from="PlayerGraphic" to="." method="_on_animation_finished"]

View File

@ -50,3 +50,4 @@ func crateTotal(numOfCrates):
func bulletDamage(body, _bullet) -> void:
if body.is_in_group("shootable"):
destroySignal.emit(body)
destroySignal.emit(_bullet)

View File

@ -6,40 +6,57 @@ signal shootSignal(markerPosition, speed)
@onready var left_cast: RayCast2D = $LeftCast
@onready var right_bullet_spawn: Marker2D = $RightBulletSpawn
@onready var left_bullet_spawn: Marker2D = $LeftBulletSpawn
@onready var player_graphic: AnimatedSprite2D = $PlayerGraphic
var pushRightEnabled = false
var pushLeftEnabled = false
var pushTarget
var pushTimer = 0
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
const SPEED = 400.0
const JUMP_VELOCITY = -500.0
enum FaceDirection {RIGHT,LEFT}
var facing:FaceDirection = FaceDirection.RIGHT
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
enum PlayerStates {IDLE, RUNNING, JUMPING, FALLING, CHARGING, SHOVING}
var current_player_state:PlayerStates = PlayerStates.IDLE
var upJump:bool = false
func _physics_process(delta: float) -> void:
handle_input()
handle_movement(delta)
handle_states()
handle_animation()
move_and_slide()
handle_collisions()
func handle_input() -> void:
# Handle jump.
if Input.is_action_just_pressed("ui_up") and is_on_floor():
velocity.y = JUMP_VELOCITY
current_player_state = PlayerStates.JUMPING
upJump = true
# Handle shove
if Input.is_action_just_pressed("shove"):
print("Shove pressed")
pushTimer = Time.get_ticks_msec()
if pushRightEnabled and facing == FaceDirection.RIGHT:
current_player_state = PlayerStates.CHARGING
pushTimer = Time.get_ticks_msec()
if pushLeftEnabled and facing == FaceDirection.LEFT:
current_player_state = PlayerStates.CHARGING
pushTimer = Time.get_ticks_msec()
if Input.is_action_just_released("shove"):
var pushForce = Time.get_ticks_msec() - pushTimer
if pushForce > 4000:
pushForce = 4000
if pushRightEnabled and facing == FaceDirection.RIGHT:
pushSignal.emit(pushTarget, Vector2(1,0) * 100 * (pushForce/100))
current_player_state = PlayerStates.SHOVING
if pushLeftEnabled and facing == FaceDirection.LEFT:
pushSignal.emit(pushTarget, Vector2(-1,0) * 100 * (pushForce/100))
current_player_state = PlayerStates.SHOVING
# Handle shoot
if Input.is_action_just_pressed("shoot"):
print("Shoot pressed")
@ -47,7 +64,7 @@ func _physics_process(delta: float) -> void:
FaceDirection.RIGHT:
shootSignal.emit(right_bullet_spawn.global_transform, 800)
FaceDirection.LEFT:
shootSignal.emit(left_bullet_spawn.global_transform, 800)
shootSignal.emit(left_bullet_spawn.global_transform, -800)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
@ -56,12 +73,19 @@ func _physics_process(delta: float) -> void:
velocity.x = direction * SPEED
if direction > 0:
facing = FaceDirection.RIGHT
player_graphic.flip_h = false
else:
facing = FaceDirection.LEFT
player_graphic.flip_h = true
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
func handle_movement(delta) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
func handle_collisions() -> void:
# Collision detection needs to happen AFTER move_and_slide calculation
if right_cast.is_colliding():
print("Right raycast collision")
@ -86,3 +110,40 @@ func _physics_process(delta: float) -> void:
if c.get_collider() is RigidBody2D:
#c.get_collider().apply_central_impulse(-c.get_normal() * 100)
pushSignal.emit(c.get_collider(),-c.get_normal() * 100)
func handle_states() -> void:
match current_player_state:
PlayerStates.IDLE when velocity.x != 0:
current_player_state = PlayerStates.RUNNING
PlayerStates.RUNNING when velocity.x == 0:
current_player_state = PlayerStates.IDLE
PlayerStates.JUMPING when velocity.y > 0:
current_player_state = PlayerStates.FALLING
PlayerStates.FALLING when is_on_floor():
if velocity.x == 0:
current_player_state = PlayerStates.IDLE
else:
current_player_state = PlayerStates.RUNNING
func handle_animation() -> void:
match current_player_state:
PlayerStates.RUNNING:
player_graphic.play("run")
PlayerStates.IDLE:
player_graphic.play("idle")
PlayerStates.JUMPING:
if upJump:
player_graphic.play("jump")
PlayerStates.FALLING:
player_graphic.play("fall")
PlayerStates.CHARGING:
player_graphic.play("charge")
PlayerStates.SHOVING:
player_graphic.play("shove")
func _on_animation_finished() -> void:
match current_player_state:
PlayerStates.JUMPING:
upJump = false
PlayerStates.SHOVING:
current_player_state = PlayerStates.IDLE

View File

@ -39,8 +39,21 @@ func pushTarget(body,pushDirection) -> void:
if body is RigidBody2D:
body.apply_central_impulse(pushDirection)
func stashBullet(bullet:Bullet) -> void:
# hide the bullet
var stashPosition:Vector2 = Vector2(-100,-100)
bullet.position = stashPosition
bullet.setSpeed(0)
bullet.set_process(false)
func destroy(body) -> void:
body.queue_free()
match body:
var bod when bod is Bullet:
stashBullet(body)
var bod when bod is Crate:
body.queue_free()
_:
body.queue_free()
func teleportTarget(body) -> void:
if body is Crate:
@ -67,3 +80,4 @@ func makeBullet(spawnPosition, speed) -> void:
var myBullet:Bullet = bulletFactory()
myBullet.transform = spawnPosition
myBullet.setSpeed(speed)
myBullet.set_process(true)