tiles, shooting, playergraphic/state machine

This commit is contained in:
CatherineHoang 2026-07-06 21:02:28 -04:00
parent 616afe6dbb
commit 3521f229d7
22 changed files with 992 additions and 15 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://dovvf1uuqso4p"
path="res://.godot/imported/crate.png-be35cb23f8cb4e051f280dccbe4648ae.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Destructables/crate.png"
dest_files=["res://.godot/imported/crate.png-be35cb23f8cb4e051f280dccbe4648ae.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://fdttdiukun15"
path="res://.godot/imported/Terrain (32x32).png-78321cd3fc95da79251a523d0d1ce1fa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Environment/Terrain (32x32).png"
dest_files=["res://.godot/imported/Terrain (32x32).png-78321cd3fc95da79251a523d0d1ce1fa.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://edtnvpru6i3b"
path="res://.godot/imported/Player Punch 64x64.png-fc21c03a69d177e5139a870ba59e3723.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-fc21c03a69d177e5139a870ba59e3723.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://dr3u0hb58tj6x"
path="res://.godot/imported/Player Idle 48x48.png-70a0cf4eef87fc3fd83313b26a560480.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-70a0cf4eef87fc3fd83313b26a560480.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://itpuf1wcu10i"
path="res://.godot/imported/player jump 48x48.png-bcae42a49c85a80cdcb1c440ac69d64b.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-bcae42a49c85a80cdcb1c440ac69d64b.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://cl4as81xv56wq"
path="res://.godot/imported/player run 48x48.png-57be3e091c303badde36289c66e39644.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-57be3e091c303badde36289c66e39644.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://c03dorgqsjth6"
path="res://.godot/imported/pixel_bullet.png-b2277e51839906b450f03033f02c7037.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Projectiles/pixel_bullet.png"
dest_files=["res://.godot/imported/pixel_bullet.png-b2277e51839906b450f03033f02c7037.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,13 +1,22 @@
[gd_scene format=3 uid="uid://dvg70drsbendq"]
[ext_resource type="Script" uid="uid://u1ubij2eih4r" path="res://Scripts/bullet.gd" id="1_xjght"]
[ext_resource type="Texture2D" uid="uid://c03dorgqsjth6" path="res://Assets/Projectiles/pixel_bullet.png" id="2_oduel"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4mw4s"]
size = Vector2(10, 4)
[node name="Bullet" type="Area2D" unique_id=1549351635]
script = ExtResource("1_xjght")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=687436499]
shape = SubResource("RectangleShape2D_4mw4s")
debug_color = Color(0.9064841, 0.22817236, 0.5106338, 0.41960785)
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1106935654]
texture_filter = 1
position = Vector2(-2.9999998, -1.9999999)
rotation = 3.1415927
scale = Vector2(0.08, 0.08)
texture = ExtResource("2_oduel")

View File

@ -1,14 +1,19 @@
[gd_scene format=3 uid="uid://b5y6rb2t0eaqr"]
[ext_resource type="Script" uid="uid://1f7oldcrygg1" path="res://Scripts/crate.gd" id="1_wp72f"]
[ext_resource type="Texture2D" uid="uid://dovvf1uuqso4p" path="res://Assets/Destructables/crate.png" id="2_i4r3v"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ebmjs"]
[node name="Crate" type="RigidBody2D" unique_id=38246509]
rotation = 0.8756123
script = ExtResource("1_wp72f")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=762463145]
shape = SubResource("RectangleShape2D_ebmjs")
debug_color = Color(0.6966804, 0.33116472, 0.12741977, 0.41960785)
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=294363864]
position = Vector2(0, 1)
scale = Vector2(0.07, 0.068)
texture = ExtResource("2_i4r3v")

View File

@ -1,29 +1,399 @@
[gd_scene format=3 uid="uid://bportqr2j3d7s"]
[gd_scene format=4 uid="uid://bportqr2j3d7s"]
[ext_resource type="Script" uid="uid://cvrssvw6p8myl" path="res://Scripts/game.gd" id="1_wrm1d"]
[ext_resource type="Script" uid="uid://bfh1ec3bb5oki" path="res://Scripts/scene_manager.gd" id="2_3dryh"]
[ext_resource type="Texture2D" uid="uid://fdttdiukun15" path="res://Assets/Environment/Terrain (32x32).png" id="2_i6g32"]
[ext_resource type="PackedScene" uid="uid://dyb6tnhpivflf" path="res://Scenes/trigger.tscn" id="3_i6g32"]
[ext_resource type="PackedScene" uid="uid://b5y6rb2t0eaqr" path="res://Scenes/crate.tscn" id="3_wowpa"]
[ext_resource type="PackedScene" uid="uid://en40721f6qwj" path="res://Scenes/player.tscn" id="4_wowpa"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_1l0tm"]
texture = ExtResource("2_i6g32")
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, -0.63726044, 16, -16, -16, -16, -16, -0.95589256)
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/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/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/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, -0.63726044, -16, 0, 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
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, -0.63726044, -16, 0, 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/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/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, -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.63726044, 16, 16, -16, 16, -16, -0.95589256)
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, -0.31863022, -16, -0.31863022, 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, 16, -16, -0.63726044, -16, 0, 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, -0.63726044, -16, -0.95589256, -16, -16, 0.63726044, -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, -0.63726044, -16, -0.95589256, -16, -16, 0.63726044, -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, -0.95589256, -16, -16, 0.63726044, -16, 16, -16, 16, -0.95589256, 16, 16, 0.31863022, 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
12:3/0/terrains_peering_bit/top_right_corner = 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, -0.95589256, -16, -16, 0.63726044, -16, 16, -16, 16, -0.95589256, 16, 16, 0.31863022, 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/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/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, -0.31863022, -16, -0.31863022, 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, 16, -16, -0.63726044, -16, 0, 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, -0.63726044, 16, 16, -16, 16, -16, -0.95589256, 0.9446926, -0.78716993, 0.63726044, -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, -0.95589256, -16, -16, 0.63726044, -16, 0.95589066, -0.95589256, 16, -0.95589256, 16, 16, 0.31863022, 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.95589256, -16, -16, 0.63726044, -16, 16, -16, 16, -0.95589256, 16, 16, 0.31863022, 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, -0.95589256, -16, -16, 0.63726044, -16, 16, -16, 16, -0.95589256, 16, 16, 0.31863022, 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, -0.95589256, -16, -16, 0.63726044, -16, 16, -16, 16, -0.95589256, 16, 16, 0.31863022, 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, -0.95589256, -16, -16, 0.63726044, -16, 16, -16, 16, -0.95589256, 16, 16, 0.31863022, 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_v158k"]
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_1l0tm")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2poj3"]
[node name="Game" type="Node2D" unique_id=1651082265]
script = ExtResource("1_wrm1d")
[node name="TileMapLayer" type="TileMapLayer" parent="." unique_id=1853393222]
tile_map_data = PackedByteArray("AAAOAA4AAAAPAAQAAAAPAA4AAAABAAQAAAAQAA4AAAABAAQAAAARAA4AAAABAAQAAAASAA4AAAAQAAQAAAANABEAAAABAAAAAAAOABEAAAABAAAAAAANABIAAAAHAAAAAAAOABIAAAAGAAAAAAAPABIAAAAGAAAAAAAPABEAAAABAAAAAAALAA8AAAACAAAAAAALABAAAAAGAAEAAAAMABAAAAACAAAAAAAQABEAAAACAAAAAAAQABIAAAAGAAEAAAARABIAAAACAAAAAAATABMAAAAEAAQAAAAVABIAAAAAAAAAAAAWABIAAAAHAAEAAAAWABEAAAAAAAAAAAAVAA4AAAAPAAQAAAAWAA4AAAAKAAQAAAAWAA0AAAAAAAAAAAAXAA0AAAAJAAMAAAAYAA0AAAAQAAQAAAAXAA4AAAACAAIAAAAXABEAAAABAAAAAAAXABIAAAAGAAAAAAAVABMAAAAAAAIAAAAWABMAAAABAAIAAAAXABMAAAABAAIAAAAYABMAAAACAAIAAAAYABIAAAACAAEAAAAYABEAAAAJAAMAAAAZABAAAAAAAAAAAAAaABAAAAAGAAAAAAAZABEAAAAKAAQAAAAaABEAAAACAAIAAAAaAA8AAAAAAAAAAAAbAA8AAAACAAAAAAAbABAAAAACAAIAAAARABMAAAACAAIAAAAQABMAAAABAAIAAAAPABMAAAABAAIAAAAOABMAAAABAAIAAAALABEAAAABAAIAAAAMABEAAAAQAAEAAAAMABIAAAAAAAIAAAANABMAAAAAAAIAAAAKABAAAAAHAAAAAAAKABEAAAAAAAIAAAAJABAAAAAAAAIAAAAKAA8AAAABAAAAAAAJAA8AAAAAAAAAAAA=")
tile_set = SubResource("TileSet_v158k")
[node name="SceneManager" type="Node2D" parent="." unique_id=1701867043]
script = ExtResource("2_3dryh")
[node name="Floor" type="StaticBody2D" parent="." unique_id=1930890804]
position = Vector2(558, 453)
position = Vector2(510, 308)
scale = Vector2(3.880005, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Floor" unique_id=208628971]
shape = SubResource("RectangleShape2D_2poj3")
[node name="Floor4" type="StaticBody2D" parent="." unique_id=41291254]
position = Vector2(630, 305)
scale = Vector2(3.880005, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Floor4" unique_id=1311190264]
shape = SubResource("RectangleShape2D_2poj3")
[node name="Floor2" type="StaticBody2D" parent="." unique_id=1987202329]
position = Vector2(751, 411)
position = Vector2(818.00006, 256)
scale = Vector2(3.880005, 1)
metadata/_edit_group_ = true
@ -31,7 +401,7 @@ metadata/_edit_group_ = true
shape = SubResource("RectangleShape2D_2poj3")
[node name="Floor3" type="StaticBody2D" parent="." unique_id=1726195228]
position = Vector2(689, 433.00003)
position = Vector2(753.99994, 279)
rotation = -0.69889295
scale = Vector2(3.880005, 1)
metadata/_edit_group_ = true
@ -40,7 +410,7 @@ metadata/_edit_group_ = true
shape = SubResource("RectangleShape2D_2poj3")
[node name="Trigger" parent="." unique_id=1055766094 instance=ExtResource("3_i6g32")]
position = Vector2(627, 517)
position = Vector2(634, 534)
[node name="Player" parent="." unique_id=478864706 instance=ExtResource("4_wowpa")]
position = Vector2(538.00006, 420)
@ -48,9 +418,12 @@ position = Vector2(538.00006, 420)
[node name="Crates" type="Node2D" parent="." unique_id=799685623]
[node name="Crate" parent="Crates" unique_id=38246509 instance=ExtResource("3_wowpa")]
position = Vector2(683, 406)
position = Vector2(643, 387)
[node name="Crate2" parent="Crates" unique_id=1259430642 instance=ExtResource("3_wowpa")]
position = Vector2(716, 382)
[node name="Crate" parent="." unique_id=990352720 instance=ExtResource("3_wowpa")]
position = Vector2(585, 432)
[connection signal="areaTriggerSignal" from="Trigger" to="." method="_on_trigger"]

View File

@ -1,9 +1,221 @@
[gd_scene format=3 uid="uid://en40721f6qwj"]
[ext_resource type="Script" uid="uid://cq2vf132xjtli" path="res://Scripts/player.gd" id="1_v0iea"]
[ext_resource type="Texture2D" uid="uid://dr3u0hb58tj6x" path="res://Assets/Player/Idle/Player Idle 48x48.png" id="2_cvnsp"]
[ext_resource type="Texture2D" uid="uid://edtnvpru6i3b" path="res://Assets/Player/Charging/Player Punch 64x64.png" id="2_fkybt"]
[ext_resource type="Texture2D" uid="uid://cl4as81xv56wq" path="res://Assets/Player/Run/player run 48x48.png" id="3_6t5aa"]
[ext_resource type="Texture2D" uid="uid://itpuf1wcu10i" path="res://Assets/Player/Jump_Fall/player jump 48x48.png" id="3_vgqql"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ebmjs"]
[sub_resource type="AtlasTexture" id="AtlasTexture_2ijsl"]
atlas = ExtResource("2_fkybt")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bi64h"]
atlas = ExtResource("3_vgqql")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_6t5aa"]
atlas = ExtResource("2_cvnsp")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vgqql"]
atlas = ExtResource("2_cvnsp")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fkybt"]
atlas = ExtResource("2_cvnsp")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_x3wgy"]
atlas = ExtResource("2_cvnsp")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3smsa"]
atlas = ExtResource("2_cvnsp")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_8erm5"]
atlas = ExtResource("2_cvnsp")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ek2"]
atlas = ExtResource("2_cvnsp")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tx1dd"]
atlas = ExtResource("2_cvnsp")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gymyn"]
atlas = ExtResource("2_cvnsp")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_pu2lt"]
atlas = ExtResource("2_cvnsp")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_olqyp"]
atlas = ExtResource("3_vgqql")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wpjfl"]
atlas = ExtResource("3_vgqql")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ukyrk"]
atlas = ExtResource("3_6t5aa")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_7dp3o"]
atlas = ExtResource("3_6t5aa")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_h4iuc"]
atlas = ExtResource("3_6t5aa")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fd4e3"]
atlas = ExtResource("3_6t5aa")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qqcod"]
atlas = ExtResource("3_6t5aa")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_igrcy"]
atlas = ExtResource("3_6t5aa")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fs7ks"]
atlas = ExtResource("3_6t5aa")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_l6n3p"]
atlas = ExtResource("3_6t5aa")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_p1odr"]
atlas = ExtResource("2_fkybt")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_0gysh"]
atlas = ExtResource("2_fkybt")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_vfarp"]
atlas = ExtResource("2_fkybt")
region = Rect2(320, 0, 64, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_ukyrk"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_2ijsl")
}],
"loop": false,
"name": &"charging",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_bi64h")
}],
"loop": false,
"name": &"falling",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6t5aa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vgqql")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fkybt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x3wgy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3smsa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8erm5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ek2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tx1dd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gymyn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pu2lt")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_olqyp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wpjfl")
}],
"loop": false,
"name": &"jumping",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ukyrk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7dp3o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_h4iuc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fd4e3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qqcod")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_igrcy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fs7ks")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l6n3p")
}],
"loop": true,
"name": &"running",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_p1odr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0gysh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vfarp")
}],
"loop": false,
"name": &"shoving",
"speed": 12.0
}]
[node name="Player" type="CharacterBody2D" unique_id=478864706]
scale = Vector2(1.64, 1.64)
script = ExtResource("1_v0iea")
@ -24,3 +236,14 @@ position = Vector2(11.585366, -8.536586)
[node name="LeftSpawn" type="Marker2D" parent="." unique_id=1880777693]
position = Vector2(-12.195123, -8.536585)
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="." unique_id=411274624]
texture_filter = 1
position = Vector2(0, -6.0975614)
sprite_frames = SubResource("SpriteFrames_ukyrk")
animation = &"shoving"
autoplay = "idle"
frame = 2
frame_progress = 1.0
[connection signal="animation_finished" from="PlayerGraphic" to="." method="_on_animation_finished"]

View File

@ -1,13 +1,13 @@
class_name Bullet extends Area2D
var speed:float = 700
signal bulletHitSignal(body, bullet)
func setSpeed(value)->void:
speed = value
func _process(delta: float) -> void:
position += transform.x * speed * delta
func _on_body_entered(body: Node2D) -> void:
if body is Crate:
bulletHitSignal.emit(body,self)

View File

@ -40,6 +40,9 @@ func crateTotal(howMany):
if numberOfCrates == 0:
print("YOU WON!!!")
get_tree().reload_current_scene()
func bulletDamage(body, _bullet)->void:
if body.is_in_group("shootable"):
destroySignal.emit(body)
destroySignal.emit(_bullet)

View File

@ -8,6 +8,7 @@ const JUMP_VELOCITY = -400.0
@onready var left_cast: RayCast2D = $LeftCast
@onready var right_spawn: Marker2D = $RightSpawn
@onready var left_spawn: Marker2D = $LeftSpawn
@onready var player_graphic: AnimatedSprite2D = $PlayerGraphic
var pushRightEnabled = false
var pushLeftEnabled = false
@ -17,17 +18,32 @@ var pushTimer = 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 = false
func _physics_process(delta: float) -> void:
handle_movement(delta)
handle_input()
handle_states()
handle_animation()
move_and_slide()
handle_collisions()
func handle_input()->void:
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
current_player_state = playerStates.JUMPING
upJump = true
#Handle shove target
if Input.is_action_just_pressed("shove"):
print("I want to shove")
if pushRightEnabled && facing==FaceDirection.RIGHT:
current_player_state = playerStates.CHARGING
pushTimer = Time.get_ticks_msec()
if pushLeftEnabled && 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
@ -36,8 +52,10 @@ func _physics_process(delta: float) -> void:
if pushRightEnabled and facing==FaceDirection.RIGHT:
#deliver the boom
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 Bullet
if Input.is_action_just_pressed("shoot"):
@ -48,6 +66,7 @@ func _physics_process(delta: float) -> void:
shootSignal.emit(right_spawn.global_transform, 800)
FaceDirection.LEFT:
shootSignal.emit(left_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.
var direction := Input.get_axis("ui_left", "ui_right")
@ -55,12 +74,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:
if right_cast.is_colliding():
print("Right raycast collision")
var collider = right_cast.get_collider()
@ -84,3 +110,43 @@ func _physics_process(delta: float) -> void:
#is this bonkable? reverse normal
if c.get_collider() is RigidBody2D:
c.get_collider().apply_central_impulse(-c.get_normal() * 100)
# Exciting new stuff
func handle_states()->void:
match current_player_state:
playerStates.IDLE when velocity.x != 0:
print("I run")
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("running")
playerStates.IDLE:
player_graphic.play("idle")
playerStates.JUMPING:
if upJump:
player_graphic.play("jumping")
playerStates.FALLING:
player_graphic.play("falling")
playerStates.CHARGING:
player_graphic.play("charging")
playerStates.SHOVING:
player_graphic.play("shoving")
func _on_animation_finished() -> void:
match current_player_state:
playerStates.JUMPING:
upJump = false
playerStates.SHOVING:
current_player_state = playerStates.IDLE

View File

@ -37,8 +37,23 @@ func updateCrates()->void:
func pushTarget(body,pushDirection)->void:
if body is RigidBody2D:
body.apply_central_impulse(pushDirection)
func stashBullet(bullet:Bullet)->void:
# hide bullet
var stashPosition:Vector2 = Vector2(-100,-100)
bullet.position = stashPosition
bullet.setSpeed(0)
bullet.set_process(false)
func destroy(body)->void:
match body:
var bod when bod is Bullet:
stashBullet(body)
var bod when bod is Crate:
body.queue_free()
_:
body.queue_free()
func bulletFactory()->Bullet:
var myBullet:Bullet
#how many bullets have been produced?
@ -49,12 +64,15 @@ func bulletFactory()->Bullet:
if not myBullet.bulletHitSignal.is_connected(game.bulletDamage):
myBullet.bulletHitSignal.connect(game.bulletDamage)
else:
# gets oldest one - pop_back
myBullet = bulletArray.pop_back()
bulletArray.push_front(myBullet)
return myBullet
func makeBullet(spawnPosition, speed)->void:
print("make bullet")
var myBullet:Bullet = bulletFactory()
myBullet.transform = spawnPosition
myBullet.setSpeed(speed)
myBullet.set_process(true)