Compare commits

...

52 Commits
0.0002 ... main

Author SHA1 Message Date
e8e0e7af57 Add recommended files to ignore list 2025-02-20 20:41:22 -08:00
807a2924f7 remove export_presets file as recommended by godot 2025-02-20 20:38:14 -08:00
9ef4d1748b Chests now spawn health pickups. Health pickups drop from the sky when spawned until they hit the ground. 2024-07-22 17:38:06 -07:00
2ff08298b7 Fixup for states for player and spider animation. Cleanup useless movement state comments. 2024-07-21 08:55:14 -07:00
48f3e631e6 Spider now tracks player and delays jump. Exit animation modifier works too! 2024-07-14 18:59:32 -07:00
8106474b39 spider stuff. 2024-07-14 10:16:32 -07:00
3e454f5785 Start add of spider enemy. 2024-07-13 12:22:48 -07:00
6aed49924e Platform moves and pushes player. I don't know if it's right but it appears to be working. 2024-07-12 15:28:48 -07:00
7a2842b5ee Platform actor works when not being stood on. 2024-07-12 10:49:54 -07:00
c21818caf3 Start to add platform actor, removed shared collision shape dependency among all actors. Whoops. 2024-07-12 10:07:53 -07:00
592c8dffb1 Ladders! ...janky ones. 2024-07-11 22:23:55 -07:00
6f8a13c8bb Starting to learn to climb ladders. 2024-07-07 18:21:43 -07:00
3f19a92db6 Wind/Conveyor belt physics state modifier implemented. 2024-07-07 17:36:27 -07:00
4125e9351c Momentum can traverse to jump now! Sortof. 2024-07-06 00:53:19 -07:00
761fe8d66c Finally something close to what I'm looking for! 2024-07-05 23:58:30 -07:00
44a32e2e47 Getting there again. Maybe it'll work this time. 2024-07-05 21:51:46 -07:00
195b8f064f Never gonna work is it? 2024-07-05 12:14:01 -07:00
020cae1caf Closer than ever to getting momentum working. 2024-07-04 17:37:23 -07:00
98c92dbeaf Fixup for motion and momentum. 2024-07-04 12:53:07 -07:00
402ce4456f Revert changes to state_animated_actor 2024-07-04 11:33:51 -07:00
0af4a19828 Momentum tinkering. Will probably pull back from previous commits. 2024-07-04 09:57:23 -07:00
20c5240dc2 Trying to get momentum working 2024-07-02 22:41:53 -07:00
7e03daa236 Ice, Flow, nowhere to go. 2024-06-30 14:03:15 -07:00
f35ab3703b Level physics state modifier system added. Now just need to apply it to the actors. 2024-06-30 10:59:43 -07:00
a87955eb0d One step closer to movement modification. States have a LOT more movement options! 2024-06-29 20:24:38 -07:00
2b08e37337 Modifier tweaks on dash to model over to usual movement. 2024-06-29 15:56:06 -07:00
38696b9398 Working on a modifier property set for merging 2024-06-29 10:03:48 -07:00
47bdf1728c Cleanup related to modifier feature. 2024-06-29 08:56:49 -07:00
bc5c67ca82 Attack state is better. Hopefully no more crashes with new single modifier system. 2024-06-29 08:27:04 -07:00
b51d69a8f9 State animations, Finally coming together. 2024-06-29 00:51:02 -07:00
aef17c3d81 What am I even doing. 2024-06-28 14:24:02 -07:00
0203076676 states again. 2024-06-27 23:05:46 -07:00
188bf46a09 Strip out all that state modifier stuff for a new approach. 2024-06-25 21:14:30 -07:00
4fda694182 tiny level change 2024-06-25 20:50:29 -07:00
62f29e8a18 Player now jumps to a level start position. Level has a base class now. 2024-06-23 11:50:53 -07:00
87c0e8f05f Player bump now moves with camera transition. 2024-06-23 11:00:07 -07:00
0194c26e8e Camera transitions can now force bump a player over a threshold. 2024-06-23 09:52:23 -07:00
36828498c4 Camera transition and upper and lower bounds added. 2024-06-23 09:01:11 -07:00
4bf2a3f788 DOORS... 2024-06-22 15:58:23 -07:00
e4a6188d89 Generalized interactable template. Created health pickup derived class. 2024-06-22 15:14:27 -07:00
a556afbe5f Interactibles working! 2024-06-22 08:35:32 -07:00
1cb72d1e43 Quick test that player sees interactible before bed. 2024-06-21 23:52:26 -07:00
3c38cdc258 Started work on an interactable sprite objects. 2024-06-21 23:45:33 -07:00
3f47fbbf7c Death anim added. 2024-06-21 22:02:16 -07:00
fb5f0dd872 Oh boy new level assets. 2024-06-21 20:58:01 -07:00
4c20731b6d Some more animations, finally figured out how modulate colors sort of work. Helps with that hurt animation. 2024-06-21 15:44:18 -07:00
80f2d9d1a0 Trying whole new PixelPerSecond based movement modifier system. Looking promising. 2024-06-20 15:59:50 -07:00
311423a509 Make way for a build system. 2024-06-20 15:14:05 -07:00
cb851e694a Fall and attack state improvements. Speed modifier now in move_as_desired function. 2024-06-19 23:20:27 -07:00
0686e8e8b0 Jump can now clear out a lingering fall animation transition. 2024-06-19 23:00:25 -07:00
eb47082730 Levelified a node tree. Added foreground and background tilemap layers. 2024-06-19 21:51:06 -07:00
922b4d05aa Dash momentum to jump. 2024-06-19 21:25:55 -07:00
98 changed files with 3567 additions and 981 deletions

5
.gitignore vendored
View File

@ -2,5 +2,8 @@
.godot/ .godot/
.import/ .import/
.mono/ .mono/
*.translation
export_presets.cfg
addons/ addons/
android/ android/
build/

252
Main.tscn

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Buildings.png-770ff715356884b1c817297b61c9d391.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Assets/Buildings.png"
dest_files=[ "res://.import/Buildings.png-770ff715356884b1c817297b61c9d391.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Hive.png-a7fa10a68a6ac7e64a951c5120ca919a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Assets/Hive.png"
dest_files=[ "res://.import/Hive.png-a7fa10a68a6ac7e64a951c5120ca919a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Interior-01.png-5c49d1d4148443ce62e7ce8e2971cc4b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Assets/Interior-01.png"
dest_files=[ "res://.import/Interior-01.png-5c49d1d4148443ce62e7ce8e2971cc4b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Props-Rocks.png-5fc44cb3261fb640ef6f4b399e25936d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Assets/Props-Rocks.png"
dest_files=[ "res://.import/Props-Rocks.png-5fc44cb3261fb640ef6f4b399e25936d.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Tiles.png-13228209615493c28b4ffdc1d443689f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Assets/Tiles.png"
dest_files=[ "res://.import/Tiles.png-13228209615493c28b4ffdc1d443689f.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Tree-Assets.png-ddc68d744737f7a66e85f4d2594672c8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Assets/Tree-Assets.png"
dest_files=[ "res://.import/Tree-Assets.png-ddc68d744737f7a66e85f4d2594672c8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Background.png-3958feb05652cfef811e8899a80f4b21.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Background/Background.png"
dest_files=[ "res://.import/Background.png-3958feb05652cfef811e8899a80f4b21.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Base-01.png-e14dd8e752d14575f026a4d902d2c6d1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/HUD/Base-01.png"
dest_files=[ "res://.import/Base-01.png-e14dd8e752d14575f026a4d902d2c6d1.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Background.png-a121f2f8cdc5cc7f47f7eef3e48f2ea6.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Trees/Background.png"
dest_files=[ "res://.import/Background.png-a121f2f8cdc5cc7f47f7eef3e48f2ea6.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Dark-Tree.png-ec5d91cebe262b341ca5e14c371992d1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Trees/Dark-Tree.png"
dest_files=[ "res://.import/Dark-Tree.png-ec5d91cebe262b341ca5e14c371992d1.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Golden-Tree.png-20c481574afe14f8f761d802692ea581.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Trees/Golden-Tree.png"
dest_files=[ "res://.import/Golden-Tree.png-20c481574afe14f8f761d802692ea581.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Green-Tree.png-d2411d0125ab213d8ffa7bf9c74df92d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Trees/Green-Tree.png"
dest_files=[ "res://.import/Green-Tree.png-d2411d0125ab213d8ffa7bf9c74df92d.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Red-Tree.png-3708fbf3bca869e7647318f93e501cc0.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Trees/Red-Tree.png"
dest_files=[ "res://.import/Red-Tree.png-3708fbf3bca869e7647318f93e501cc0.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Yellow-Tree.png-b7a2ad7318796ee49c166d8ef5238bf4.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/High Forest/Trees/Yellow-Tree.png"
dest_files=[ "res://.import/Yellow-Tree.png-b7a2ad7318796ee49c166d8ef5238bf4.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 117 KiB

BIN
assets/Spider1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

35
assets/Spider1.png.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Spider1.png-85cc52177a93c8766bb76a39a26b9d70.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Spider1.png"
dest_files=[ "res://.import/Spider1.png-85cc52177a93c8766bb76a39a26b9d70.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,144 @@
[gd_resource type="TileSet" load_steps=15 format=2]
[ext_resource path="res://assets/Tiles/Assets/Assets.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=4]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=5]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=10]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=11]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=12]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=13]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=14]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[resource]
0/name = "Assets.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 16, 0, 192, 96 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 2 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 10 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Sprite-0002.png-7e0b22663bb9fd1f35794e30fe2058e2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Tiles/Assets/Sprite-0002.png"
dest_files=[ "res://.import/Sprite-0002.png-7e0b22663bb9fd1f35794e30fe2058e2.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
assets/elevator.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/elevator.png-acbb9d6b280a7beb809eaa023b52f90b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/elevator.png"
dest_files=[ "res://.import/elevator.png-acbb9d6b280a7beb809eaa023b52f90b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
assets/mmz1_door.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/mmz1_door.png-bfbb77cdd4ff4c657c846885aecef8d7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/mmz1_door.png"
dest_files=[ "res://.import/mmz1_door.png-bfbb77cdd4ff4c657c846885aecef8d7.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
assets/quick_health.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/quick_health.png-ab4d63b30abc1b0088589c308b6afa54.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/quick_health.png"
dest_files=[ "res://.import/quick_health.png-ab4d63b30abc1b0088589c308b6afa54.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -1,205 +0,0 @@
[preset.0]
name="Android"
platform="Android"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
custom_build/use_custom_build=false
custom_build/export_format=0
custom_build/min_sdk=""
custom_build/target_sdk=""
architectures/armeabi-v7a=true
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
keystore/debug=""
keystore/debug_user=""
keystore/debug_password=""
keystore/release=""
keystore/release_user=""
keystore/release_password=""
one_click_deploy/clear_previous_install=false
version/code=1
version/name="1.0"
package/unique_name="org.godotengine.$genname"
package/name=""
package/signed=true
package/classify_as_game=true
package/retain_data_on_uninstall=false
package/exclude_from_recents=false
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
graphics/opengl_debug=false
xr_features/xr_mode=0
xr_features/hand_tracking=0
xr_features/hand_tracking_frequency=0
xr_features/passthrough=0
screen/immersive_mode=true
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
user_data_backup/allow=false
command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PoolStringArray( )
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=false
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=false
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/manage_external_storage=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=false
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=false
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=false
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false

View File

@ -24,6 +24,36 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://src/components/Health_Component.gd" "path": "res://src/components/Health_Component.gd"
}, { }, {
"base": "Interactable",
"class": "HealthPickup",
"language": "GDScript",
"path": "res://src/Interactables/HealthPickup.gd"
}, {
"base": "Area2D",
"class": "Interactable",
"language": "GDScript",
"path": "res://src/templates/Interactable/Interactable_Component.gd"
}, {
"base": "Node2D",
"class": "Interactable_Receiver",
"language": "GDScript",
"path": "res://src/templates/Interactable/Interactable_Receiver.gd"
}, {
"base": "Node2D",
"class": "Level",
"language": "GDScript",
"path": "res://src/Level.gd"
}, {
"base": "Reference",
"class": "ModifierProperties",
"language": "GDScript",
"path": "res://src/state_modifier_properties.gd"
}, {
"base": "Node2D",
"class": "Modifier_Receiver",
"language": "GDScript",
"path": "res://src/components/Modifier_Receiver.gd"
}, {
"base": "Node", "base": "Node",
"class": "MovementComponent", "class": "MovementComponent",
"language": "GDScript", "language": "GDScript",
@ -49,7 +79,7 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://src/state_machine_animated_actor.gd" "path": "res://src/state_machine_animated_actor.gd"
}, { }, {
"base": "Node", "base": "Reference",
"class": "StateModifier", "class": "StateModifier",
"language": "GDScript", "language": "GDScript",
"path": "res://src/state_modifier.gd" "path": "res://src/state_modifier.gd"
@ -63,6 +93,12 @@ _global_script_class_icons={
"Actor": "", "Actor": "",
"FrameSoundEffects": "", "FrameSoundEffects": "",
"HealthComponent": "", "HealthComponent": "",
"HealthPickup": "",
"Interactable": "",
"Interactable_Receiver": "",
"Level": "",
"ModifierProperties": "",
"Modifier_Receiver": "",
"MovementComponent": "", "MovementComponent": "",
"State": "", "State": "",
"StateAnimatedActor": "", "StateAnimatedActor": "",
@ -80,12 +116,14 @@ config/icon="res://icon.png"
[aseprite] [aseprite]
animation/layers/exclusion_pattern="_" animation/layers/exclusion_pattern="_+"
animation/layers/only_include_visible_layers_by_default=true
[autoload] [autoload]
PlayerInfo="*res://src/singleton_autoloads/PlayerInfo.gd" PlayerInfo="*res://src/singleton_autoloads/PlayerInfo.gd"
UiManager="*res://src/singleton_autoloads/UIManager.gd" UiManager="*res://src/singleton_autoloads/UIManager.gd"
LevelInfo="*res://src/singleton_autoloads/LevelInfo.gd"
[debug] [debug]
@ -183,6 +221,7 @@ dash_1={
2d_physics/layer_6="EnemyHurtbox" 2d_physics/layer_6="EnemyHurtbox"
2d_physics/layer_7="PlayerHitbox" 2d_physics/layer_7="PlayerHitbox"
2d_physics/layer_8="EnemyHitbox" 2d_physics/layer_8="EnemyHitbox"
2d_physics/layer_11="Climbable"
[mono] [mono]

View File

@ -0,0 +1,112 @@
[gd_scene load_steps=14 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/components/Hitbox_Component.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Actors/Enemies/Spider/spider_movement_component.gd" type="Script" id=3]
[ext_resource path="res://src/Actors/Enemies/Spider/states/move.gd" type="Script" id=4]
[ext_resource path="res://src/Actors/Enemies/Spider/states/idle.gd" type="Script" id=5]
[sub_resource type="StreamTexture" id=1]
load_path = "res://.import/Spider1.png-85cc52177a93c8766bb76a39a26b9d70.stex"
[sub_resource type="AtlasTexture" id=2]
atlas = SubResource( 1 )
region = Rect2( 0, 26, 20, 26 )
[sub_resource type="AtlasTexture" id=3]
atlas = SubResource( 1 )
region = Rect2( 0, 0, 20, 26 )
[sub_resource type="AtlasTexture" id=4]
atlas = SubResource( 1 )
region = Rect2( 20, 0, 20, 26 )
[sub_resource type="AtlasTexture" id=5]
atlas = SubResource( 1 )
region = Rect2( 40, 0, 20, 26 )
[sub_resource type="SpriteFrames" id=6]
animations = [ {
"frames": [ SubResource( 2 ) ],
"loop": false,
"name": "die",
"speed": 10.0
}, {
"frames": [ SubResource( 3 ) ],
"loop": false,
"name": "idle",
"speed": 10.0
}, {
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": false,
"name": "jump",
"speed": 10.0
}, {
"frames": [ SubResource( 5 ), SubResource( 4 ), SubResource( 3 ) ],
"loop": false,
"name": "land",
"speed": 10.0
} ]
[sub_resource type="RectangleShape2D" id=7]
extents = Vector2( 10, 12 )
[sub_resource type="CircleShape2D" id=8]
[node name="Spider" instance=ExtResource( 1 )]
actor_type = "Enemy"
[node name="AnimatedSprite" parent="." index="0"]
frames = SubResource( 6 )
animation = "jump"
frame = 2
__meta__ = {
"_aseprite_wizard_config_": {
"layer": "",
"o_ex_p": "",
"o_folder": "res://assets",
"o_name": "",
"only_visible": true,
"op_exp": false,
"slice": "",
"source": "D:/Sync/Assets/Library/Spider1.ase"
}
}
[node name="movement_component" parent="." index="1"]
script = ExtResource( 3 )
[node name="movement_state_machine" parent="." index="2"]
debug_state_machine = true
[node name="idle" parent="movement_state_machine" index="0"]
script = ExtResource( 5 )
timeout_seconds = 0.5
animation_sequence = [ "idle" ]
[node name="fall" parent="movement_state_machine" index="1"]
animation_sequence = [ "land" ]
[node name="move" parent="movement_state_machine" index="2"]
script = ExtResource( 4 )
animation_sequence = [ "jump" ]
jump_force = 200.0
[node name="CollisionShape2D" parent="Hurtbox_Component" index="0"]
position = Vector2( 0, -1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="5"]
position = Vector2( 0, -2 )
shape = SubResource( 7 )
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="." index="6"]
position = Vector2( 0, 1 )
[node name="Hitbox_Component" parent="." index="7" instance=ExtResource( 2 )]
damage_amount = 5
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox_Component" index="0"]
position = Vector2( 0, -1 )
shape = SubResource( 8 )
[connection signal="screen_entered" from="VisibilityNotifier2D" to="movement_component" method="_on_VisibilityNotifier2D_screen_entered"]

View File

@ -0,0 +1,67 @@
extends MovementComponent
## Constants available to you
# UP = -1.0
# DOWN = 1.0
# LEFT = -1.0
# RIGHT = 1.0
# Avalable functions to call
# A Series of helper functions
# go_up():
# go_down():
# go_left():
# go_right():
# stop():
var entered_screen = false
var jump_var = false
var last_player_direction: float
func process(delta):
if entered_screen:
if current_movement_state == "idle":
# Only check the player direction in idle because we don't want to track the player during jump
if owner is Actor:
last_player_direction = sign((owner.global_position.direction_to(PlayerInfo.player_position)).x)
jump_var = true
desired_movement_vector.x = last_player_direction
else:
desired_movement_vector.x = last_player_direction
jump_var = false
return
func wants_jump() -> bool:
return jump_var
## Other needed variables
# desired_movement_vector: Vector2 - Used to store desired movement depending on the state
# current_movement_state:String - The name of the current State
# Since animactor state machine can actually view properties from this type
# I'm thinking about moving the velocity tracker in here instead of player.
# velocity: Vector2 - Current velocity, you can change this at will but state may modify it
# Declare any other member variables here. Examples:
# var a = 2
# var b = "text"
# Called every frame. 'delta' is the elapsed time since the previous frame.
# you do not normally need to define this for Actor
#func process(delta):
# pass
# For Enemy and NPC Actors:
# should be called on the frame process.
# For Player Actors:
# Should be called on the input process
func _on_VisibilityNotifier2D_screen_entered():
entered_screen = true
print("Spider wants to play!!!")

View File

@ -0,0 +1,26 @@
extends "res://src/templates/Actor/states/idle.gd"
func enter() -> void:
.enter()
# parent.set_hurtbox(true)
move_component.velocity.x = 0
state_timeout.start()
func process_physics(delta: float) -> State:
# parent.velocity.y += gravity * delta
# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
# parent.velocity.x = move_component.desired_movement_vector.x * move_speed
# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
if state_timeout.time_left == 0:
move_actor_as_desired(delta)
if move_component.velocity.x != 0.0:
return move_state
if !parent.is_on_floor():
return fall_state
return null

View File

@ -0,0 +1,36 @@
extends "res://src/templates/Actor/states/move.gd"
export var jump_force: float = 200.0
var landing_modifier: StateModifier
func _ready():
landing_modifier= StateModifier.new()
#add_child(modifier)
#modifier.init_ref()
landing_modifier.ready( "landing", "land" , landing_modifier.TYPE.EXIT_ANIMATION)
#print("ready! MOD")
func enter() -> void:
.enter()
# Apply initial jump velocity on state enter
move_component.velocity.y = -jump_force
func process_physics(delta: float) -> State:
# if move_component.velocity.y > 0:
# return fall_state
# First allow horizontal movement.
move_actor_as_desired(delta)
#Flip the character before tha actual move maybe.
if move_component.get_movement_direction() != 0.0:
parent.transform.x.x = move_component.get_movement_direction()
if parent.is_on_floor():
idle_state.modifier = landing_modifier
return idle_state
return null

View File

@ -0,0 +1,79 @@
[gd_scene load_steps=13 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Actors/Platform/PlatformVMove/states/move.gd" type="Script" id=2]
[ext_resource path="res://src/Actors/Platform/PlatformVMove/states/idle.gd" type="Script" id=3]
[sub_resource type="StreamTexture" id=1]
load_path = "res://.import/elevator.png-acbb9d6b280a7beb809eaa023b52f90b.stex"
[sub_resource type="AtlasTexture" id=2]
atlas = SubResource( 1 )
region = Rect2( 0, 0, 86, 44 )
[sub_resource type="AtlasTexture" id=3]
atlas = SubResource( 1 )
region = Rect2( 86, 0, 86, 44 )
[sub_resource type="AtlasTexture" id=4]
atlas = SubResource( 1 )
region = Rect2( 172, 0, 86, 44 )
[sub_resource type="AtlasTexture" id=5]
atlas = SubResource( 1 )
region = Rect2( 0, 44, 86, 44 )
[sub_resource type="AtlasTexture" id=6]
atlas = SubResource( 1 )
region = Rect2( 86, 44, 86, 44 )
[sub_resource type="AtlasTexture" id=7]
atlas = SubResource( 1 )
region = Rect2( 172, 44, 86, 44 )
[sub_resource type="SpriteFrames" id=8]
animations = [ {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=9]
extents = Vector2( 38, 15.5 )
[node name="PlatformVMove" instance=ExtResource( 1 )]
collision_layer = 0
collision_mask = 2
motion/sync_to_physics = true
actor_type = "Object"
[node name="AnimatedSprite" parent="." index="0"]
frames = SubResource( 8 )
frame = 1
__meta__ = {
"_aseprite_wizard_config_": {
"layer": "",
"o_ex_p": "",
"o_folder": "res://assets",
"o_name": "",
"only_visible": true,
"op_exp": false,
"slice": "",
"source": "D:/Sync/Assets/Library/elevator.ase"
}
}
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
position = Vector2( 0, -3.5 )
shape = SubResource( 9 )
[node name="idle" parent="movement_state_machine" index="0"]
script = ExtResource( 3 )
timeout_seconds = 2.0
move_speed = 0.0
[node name="move" parent="movement_state_machine" index="2"]
script = ExtResource( 2 )
timeout_seconds = 1.0
move_speed = 30.0

View File

@ -0,0 +1,26 @@
extends StateAnimatedActor
export (NodePath) var move_node
onready var move_state: State = get_node(move_node)
func enter() -> void:
.enter()
# parent.set_hurtbox(true)
if debug_state:
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
state_timeout.start()
func process_frame(delta):
if state_timeout.time_left == 0:
return move_state
return null
func process_physics(delta: float) -> State:
# parent.velocity.y += gravity * delta
# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
# parent.velocity.x = move_component.desired_movement_vector.x * move_speed
# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
return null

View File

@ -0,0 +1,55 @@
extends StateAnimatedActor
export (NodePath) var idle_node
onready var idle_state: State = get_node(idle_node)
var flip_flop:bool = false
var recoil_velocity = Vector2.ZERO
var max_recoil:float = 8.0
func enter() -> void:
.enter()
# parent.set_hurtbox(true)
if debug_state:
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
state_timeout.start()
func process_physics(delta: float) -> State:
if state_timeout.time_left == 0:
if flip_flop:
move_component.velocity.y = move_speed
flip_flop = false
return idle_state
else:
move_component.velocity.y = move_speed * - 1
flip_flop = true
return idle_state
#move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
#var collision = parent.move_and_collide(move_component.velocity * delta, true, true, true)
# var collision = parent.move_and_collide(Vector2.UP, true, true, true)
#
# if collision and recoil_velocity == Vector2.ZERO:
# print("Get off me!")
# recoil_velocity.y += max_recoil * delta
# if collision and recoil_velocity == Vector2.ZERO:
# print("Get off me!")
# recoil_velocity.y += max_recoil * delta
# else:
# if recoil_velocity.y < max_recoil:
# recoil_velocity.y -= max_recoil * delta
# else:
# recoil_velocity.y += max_recoil * delta
# if recoil_velocity.y < 0:
# recoil_velocity = Vector2.ZERO
#parent.global_translate(move_component.velocity * delta)
parent.position += (move_component.velocity + recoil_velocity) * delta
return null

View File

@ -4,30 +4,36 @@ export(String) var LINE_COLOR_HEX = '#FFEB3B'
var grid_position = Vector2() var grid_position = Vector2()
var grid_size = Vector2() var grid_size = Vector2()
var t = 0.0
onready var parent = PlayerInfo onready var parent = PlayerInfo
onready var timer: Timer = $Timer
#onready var parent = $Player #onready var parent = $Player
##TODO: Quick and dirty because we need to pause these
onready var player_node :KinematicBody2D = $"../Player"
#onready var level_node = $"../Level"
func _ready(): func _ready():
# If you drag the camera from the OffsetPivot node, # If you drag the camera from the OffsetPivot node,
# its position will not be (0, 0) # its position will not be (0, 0)
#$Camera2D.global_position = Vector2(160,90) # when doing grid snapping #$Camera2D.global_position = Vector2(160,90) # when doing grid snapping
#$Left.position = Vector2(160,90) #$Left.position = Vector2(160,90)
$Camera2D.position = Vector2(0,-4) #$Camera2D.position = Vector2(0,-4)
#grid_size = OS.get_screen_size() #grid_size = OS.get_screen_size()
grid_size = get_node("/root").size grid_size = get_node("/root").size
#grid_size = get_node("/root").get_visible_rect().size #grid_size = get_node("/root").get_visible_rect().size
print(grid_size) print(grid_size)
set_as_toplevel(true) set_as_toplevel(true)
update_grid_position() #update_grid_position()
##TODO: Can't seem to get first load grid snap not to happen.
grid_position = calculate_grid_position()
jump_to_grid_position()
print("Camera Set: ",grid_position, position) print("Camera Set: ",grid_position, position)
print("Ray Left: ", $Left.global_position, $Left.cast_to) print("Ray Left: ", $Left.global_position, $Left.cast_to)
func _physics_process(delta): func _physics_process(delta):
t += delta * 0.4
#print(parent.position.x) #print(parent.position.x)
update_grid_position() update_grid_position()
#draw_line( Vector2(0, -half_line_length), Vector2(0, half_line_length), color, 3.0) #draw_line( Vector2(0, -half_line_length), Vector2(0, half_line_length), color, 3.0)
@ -44,13 +50,62 @@ func update_grid_position():
# print("Oh God! No!") # print("Oh God! No!")
# if grid_position == new_grid_position: # if grid_position == new_grid_position:
# return # return
grid_position = new_grid_position # if the y value has changed we can flip transition the camera
jump_to_grid_position() ##TODO: this logic is working but I don't like it.
if grid_position.y != new_grid_position.y:
if !$Up.is_colliding() and grid_position.y > new_grid_position.y:
get_tree().paused = true
grid_position = new_grid_position
timer.start()
$Camera2D.smoothing_enabled = true
jump_to_grid_position()
#wait for stability.
player_node.global_translate(Vector2(0,-10))
var a_tenth_of_the_time = int((timer.time_left / timer.wait_time) * 10)
while a_tenth_of_the_time != 0:
#print(a_tenth_of_the_time)
var time_ticks = int((timer.time_left / timer.wait_time) * 10)
if time_ticks != a_tenth_of_the_time:
print("Shifting Player Downward :", a_tenth_of_the_time)
a_tenth_of_the_time = time_ticks
player_node.global_translate(Vector2(0,-5))
# WEIRD!? You have to add this at the end of a while loop or it gets stuck.
yield(get_tree(), "idle_frame")
#yield(timer, "timeout")
$Camera2D.smoothing_enabled = false
get_tree().paused = false
elif !$Down.is_colliding() and grid_position.y < new_grid_position.y:
get_tree().paused = true
grid_position = new_grid_position
timer.start()
$Camera2D.smoothing_enabled = true
jump_to_grid_position()
# FINALLY Got one that works. I tried all sorts of stuff to move this thing!?
var a_tenth_of_the_time = int((timer.time_left / timer.wait_time) * 10)
while a_tenth_of_the_time != 0:
#print(a_tenth_of_the_time)
var time_ticks = int((timer.time_left / timer.wait_time) * 10)
if time_ticks != a_tenth_of_the_time:
print("Shifting Player Downward :", a_tenth_of_the_time)
a_tenth_of_the_time = time_ticks
player_node.global_translate(Vector2(0,2))
# WEIRD!? You have to add this at the end of a while loop or it gets stuck.
yield(get_tree(), "idle_frame")
#yield(timer, "timeout")
$Camera2D.smoothing_enabled = false
get_tree().paused = false
else:
# Only allow horizontal camera moving
grid_position.x = new_grid_position.x
jump_to_grid_position()
else:
grid_position = new_grid_position
jump_to_grid_position()
#$Left.position = Vector2(grid_position * grid_size) #$Left.position = Vector2(grid_position * grid_size)
#print("Ray Left: ", $Left.global_position, $Left.cast_to) #print("Ray Left: ", $Left.global_position, $Left.cast_to)
func calculate_grid_position(): func calculate_grid_position() -> Vector2:
# this needs to heavily round off the parents position # this needs to heavily round off the parents position
var x_offset = floor(parent.player_position.x / grid_size.x) var x_offset = floor(parent.player_position.x / grid_size.x)
var y_offset = floor(parent.player_position.y / grid_size.y) var y_offset = floor(parent.player_position.y / grid_size.y)
@ -84,6 +139,16 @@ func jump_to_grid_position():
$Camera2D.limit_right = $Right.get_collision_point().x $Camera2D.limit_right = $Right.get_collision_point().x
else: else:
$Camera2D.limit_right = 10000000 $Camera2D.limit_right = 10000000
if $Up.is_colliding():
$Camera2D.limit_top = $Up.get_collision_point().y
else:
$Camera2D.limit_top = -10000000
if $Down.is_colliding():
$Camera2D.limit_bottom = $Down.get_collision_point().y
else:
$Camera2D.limit_bottom = 10000000
position = Vector2( x_pos ,grid_position.y * grid_size.y) position = Vector2( x_pos ,grid_position.y * grid_size.y)
#$Camera2D.force_update_scroll() #$Camera2D.force_update_scroll()
#position = Vector2( grid_position * grid_size) #position = Vector2( grid_position * grid_size)

View File

@ -0,0 +1,22 @@
extends Interactable
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var sprite: Sprite = $Sprite
const pickup = preload("res://src/Interactables/HealthPickup.tscn")
var opened := false
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
sprite.frame = 1
if !opened:
var chest_item = pickup.instance()
chest_item.global_position = global_position + Vector2(0,-50)
owner.add_child(chest_item)
opened = true

View File

@ -0,0 +1,21 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Chest.gd" type="Script" id=2]
[ext_resource path="res://assets/High Forest/Assets/Interior-01.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
[node name="Chest" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="." index="0"]
texture = ExtResource( 3 )
vframes = 2
region_enabled = true
region_rect = Rect2( 49, 80, 30, 64 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
modulate = Color( 0.0313726, 1, 0, 1 )
position = Vector2( 0, 3 )
shape = SubResource( 1 )

14
src/Interactables/Door.gd Normal file
View File

@ -0,0 +1,14 @@
extends Interactable
onready var door_animation: AnimatedSprite = $AnimatedSprite
func trigger_interaction():
door_animation.play("default")
yield( door_animation, "animation_finished")
$StaticBody2D/CollisionShape2D.disabled = true
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
pass

View File

@ -0,0 +1,68 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Interactables/Door.gd" type="Script" id=2]
[ext_resource path="res://assets/mmz1_door.png" type="Texture" id=3]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 3 )
region = Rect2( 34, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 3 )
region = Rect2( 68, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 3 )
region = Rect2( 102, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 3 )
region = Rect2( 136, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 3 )
region = Rect2( 170, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 3 )
region = Rect2( 204, 0, 34, 94 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 3 )
region = Rect2( 238, 0, 34, 94 )
[sub_resource type="SpriteFrames" id=9]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ],
"loop": false,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=10]
extents = Vector2( 40, 21 )
[sub_resource type="RectangleShape2D" id=11]
extents = Vector2( 19, 39 )
[node name="Door" instance=ExtResource( 1 )]
collision_layer = 0
collision_mask = 2
script = ExtResource( 2 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = SubResource( 9 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
modulate = Color( 0, 1, 0.0392157, 1 )
shape = SubResource( 10 )
[node name="StaticBody2D" type="StaticBody2D" parent="." index="2"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" index="0"]
shape = SubResource( 11 )

View File

@ -0,0 +1,28 @@
class_name HealthPickup
extends Interactable
onready var health_icon: AnimatedSprite = $AnimatedSprite
onready var drop_raycast: RayCast2D = $RayCast2D
func _ready():
#gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
gravity = 90
# Doesn't get enabled until it drops
monitoring = false
func _physics_process(delta):
if drop_raycast.is_colliding() == false:
var velocity = Vector2(0,0)
position.y += delta * gravity
else:
monitoring = true
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
queue_free()

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Interactables/HealthPickup.gd" type="Script" id=1]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Interactables/QuickHealthPickup.tres" type="SpriteFrames" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 6.0
[node name="HealthPickup" instance=ExtResource( 2 )]
monitoring = false
script = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="." index="0"]
frames = ExtResource( 3 )
frame = 2
playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
shape = SubResource( 1 )
[node name="RayCast2D" type="RayCast2D" parent="." index="2"]
enabled = true
cast_to = Vector2( 0, 8 )
collision_mask = 3

View File

@ -0,0 +1,27 @@
[gd_resource type="SpriteFrames" load_steps=6 format=2]
[ext_resource path="res://assets/quick_health.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 15, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 30, 0, 15, 13 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 45, 0, 15, 13 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]

19
src/Level.gd Normal file
View File

@ -0,0 +1,19 @@
class_name Level
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var player_start = $PlayerStart
# Called when the node enters the scene tree for the first time.
func _ready():
LevelInfo.player_start_position = player_start
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

187
src/Levels/Level.tscn Normal file

File diff suppressed because one or more lines are too long

104
src/Levels/Level2.tscn Normal file
View File

@ -0,0 +1,104 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2]
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=3]
[ext_resource path="res://assets/Tiles/Assets/Sprite-0002.png" type="Texture" id=4]
[ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=6]
[ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7]
[sub_resource type="TileSet" id=1]
[sub_resource type="TileSet" id=2]
0/name = "Sprite-0002.png 0"
0/texture = ExtResource( 4 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 144, 128 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape_one_way = false
0/shape_one_way_margin = 0.0
0/shapes = [ ]
0/z_index = 0
[node name="Level" type="Node2D"]
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
scroll_base_scale = Vector2( 0.4, 1 )
scroll_limit_end = Vector2( 1300, 0 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_mirroring = Vector2( 500, 0 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[node name="Bgmuck" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 3 )
centered = false
__meta__ = {
"_edit_lock_": true
}
[node name="Background TileMap" type="TileMap" parent="."]
z_index = -1
tile_set = SubResource( 1 )
cell_size = Vector2( 16, 16 )
format = 1
tile_data = PoolIntArray( 47, 0, 327682, 48, 0, 327682, 49, 0, 327682, 50, 0, 327682, 51, 0, 327682, 52, 0, 327682, 65582, 0, 196608, 65583, 0, 327682, 65584, 0, 327682, 65585, 0, 327682, 65586, 0, 327682, 65587, 0, 327682, 65588, 0, 327682, 131118, 0, 196608, 131119, 0, 327683, 131120, 0, 327682, 131121, 0, 327683, 131122, 0, 327683, 131123, 0, 327683, 131124, 0, 327683, 196655, 0, 327683, 196656, 0, 327682, 196657, 0, 327682, 196658, 0, 327683, 196659, 0, 327683, 196660, 0, 327683, 262191, 0, 327682, 262192, 0, 327682, 262193, 0, 327683, 262194, 0, 327682, 262195, 0, 327682, 262196, 0, 327682, 327727, 0, 327683, 327728, 0, 327683, 327729, 0, 327683, 327730, 0, 327683, 327731, 0, 327682, 327732, 0, 327682, 393263, 0, 327682, 393264, 0, 327682, 393265, 0, 327683, 393266, 0, 327682, 393267, 0, 327682, 393268, 0, 327682, 458799, 0, 327682, 458800, 0, 327682, 458801, 0, 327682, 458802, 0, 327682, 458803, 0, 327682, 458804, 0, 327683, 524335, 0, 327682, 524336, 0, 327682, 524337, 0, 327683, 524338, 0, 327683, 524339, 0, 327683, 524340, 0, 327683, 589871, 0, 327682, 589872, 0, 327682, 589873, 0, 327683, 589874, 0, 327683, 589875, 0, 327683, 589876, 0, 327683 )
__meta__ = {
"_edit_lock_": true
}
[node name="Collision TileMap" type="TileMap" parent="."]
tile_set = SubResource( 2 )
cell_size = Vector2( 16, 16 )
show_collision = true
format = 1
__meta__ = {
"_edit_lock_": true
}
[node name="Foreground TileMap" type="TileMap" parent="."]
z_index = 1
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
format = 1
tile_data = PoolIntArray( -131044, 0, 262152, -65508, 0, 262152, 28, 0, 262152, 44, 0, 262145, 45, 0, 262146, 46, 0, 262146, 47, 0, 262147, 65564, 0, 262152, 65581, 0, 327685, 65582, 0, 327686, 65583, 0, 327687, 131100, 0, 262152, 131118, 0, 327688, 196636, 0, 262152, 196654, 0, 327688, 262190, 0, 327688, 327726, 0, 327688, 393262, 0, 327688, 458798, 0, 327690, 589827, 0, 262148, 589828, 0, 262149, 589829, 0, 262149, 589830, 0, 262149, 589831, 0, 262151 )
__meta__ = {
"_edit_lock_": true
}
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
[node name="EnemyC" parent="." instance=ExtResource( 7 )]
position = Vector2( 394, 47 )
__meta__ = {
"_edit_lock_": true
}
[node name="EnemyC2" parent="." instance=ExtResource( 7 )]
position = Vector2( 492, 27 )
__meta__ = {
"_edit_lock_": true
}
[node name="ActorTemplate" parent="." instance=ExtResource( 1 )]
position = Vector2( 262, 44 )
__meta__ = {
"_edit_lock_": true
}
actor_type = "NPC"

291
src/Levels/Level3.tscn Normal file
View File

@ -0,0 +1,291 @@
[gd_scene load_steps=20 format=2]
[ext_resource path="res://src/Level.gd" type="Script" id=1]
[ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2]
[ext_resource path="res://assets/High Forest/Background/Background.png" type="Texture" id=3]
[ext_resource path="res://assets/High Forest/Assets/Tiles.png" type="Texture" id=4]
[ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=6]
[ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7]
[sub_resource type="TileSet" id=1]
[sub_resource type="ConvexPolygonShape2D" id=13]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=14]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=16]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=17]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=18]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=19]
points = PoolVector2Array( 0, 16, 16, 8.56219, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=20]
points = PoolVector2Array( 0, 8.40067, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=21]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=22]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=23]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=24]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="TileSet" id=11]
0/name = "Tiles.png 0"
0/texture = ExtResource( 4 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 80, 80 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 13 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 16 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 17 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 18 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
1/name = "Tiles.png 1"
1/texture = ExtResource( 4 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 0, 80, 80, 80 )
1/tile_mode = 2
1/autotile/icon_coordinate = Vector2( 0, 0 )
1/autotile/tile_size = Vector2( 16, 16 )
1/autotile/spacing = 0
1/autotile/occluder_map = [ ]
1/autotile/navpoly_map = [ ]
1/autotile/priority_map = [ ]
1/autotile/z_index_map = [ ]
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shape_offset = Vector2( 0, 0 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
1/shape_one_way = false
1/shape_one_way_margin = 0.0
1/shapes = [ ]
1/z_index = 0
2/name = "Tiles.png 2"
2/texture = ExtResource( 4 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 80, 0, 64, 48 )
2/tile_mode = 2
2/autotile/icon_coordinate = Vector2( 0, 0 )
2/autotile/tile_size = Vector2( 16, 16 )
2/autotile/spacing = 0
2/autotile/occluder_map = [ ]
2/autotile/navpoly_map = [ ]
2/autotile/priority_map = [ ]
2/autotile/z_index_map = [ ]
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape = SubResource( 19 )
2/shape_one_way = false
2/shape_one_way_margin = 1.0
2/shapes = [ {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 19 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 20 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
2/z_index = 0
3/name = "Tiles.png 3"
3/texture = ExtResource( 4 )
3/tex_offset = Vector2( 0, 0 )
3/modulate = Color( 1, 1, 1, 1 )
3/region = Rect2( 64, 160, 96, 48 )
3/tile_mode = 2
3/autotile/icon_coordinate = Vector2( 0, 0 )
3/autotile/tile_size = Vector2( 16, 16 )
3/autotile/spacing = 0
3/autotile/occluder_map = [ ]
3/autotile/navpoly_map = [ ]
3/autotile/priority_map = [ ]
3/autotile/z_index_map = [ ]
3/occluder_offset = Vector2( 0, 0 )
3/navigation_offset = Vector2( 0, 0 )
3/shape_offset = Vector2( 0, 0 )
3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
3/shape_one_way = false
3/shape_one_way_margin = 0.0
3/shapes = [ ]
3/z_index = 0
4/name = "Tiles.png 4"
4/texture = ExtResource( 4 )
4/tex_offset = Vector2( 0, 0 )
4/modulate = Color( 1, 1, 1, 1 )
4/region = Rect2( 80, 48, 48, 64 )
4/tile_mode = 2
4/autotile/icon_coordinate = Vector2( 0, 0 )
4/autotile/tile_size = Vector2( 16, 16 )
4/autotile/spacing = 0
4/autotile/occluder_map = [ ]
4/autotile/navpoly_map = [ ]
4/autotile/priority_map = [ ]
4/autotile/z_index_map = [ ]
4/occluder_offset = Vector2( 0, 0 )
4/navigation_offset = Vector2( 0, 0 )
4/shape_offset = Vector2( 0, 0 )
4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
4/shape = SubResource( 21 )
4/shape_one_way = false
4/shape_one_way_margin = 1.0
4/shapes = [ {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 21 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 22 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 23 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 24 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
4/z_index = 0
[node name="Level3" type="Node2D"]
script = ExtResource( 1 )
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
scroll_base_scale = Vector2( 0.4, 1 )
scroll_limit_end = Vector2( 1300, 0 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_mirroring = Vector2( 500, 0 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[node name="Bgmuck" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 3 )
centered = false
__meta__ = {
"_edit_lock_": true
}
[node name="Background TileMap" type="TileMap" parent="."]
z_index = -1
tile_set = SubResource( 1 )
cell_size = Vector2( 16, 16 )
format = 1
tile_data = PoolIntArray( 47, 0, 327682, 48, 0, 327682, 49, 0, 327682, 50, 0, 327682, 51, 0, 327682, 52, 0, 327682, 65582, 0, 196608, 65583, 0, 327682, 65584, 0, 327682, 65585, 0, 327682, 65586, 0, 327682, 65587, 0, 327682, 65588, 0, 327682, 131118, 0, 196608, 131119, 0, 327683, 131120, 0, 327682, 131121, 0, 327683, 131122, 0, 327683, 131123, 0, 327683, 131124, 0, 327683, 196655, 0, 327683, 196656, 0, 327682, 196657, 0, 327682, 196658, 0, 327683, 196659, 0, 327683, 196660, 0, 327683, 262191, 0, 327682, 262192, 0, 327682, 262193, 0, 327683, 262194, 0, 327682, 262195, 0, 327682, 262196, 0, 327682, 327727, 0, 327683, 327728, 0, 327683, 327729, 0, 327683, 327730, 0, 327683, 327731, 0, 327682, 327732, 0, 327682, 393263, 0, 327682, 393264, 0, 327682, 393265, 0, 327683, 393266, 0, 327682, 393267, 0, 327682, 393268, 0, 327682, 458799, 0, 327682, 458800, 0, 327682, 458801, 0, 327682, 458802, 0, 327682, 458803, 0, 327682, 458804, 0, 327683, 524335, 0, 327682, 524336, 0, 327682, 524337, 0, 327683, 524338, 0, 327683, 524339, 0, 327683, 524340, 0, 327683, 589871, 0, 327682, 589872, 0, 327682, 589873, 0, 327683, 589874, 0, 327683, 589875, 0, 327683, 589876, 0, 327683 )
__meta__ = {
"_edit_lock_": true
}
[node name="Collision TileMap" type="TileMap" parent="."]
tile_set = SubResource( 11 )
cell_size = Vector2( 16, 16 )
show_collision = true
format = 1
tile_data = PoolIntArray( 196636, 4, 131072, 196637, 4, 131073, 196638, 4, 131073, 196639, 4, 131073, 196640, 4, 131073, 196641, 4, 131073, 196642, 4, 131073, 196643, 4, 131074, 262172, 4, 196608, 262173, 4, 196609, 262174, 4, 196609, 262175, 4, 196609, 262176, 4, 196609, 262177, 4, 196609, 262178, 4, 196609, 262179, 4, 196610, 458770, 2, 1, 458771, 0, 1, 458772, 0, 2, 458773, 0, 3, 458774, 0, 1, 458775, 0, 2, 458776, 0, 3, 458777, 4, 2, 458778, 0, 1, 458779, 0, 2, 458780, 0, 3, 458781, 0, 1, 458782, 0, 2, 458783, 0, 3, 458784, 4, 2, 458785, 0, 1, 458786, 0, 2, 458787, 0, 3, 458788, 0, 1, 458789, 0, 2, 458790, 0, 3, 458791, 4, 2, 458792, 0, 4, 458796, 0, 3, 458797, 0, 1, 458798, 0, 2, 458799, 0, 3, 458800, 0, 1, 458801, 0, 2, 458802, 0, 3, 458803, 0, 1, 458804, 0, 2, 458805, 0, 3, 458806, 0, 1, 458807, 0, 2, 458808, 0, 3, 524304, 2, 1, 524305, 2, 65536, 524306, 2, 65537, 524307, 0, 65537, 524308, 0, 65538, 524309, 0, 65539, 524310, 0, 65537, 524311, 0, 65538, 524312, 0, 65539, 524313, 4, 65538, 524314, 0, 65537, 524315, 0, 65538, 524316, 0, 65539, 524317, 0, 65537, 524318, 0, 65538, 524319, 0, 65539, 524320, 4, 65538, 524321, 0, 65537, 524322, 0, 65538, 524323, 0, 65539, 524324, 0, 65537, 524325, 0, 65538, 524326, 0, 65539, 524327, 4, 65538, 524328, 0, 65540, 524332, 0, 65536, 524333, 0, 65537, 524334, 0, 65538, 524335, 0, 65539, 524336, 0, 65537, 524337, 0, 65538, 524338, 0, 65539, 524339, 0, 65537, 524340, 0, 65538, 524341, 0, 65539, 524342, 0, 65537, 524343, 0, 65538, 524344, 0, 65539, 589826, 0, 0, 589827, 0, 1, 589828, 0, 2, 589829, 0, 3, 589830, 0, 1, 589831, 0, 2, 589832, 0, 3, 589833, 0, 1, 589834, 0, 2, 589835, 0, 3, 589836, 0, 1, 589837, 0, 2, 589838, 0, 3, 589839, 2, 65536, 589840, 2, 65537, 589841, 2, 131072, 589842, 2, 131073, 589843, 0, 131073, 589844, 0, 131074, 589845, 0, 131075, 589846, 0, 131073, 589847, 0, 131074, 589848, 0, 131075, 589849, 0, 131074, 589850, 0, 131073, 589851, 0, 131074, 589852, 0, 131075, 589853, 0, 131073, 589854, 0, 131074, 589855, 0, 131075, 589856, 0, 131074, 589857, 0, 131073, 589858, 0, 131074, 589859, 0, 131075, 589860, 0, 131073, 589861, 0, 131074, 589862, 0, 131075, 589863, 0, 131074, 589864, 0, 131076, 589868, 0, 131072, 589869, 0, 131073, 589870, 0, 131074, 589871, 0, 131075, 589872, 0, 131073, 589873, 0, 131074, 589874, 0, 131075, 589875, 0, 131073, 589876, 0, 131074, 589877, 0, 131075, 589878, 0, 131073, 589879, 0, 131074, 589880, 0, 131075, 655362, 0, 65536, 655363, 0, 65537, 655364, 0, 65538, 655365, 0, 65539, 655366, 0, 65537, 655367, 0, 65538, 655368, 0, 65539, 655369, 0, 65537, 655370, 0, 65538, 655371, 0, 65539, 655372, 0, 65537, 655373, 0, 65538, 655374, 0, 65539, 655375, 2, 131072, 655376, 2, 131073, 655377, 4, 0, 655378, 4, 1, 655379, 0, 196610, 655380, 0, 196610, 655381, 0, 196610, 655382, 0, 196610, 655383, 0, 196610, 655384, 0, 196610, 655385, 0, 196610, 655386, 0, 196610, 655387, 0, 196610, 655388, 0, 196610, 655389, 0, 196610, 655390, 0, 196610, 655391, 0, 196610, 655392, 0, 196610, 655393, 0, 196610, 655394, 0, 196610, 655395, 0, 196610, 655396, 0, 196610, 655397, 0, 196610, 655398, 0, 196610, 655399, 0, 196610, 655400, 0, 196612, 655404, 0, 196608, 655405, 0, 196610, 655406, 0, 196610, 655407, 0, 196610, 655408, 0, 196610, 655409, 0, 196610, 655410, 0, 196610, 655411, 0, 196610, 655412, 0, 196610, 655413, 0, 196610, 655414, 0, 196610, 655415, 0, 196610, 655416, 0, 196610, 720898, 0, 131072, 720899, 0, 131073, 720900, 0, 131074, 720901, 0, 131075, 720902, 0, 131073, 720903, 0, 131074, 720904, 0, 131075, 720905, 0, 131073, 720906, 0, 131074, 720907, 0, 131075, 720908, 0, 131073, 720909, 0, 131074, 720910, 0, 131075, 720911, 4, 0, 720912, 4, 1, 720913, 0, 196610, 720914, 0, 196610, 720915, 0, 196610, 720916, 0, 196610, 720917, 0, 196610, 720918, 0, 196610, 720919, 0, 196610, 720920, 0, 196610, 720921, 0, 196610, 720922, 0, 196610, 720923, 0, 196610, 720924, 0, 196610, 720925, 0, 196610, 720926, 0, 196610, 720927, 0, 196610, 720928, 0, 196610, 720929, 0, 196610, 720930, 0, 196610, 720931, 0, 196610, 720932, 0, 196610, 720933, 0, 196610, 720934, 0, 196610, 720935, 0, 262147, 720936, 0, 262148, 720940, 0, 262144, 720941, 0, 262145, 720942, 0, 262146, 720943, 0, 262147, 720944, 0, 262145, 720945, 0, 262146, 720946, 0, 262147, 720947, 0, 262145, 720948, 0, 262146, 720949, 0, 262147, 720950, 0, 262145, 720951, 0, 262146, 720952, 0, 262147 )
__meta__ = {
"_edit_lock_": true
}
[node name="Foreground TileMap" type="TileMap" parent="."]
z_index = 1
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
format = 1
tile_data = PoolIntArray( -131044, 0, 262152, -65508, 0, 262152, 28, 0, 262152, 44, 0, 262145, 45, 0, 262146, 46, 0, 262146, 47, 0, 262147, 65564, 0, 262152, 65581, 0, 327685, 65582, 0, 327686, 65583, 0, 327687, 131100, 0, 262152, 131118, 0, 327688, 196636, 0, 262152, 196654, 0, 327688, 262190, 0, 327688, 327726, 0, 327688, 393262, 0, 327688, 458798, 0, 327690, 589827, 0, 262148, 589828, 0, 262149, 589829, 0, 262149, 589830, 0, 262149, 589831, 0, 262151 )
__meta__ = {
"_edit_lock_": true
}
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
[node name="EnemyC" parent="." instance=ExtResource( 7 )]
position = Vector2( 394, 47 )
__meta__ = {
"_edit_lock_": true
}
[node name="EnemyC2" parent="." instance=ExtResource( 7 )]
position = Vector2( 492, 27 )
__meta__ = {
"_edit_lock_": true
}
[node name="EnemyC3" parent="." instance=ExtResource( 7 )]
position = Vector2( 796, 89 )
[node name="PlayerStart" type="Position2D" parent="."]
position = Vector2( 89, 103 )

View File

@ -34,7 +34,7 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
$Debug.text = UiManager.debug_text
if (UiManager.current_pane != current_pane): if (UiManager.current_pane != current_pane):
print("UI Switch detected") print("UI Switch detected")
current_pane = UiManager.current_pane current_pane = UiManager.current_pane

View File

@ -4,7 +4,7 @@ extends KinematicBody2D
#var velocity = Vector2(0,0) #var velocity = Vector2(0,0)
#var direction = Vector2(-1,0) #var direction = Vector2(-1,0)
export(String, "Player", "Enemy", "NPC") var actor_type export(String, "Player", "Enemy", "NPC", "Object") var actor_type
#export var sprite_facing_right: bool = true #export var sprite_facing_right: bool = true
export(Array, Resource) var SoundEffects export(Array, Resource) var SoundEffects
export var debug_actor: bool = false export var debug_actor: bool = false

View File

@ -0,0 +1,52 @@
extends Area2D
var modifier_type = 0
export var modifier_name :String = ''
var animation_name: String = '' # Not using this one
var timeout_seconds: float = 0.0 # Not doing timeout based ones yet either.
export var directional_modifier: bool = false
export var move_speed: float = 0.0
export var move_acceleration: float = 0.0
export var move_speed_modifier: float = 0.0
export var move_modifier_move_acceleration: float = 0.0
export var jerk_factor: float = 0
export var gravity_modifier: int = 0
#var state_timeout: Timer
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var modifier :StateModifier
#var modifier_properties: ModifierProperties
# Called when the node enters the scene tree for the first time.
func _ready():
modifier = StateModifier.new()
modifier.ready( modifier_name, animation_name , modifier.TYPE.NONE, timeout_seconds)
modifier.modifier_properties = ModifierProperties.new( move_speed,
gravity_modifier,
move_acceleration,
move_speed_modifier,
move_modifier_move_acceleration,
jerk_factor)
print("Debug Direction property shy are you stopid?! ", directional_modifier)
modifier.modifier_properties.directional_modifier = directional_modifier
func _on_Modifier_Component_body_entered(body):
var colliding_node = body
if colliding_node.has_node("Modifier_Receiver"):
colliding_node.get_node("Modifier_Receiver").register_modifier(modifier)
func _on_Modifier_Component_body_exited(body):
var colliding_node = body
if colliding_node.has_node("Modifier_Receiver"):
colliding_node.get_node("Modifier_Receiver").remove_modifier(modifier)

View File

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Modifier_Component.gd" type="Script" id=1]
[node name="Modifier_Component" type="Area2D"]
script = ExtResource( 1 )
[connection signal="body_entered" from="." to="." method="_on_Modifier_Component_body_entered"]
[connection signal="body_exited" from="." to="." method="_on_Modifier_Component_body_exited"]

View File

@ -0,0 +1,53 @@
class_name Modifier_Receiver
extends Node2D
# This may be stupid but we're going to have two kinds of callbacks here.
# It's going to be up to the parent/actor/kinematicbody2d/whatever to know
# what conditions have to be met before being able to call that interactible's
# function.
# This is a nice and generic interface that I might be able to use for
# things like opening doors in a level, opening chests/flipping switches etc.
# This node can keep an array of various interactibles within a level
# and provide several helper functions for managing them perhaps.
export(String) var modifier_parent_callback = ""
export var debug_receiver :bool = false
var call_function: FuncRef
#var interactable_function_callables = []
var modifier_collection = []
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
##NOTE:
## Call function should be implemented as two parameters, one expecting a modifier
## and the other expecting a boolean as to whether its being added
# Called when the node enters the scene tree for the first time.
func _ready():
if modifier_parent_callback:
call_function = funcref(owner, modifier_parent_callback)
else:
print("Warning: No modifier receiver function defined on ", owner.name)
# Switching to a new model that starts with Hitbox
func register_modifier(modifier: StateModifier):
if modifier_collection.has(modifier) == false:
print("New Modifier Registered " + modifier.name)
modifier_collection.append(modifier)
if call_function.is_valid():
call_function.call_func(modifier, true)
func remove_modifier(modifier):
print("Modifier Removal " + modifier.name)
if modifier_collection.has(modifier):
var modifier_index = modifier_collection.rfind(modifier)
if modifier_index != -1:
modifier_collection.remove(modifier_index)
if call_function.is_valid():
call_function.call_func(modifier, false)

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/components/Modifier_Receiver.gd" type="Script" id=1]
[node name="Modifier_Receiver" type="Node2D"]
script = ExtResource( 1 )

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=33 format=2] [gd_scene load_steps=34 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/enemyC/enemyC_movement_component.gd" type="Script" id=2] [ext_resource path="res://src/enemyC/enemyC_movement_component.gd" type="Script" id=2]
@ -122,6 +122,9 @@ extents = Vector2( 9, 3.5 )
[sub_resource type="CapsuleShape2D" id=24] [sub_resource type="CapsuleShape2D" id=24]
height = 10.0 height = 10.0
[sub_resource type="RectangleShape2D" id=25]
extents = Vector2( 10.5, 17.5 )
[node name="EnemyC" instance=ExtResource( 1 )] [node name="EnemyC" instance=ExtResource( 1 )]
script = ExtResource( 6 ) script = ExtResource( 6 )
actor_type = "Enemy" actor_type = "Enemy"
@ -130,7 +133,7 @@ actor_type = "Enemy"
position = Vector2( 11, -7 ) position = Vector2( 11, -7 )
frames = SubResource( 20 ) frames = SubResource( 20 )
animation = "idle" animation = "idle"
frame = 1 frame = 2
__meta__ = { __meta__ = {
"_aseprite_wizard_config_": { "_aseprite_wizard_config_": {
"layer": "", "layer": "",
@ -144,10 +147,7 @@ __meta__ = {
} }
} }
[node name="CollisionShape2D" parent="." index="1"] [node name="movement_component" parent="." index="1"]
position = Vector2( -0.5, -2 )
[node name="movement_component" parent="." index="2"]
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="IdleTimeout" type="Timer" parent="movement_component" index="0"] [node name="IdleTimeout" type="Timer" parent="movement_component" index="0"]
@ -189,14 +189,14 @@ timeout_seconds = 0.5
move_speed = -5.0 move_speed = -5.0
animation_sequence = [ "death" ] animation_sequence = [ "death" ]
[node name="Hurtbox_Component" parent="." index="4"] [node name="Hurtbox_Component" parent="." index="3"]
hurtbox_entered_function = "enemyHit" hurtbox_entered_function = "enemyHit"
[node name="CollisionShape2D" parent="Hurtbox_Component" index="0"] [node name="CollisionShape2D" parent="Hurtbox_Component" index="0"]
position = Vector2( -1, -2 ) position = Vector2( -1, -2 )
shape = SubResource( 22 ) shape = SubResource( 22 )
[node name="EdgeDetection" type="RayCast2D" parent="." index="6"] [node name="EdgeDetection" type="RayCast2D" parent="." index="5"]
modulate = Color( 0.054902, 1, 0, 1 ) modulate = Color( 0.054902, 1, 0, 1 )
show_behind_parent = true show_behind_parent = true
position = Vector2( 15, 3 ) position = Vector2( 15, 3 )
@ -204,12 +204,12 @@ enabled = true
cast_to = Vector2( 0, 17 ) cast_to = Vector2( 0, 17 )
collide_with_areas = true collide_with_areas = true
[node name="PlayerDetection" type="RayCast2D" parent="." index="7"] [node name="PlayerDetection" type="RayCast2D" parent="." index="6"]
enabled = true enabled = true
cast_to = Vector2( 21, 0 ) cast_to = Vector2( 21, 0 )
collision_mask = 2 collision_mask = 2
[node name="Hitbox_Component" parent="." index="8" instance=ExtResource( 4 )] [node name="Hitbox_Component" parent="." index="7" instance=ExtResource( 4 )]
damage_amount = 10 damage_amount = 10
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox_Component" index="0"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox_Component" index="0"]
@ -218,16 +218,20 @@ position = Vector2( 18, -8.5 )
shape = SubResource( 23 ) shape = SubResource( 23 )
disabled = true disabled = true
[node name="GenericSender" parent="." index="9" instance=ExtResource( 5 )] [node name="GenericSender" parent="." index="8" instance=ExtResource( 5 )]
receiver_node_name = "GenericReceiver" receiver_node_name = "GenericReceiver"
[node name="CollisionShape2D" type="CollisionShape2D" parent="GenericSender" index="0"] [node name="CollisionShape2D" type="CollisionShape2D" parent="GenericSender" index="0"]
position = Vector2( 48, 0 ) position = Vector2( 48, 0 )
shape = SubResource( 24 ) shape = SubResource( 24 )
[node name="Health_Component" parent="." index="10" instance=ExtResource( 7 )] [node name="Health_Component" parent="." index="9" instance=ExtResource( 7 )]
max_health = 20 max_health = 20
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="10"]
position = Vector2( -0.5, -1.5 )
shape = SubResource( 25 )
[connection signal="frame_reached" from="movement_state_machine/attack" to="." method="_on_attack_frame_reached"] [connection signal="frame_reached" from="movement_state_machine/attack" to="." method="_on_attack_frame_reached"]
[connection signal="state_exited" from="movement_state_machine/attack" to="." method="_on_attack_state_exited"] [connection signal="state_exited" from="movement_state_machine/attack" to="." method="_on_attack_state_exited"]
[connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"] [connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"]

View File

@ -17,6 +17,11 @@ var current_movement_state:String
# Since animactor state machine can actually view properties from this type # Since animactor state machine can actually view properties from this type
# I'm thinking about moving the velocity tracker in here instead of player. # I'm thinking about moving the velocity tracker in here instead of player.
var velocity = Vector2(0,0) var velocity = Vector2(0,0)
var momentum = Vector2(0,0)
var acceleration = Vector2(0,0)
var sim_velocity = Vector2(0,0)
#Can't use floats here, switched to constants. #Can't use floats here, switched to constants.
#enum directions {UP = -1, DOWN = 1, LEFT, RIGHT} #enum directions {UP = -1, DOWN = 1, LEFT, RIGHT}
@ -69,3 +74,9 @@ func wants_dash() -> bool:
func wants_roll() -> bool: func wants_roll() -> bool:
return false return false
func wants_climb() -> bool:
return false
func get_climb_shape_location() -> Vector2:
return Vector2(-1,-1)

View File

@ -9,6 +9,7 @@ onready var gun = $Gun
func _ready() -> void: func _ready() -> void:
PlayerInfo.player_health = $Health_Component.health PlayerInfo.player_health = $Health_Component.health
global_position = LevelInfo.player_start_position.transform.origin
movement_component.player_number = player_number movement_component.player_number = player_number
@ -21,9 +22,29 @@ func hit_Receiver(damage):
if $Health_Component.health > 0: if $Health_Component.health > 0:
movement_state_machine.change_state($movement_state_machine/hurt) movement_state_machine.change_state($movement_state_machine/hurt)
PlayerInfo.player_health = $Health_Component.health PlayerInfo.player_health = $Health_Component.health
if PlayerInfo.player_health <= 0:
return
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout") yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
$Hurtbox_Component.set_hurtbox(true) $Hurtbox_Component.set_hurtbox(true)
func receive_modifier(incomming_modifier :StateModifier, is_adding_modifier_operation: bool):
#var mod :StateModifier
if is_adding_modifier_operation:
print("Player Received modifier:", incomming_modifier.name)
if movement_state_machine.current_state is StateAnimatedActor:
movement_state_machine.current_state.physics_modifier = incomming_modifier
else:
print("Player Removed modifier:", incomming_modifier.name)
if movement_state_machine.current_state is StateAnimatedActor:
movement_state_machine.current_state.physics_modifier = null
func touch_the_thing(the_thing: Interactable) -> bool:
print("You see! a THING...", the_thing.name)
if the_thing is HealthPickup:
# Do some healthy stuff.
the_thing.trigger_interaction()
return false
return true
func _on_attack_do_attack(): func _on_attack_do_attack():
var is_shooting = false var is_shooting = false
@ -33,4 +54,18 @@ func _on_attack_do_attack():
func _on_Health_Component_health_depleted(): func _on_Health_Component_health_depleted():
queue_free() $Hurtbox_Component.set_hurtbox(false)
movement_state_machine.change_state($movement_state_machine/die)
yield( get_tree().create_timer(10), "timeout")
#queue_free()
func _on_roll_frame_reached(state_name, animation_name, frame_number):
print("I'm invincible!!!")
$Hurtbox_Component.set_hurtbox(false)
func _on_roll_state_exited():
print("Nevermind. I'm vulnerable.")
$Hurtbox_Component.set_hurtbox(true)
func _on_die_state_entered():
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=117 format=2] [gd_scene load_steps=127 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/playerD/movement_component.gd" type="Script" id=2] [ext_resource path="res://src/playerD/movement_component.gd" type="Script" id=2]
@ -8,480 +8,535 @@
[ext_resource path="res://src/playerD/states/fall.gd" type="Script" id=6] [ext_resource path="res://src/playerD/states/fall.gd" type="Script" id=6]
[ext_resource path="res://src/components/Health_Component.tscn" type="PackedScene" id=7] [ext_resource path="res://src/components/Health_Component.tscn" type="PackedScene" id=7]
[ext_resource path="res://src/playerD/states/jump.gd" type="Script" id=8] [ext_resource path="res://src/playerD/states/jump.gd" type="Script" id=8]
[ext_resource path="res://src/state_modifier.gd" type="Script" id=9] [ext_resource path="res://src/components/Modifier_Receiver.tscn" type="PackedScene" id=9]
[ext_resource path="res://src/playerD/states/attack.gd" type="Script" id=10] [ext_resource path="res://src/playerD/states/attack.gd" type="Script" id=10]
[ext_resource path="res://src/playerD/states/dash.gd" type="Script" id=11] [ext_resource path="res://src/playerD/states/dash.gd" type="Script" id=11]
[ext_resource path="res://src/playerD/states/hurt.gd" type="Script" id=12] [ext_resource path="res://src/playerD/states/hurt.gd" type="Script" id=12]
[ext_resource path="res://src/Gun.gd" type="Script" id=13] [ext_resource path="res://src/Gun.gd" type="Script" id=13]
[ext_resource path="res://src/playerD/states/roll.gd" type="Script" id=14] [ext_resource path="res://src/playerD/states/roll.gd" type="Script" id=14]
[ext_resource path="res://src/playerD/states/die.gd" type="Script" id=15]
[ext_resource path="res://src/templates/Interactable/Interactable_Receiver.gd" type="Script" id=16]
[ext_resource path="res://src/playerD/states/climb.gd" type="Script" id=17]
[sub_resource type="RectangleShape2D" id=197]
extents = Vector2( 13, 18.5 )
[sub_resource type="StreamTexture" id=90] [sub_resource type="StreamTexture" id=90]
load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex" load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex"
[sub_resource type="AtlasTexture" id=91] [sub_resource type="AtlasTexture" id=91]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 1120, 240, 160 ) region = Rect2( 1680, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=92] [sub_resource type="AtlasTexture" id=92]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 1120, 240, 160 ) region = Rect2( 1920, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=93] [sub_resource type="AtlasTexture" id=93]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 1120, 240, 160 ) region = Rect2( 2160, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=94] [sub_resource type="AtlasTexture" id=94]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 1120, 240, 160 ) region = Rect2( 2400, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=95] [sub_resource type="AtlasTexture" id=95]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 1120, 240, 160 ) region = Rect2( 0, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=96] [sub_resource type="AtlasTexture" id=96]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 1120, 240, 160 ) region = Rect2( 240, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=97] [sub_resource type="AtlasTexture" id=97]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 1120, 240, 160 ) region = Rect2( 1440, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=98] [sub_resource type="AtlasTexture" id=98]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 1120, 240, 160 ) region = Rect2( 480, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=99] [sub_resource type="AtlasTexture" id=99]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 1120, 240, 160 ) region = Rect2( 480, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=100] [sub_resource type="AtlasTexture" id=100]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 1120, 240, 160 ) region = Rect2( 720, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=101] [sub_resource type="AtlasTexture" id=101]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 160, 240, 160 ) region = Rect2( 960, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=102] [sub_resource type="AtlasTexture" id=102]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 160, 240, 160 ) region = Rect2( 1200, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=103] [sub_resource type="AtlasTexture" id=103]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 160, 240, 160 ) region = Rect2( 1440, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=104] [sub_resource type="AtlasTexture" id=104]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 160, 240, 160 ) region = Rect2( 240, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=105] [sub_resource type="AtlasTexture" id=105]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 160, 240, 160 ) region = Rect2( 480, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=106] [sub_resource type="AtlasTexture" id=106]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 0, 240, 160 ) region = Rect2( 720, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=107] [sub_resource type="AtlasTexture" id=107]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 0, 240, 160 ) region = Rect2( 960, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=108] [sub_resource type="AtlasTexture" id=108]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 0, 240, 160 ) region = Rect2( 1200, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=109] [sub_resource type="AtlasTexture" id=109]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 0, 240, 160 ) region = Rect2( 1440, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=110] [sub_resource type="AtlasTexture" id=110]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 0, 240, 160 ) region = Rect2( 1680, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=111] [sub_resource type="AtlasTexture" id=111]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 0, 240, 160 ) region = Rect2( 1920, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=163]
atlas = SubResource( 90 )
region = Rect2( 480, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=112] [sub_resource type="AtlasTexture" id=112]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 160, 240, 160 ) region = Rect2( 2160, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=113] [sub_resource type="AtlasTexture" id=113]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 160, 240, 160 ) region = Rect2( 2400, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=114] [sub_resource type="AtlasTexture" id=114]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 320, 240, 160 ) region = Rect2( 0, 1600, 240, 160 )
[sub_resource type="AtlasTexture" id=115] [sub_resource type="AtlasTexture" id=115]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 320, 240, 160 ) region = Rect2( 960, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=116] [sub_resource type="AtlasTexture" id=116]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 320, 240, 160 ) region = Rect2( 1200, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=117] [sub_resource type="AtlasTexture" id=117]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 320, 240, 160 ) region = Rect2( 1200, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=118] [sub_resource type="AtlasTexture" id=118]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 320, 240, 160 ) region = Rect2( 0, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=119] [sub_resource type="AtlasTexture" id=119]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 320, 240, 160 ) region = Rect2( 1440, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=120] [sub_resource type="AtlasTexture" id=120]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 320, 240, 160 ) region = Rect2( 1680, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=121] [sub_resource type="AtlasTexture" id=121]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 320, 240, 160 ) region = Rect2( 1920, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=122] [sub_resource type="AtlasTexture" id=122]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 800, 240, 160 ) region = Rect2( 2160, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=123] [sub_resource type="AtlasTexture" id=123]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 800, 240, 160 ) region = Rect2( 240, 1600, 240, 160 )
[sub_resource type="AtlasTexture" id=124] [sub_resource type="AtlasTexture" id=124]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 800, 240, 160 ) region = Rect2( 480, 1600, 240, 160 )
[sub_resource type="AtlasTexture" id=125] [sub_resource type="AtlasTexture" id=125]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 800, 240, 160 ) region = Rect2( 720, 1600, 240, 160 )
[sub_resource type="AtlasTexture" id=126] [sub_resource type="AtlasTexture" id=126]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 800, 240, 160 ) region = Rect2( 240, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=127] [sub_resource type="AtlasTexture" id=127]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 800, 240, 160 ) region = Rect2( 1680, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=128] [sub_resource type="AtlasTexture" id=128]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 800, 240, 160 ) region = Rect2( 1920, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=129] [sub_resource type="AtlasTexture" id=129]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 800, 240, 160 ) region = Rect2( 2160, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=130] [sub_resource type="AtlasTexture" id=130]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 800, 240, 160 ) region = Rect2( 2400, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=131] [sub_resource type="AtlasTexture" id=131]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 960, 240, 160 ) region = Rect2( 0, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=132] [sub_resource type="AtlasTexture" id=132]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 960, 240, 160 ) region = Rect2( 240, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=133] [sub_resource type="AtlasTexture" id=133]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 960, 240, 160 ) region = Rect2( 480, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=134] [sub_resource type="AtlasTexture" id=134]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 960, 240, 160 ) region = Rect2( 720, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=135] [sub_resource type="AtlasTexture" id=135]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 960, 240, 160 ) region = Rect2( 960, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=136] [sub_resource type="AtlasTexture" id=136]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 960, 240, 160 ) region = Rect2( 1200, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=137] [sub_resource type="AtlasTexture" id=137]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 960, 240, 160 ) region = Rect2( 1680, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=138] [sub_resource type="AtlasTexture" id=138]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 960, 240, 160 ) region = Rect2( 1920, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=139] [sub_resource type="AtlasTexture" id=139]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 960, 240, 160 ) region = Rect2( 2160, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=140] [sub_resource type="AtlasTexture" id=140]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 960, 240, 160 ) region = Rect2( 2400, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=141] [sub_resource type="AtlasTexture" id=141]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 480, 240, 160 ) region = Rect2( 0, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=142] [sub_resource type="AtlasTexture" id=142]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 480, 240, 160 ) region = Rect2( 240, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=143] [sub_resource type="AtlasTexture" id=143]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 480, 240, 160 ) region = Rect2( 480, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=144] [sub_resource type="AtlasTexture" id=144]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 480, 240, 160 ) region = Rect2( 720, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=145] [sub_resource type="AtlasTexture" id=145]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 480, 240, 160 ) region = Rect2( 960, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=146] [sub_resource type="AtlasTexture" id=146]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 480, 240, 160 ) region = Rect2( 1200, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=147] [sub_resource type="AtlasTexture" id=147]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 480, 240, 160 ) region = Rect2( 1440, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=148] [sub_resource type="AtlasTexture" id=148]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 480, 240, 160 ) region = Rect2( 1920, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=149] [sub_resource type="AtlasTexture" id=149]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 480, 240, 160 ) region = Rect2( 2160, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=150] [sub_resource type="AtlasTexture" id=150]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 480, 240, 160 ) region = Rect2( 2400, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=151] [sub_resource type="AtlasTexture" id=151]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 640, 240, 160 ) region = Rect2( 0, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=152] [sub_resource type="AtlasTexture" id=152]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 640, 240, 160 ) region = Rect2( 240, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=153] [sub_resource type="AtlasTexture" id=153]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 640, 240, 160 ) region = Rect2( 480, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=154] [sub_resource type="AtlasTexture" id=154]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 640, 240, 160 ) region = Rect2( 720, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=155] [sub_resource type="AtlasTexture" id=155]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 640, 240, 160 ) region = Rect2( 960, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=156] [sub_resource type="AtlasTexture" id=156]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 640, 240, 160 ) region = Rect2( 1200, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=157] [sub_resource type="AtlasTexture" id=157]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 640, 240, 160 ) region = Rect2( 1440, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=158] [sub_resource type="AtlasTexture" id=158]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 640, 240, 160 ) region = Rect2( 1920, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=159] [sub_resource type="AtlasTexture" id=159]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 640, 240, 160 ) region = Rect2( 2160, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=160] [sub_resource type="AtlasTexture" id=160]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 800, 240, 160 ) region = Rect2( 2400, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=161] [sub_resource type="AtlasTexture" id=161]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 160, 240, 160 ) region = Rect2( 0, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=162] [sub_resource type="AtlasTexture" id=162]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 160, 240, 160 ) region = Rect2( 240, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=163]
atlas = SubResource( 90 )
region = Rect2( 480, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=164] [sub_resource type="AtlasTexture" id=164]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 1280, 240, 160 ) region = Rect2( 720, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=165] [sub_resource type="AtlasTexture" id=165]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 1280, 240, 160 ) region = Rect2( 960, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=166] [sub_resource type="AtlasTexture" id=166]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 1280, 240, 160 ) region = Rect2( 1200, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=167] [sub_resource type="AtlasTexture" id=167]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 1280, 240, 160 ) region = Rect2( 1440, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=168] [sub_resource type="AtlasTexture" id=168]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 1280, 240, 160 ) region = Rect2( 2400, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=169] [sub_resource type="AtlasTexture" id=169]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 1280, 240, 160 ) region = Rect2( 0, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=170] [sub_resource type="AtlasTexture" id=170]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 1280, 240, 160 ) region = Rect2( 720, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=171] [sub_resource type="AtlasTexture" id=171]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 1280, 240, 160 ) region = Rect2( 960, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=172] [sub_resource type="AtlasTexture" id=172]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 1280, 240, 160 ) region = Rect2( 1200, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=173] [sub_resource type="AtlasTexture" id=173]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 1280, 240, 160 ) region = Rect2( 1440, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=174] [sub_resource type="AtlasTexture" id=174]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 1440, 240, 160 ) region = Rect2( 1680, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=175] [sub_resource type="AtlasTexture" id=175]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 1440, 240, 160 ) region = Rect2( 1920, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=176] [sub_resource type="AtlasTexture" id=176]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 1440, 240, 160 ) region = Rect2( 2160, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=177] [sub_resource type="AtlasTexture" id=177]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 1440, 240, 160 ) region = Rect2( 2400, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=178] [sub_resource type="AtlasTexture" id=178]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 1440, 240, 160 ) region = Rect2( 0, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=179] [sub_resource type="AtlasTexture" id=179]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1200, 1440, 240, 160 ) region = Rect2( 240, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=180] [sub_resource type="AtlasTexture" id=180]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1440, 1440, 240, 160 ) region = Rect2( 480, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=181] [sub_resource type="AtlasTexture" id=181]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1680, 1440, 240, 160 ) region = Rect2( 720, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=182] [sub_resource type="AtlasTexture" id=182]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 1920, 1440, 240, 160 ) region = Rect2( 960, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=183] [sub_resource type="AtlasTexture" id=183]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 1440, 240, 160 ) region = Rect2( 1200, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=184] [sub_resource type="AtlasTexture" id=184]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 240, 0, 240, 160 ) region = Rect2( 1440, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=185] [sub_resource type="AtlasTexture" id=185]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 480, 0, 240, 160 ) region = Rect2( 1680, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=186] [sub_resource type="AtlasTexture" id=186]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 720, 0, 240, 160 ) region = Rect2( 1920, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=187] [sub_resource type="AtlasTexture" id=187]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 960, 0, 240, 160 ) region = Rect2( 2160, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=188] [sub_resource type="AtlasTexture" id=188]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 2160, 320, 240, 160 ) region = Rect2( 2400, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=189] [sub_resource type="AtlasTexture" id=189]
atlas = SubResource( 90 ) atlas = SubResource( 90 )
region = Rect2( 0, 640, 240, 160 ) region = Rect2( 0, 1440, 240, 160 )
[sub_resource type="SpriteFrames" id=190] [sub_resource type="AtlasTexture" id=190]
atlas = SubResource( 90 )
region = Rect2( 240, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=191]
atlas = SubResource( 90 )
region = Rect2( 480, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=192]
atlas = SubResource( 90 )
region = Rect2( 720, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=193]
atlas = SubResource( 90 )
region = Rect2( 960, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=194]
atlas = SubResource( 90 )
region = Rect2( 1680, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=195]
atlas = SubResource( 90 )
region = Rect2( 1680, 480, 240, 160 )
[sub_resource type="SpriteFrames" id=196]
animations = [ { animations = [ {
"frames": [ SubResource( 91 ), SubResource( 92 ), SubResource( 93 ), SubResource( 94 ), SubResource( 95 ), SubResource( 96 ), SubResource( 97 ), SubResource( 98 ), SubResource( 99 ), SubResource( 100 ) ], "frames": [ SubResource( 91 ), SubResource( 92 ), SubResource( 93 ), SubResource( 94 ), SubResource( 95 ), SubResource( 96 ) ],
"loop": true, "loop": true,
"name": "climb", "name": "climb",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 101 ), SubResource( 101 ), SubResource( 101 ), SubResource( 102 ), SubResource( 103 ), SubResource( 104 ), SubResource( 105 ), SubResource( 105 ), SubResource( 105 ) ], "frames": [ SubResource( 97 ) ],
"loop": false,
"name": "climb_step",
"speed": 10.0
}, {
"frames": [ SubResource( 98 ) ],
"loop": false,
"name": "climb_upstep",
"speed": 10.0
}, {
"frames": [ SubResource( 99 ), SubResource( 99 ), SubResource( 99 ), SubResource( 100 ), SubResource( 101 ), SubResource( 102 ), SubResource( 103 ), SubResource( 103 ), SubResource( 103 ) ],
"loop": false, "loop": false,
"name": "dash", "name": "dash",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 106 ), SubResource( 107 ), SubResource( 108 ), SubResource( 109 ), SubResource( 110 ), SubResource( 111 ) ], "frames": [ SubResource( 104 ), SubResource( 105 ), SubResource( 106 ), SubResource( 107 ), SubResource( 108 ), SubResource( 109 ), SubResource( 110 ), SubResource( 111 ), SubResource( 112 ), SubResource( 113 ), SubResource( 112 ), SubResource( 114 ) ],
"loop": false,
"name": "die",
"speed": 10.0
}, {
"frames": [ SubResource( 115 ), SubResource( 116 ) ],
"loop": true,
"name": "hurt",
"speed": 4.0
}, {
"frames": [ SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 117 ), SubResource( 118 ), SubResource( 119 ), SubResource( 120 ), SubResource( 121 ), SubResource( 122 ) ],
"loop": true, "loop": true,
"name": "idle", "name": "idle",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 163 ) ], "frames": [ SubResource( 123 ), SubResource( 124 ), SubResource( 125 ) ],
"loop": true,
"name": "idle_shield",
"speed": 10.0
}, {
"frames": [ SubResource( 126 ) ],
"loop": true, "loop": true,
"name": "idle_shoot", "name": "idle_shoot",
"speed": 5.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 112 ), SubResource( 113 ), SubResource( 114 ), SubResource( 115 ), SubResource( 113 ), SubResource( 116 ), SubResource( 117 ), SubResource( 118 ) ], "frames": [ SubResource( 127 ), SubResource( 128 ), SubResource( 129 ), SubResource( 130 ), SubResource( 128 ), SubResource( 131 ), SubResource( 132 ), SubResource( 133 ) ],
"loop": false, "loop": false,
"name": "jump", "name": "jump",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 120 ), SubResource( 121 ) ], "frames": [ SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 134 ), SubResource( 135 ), SubResource( 136 ) ],
"loop": true, "loop": false,
"name": "jump_shoot", "name": "jump_shoot",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 122 ), SubResource( 123 ), SubResource( 124 ), SubResource( 125 ), SubResource( 126 ), SubResource( 127 ), SubResource( 128 ), SubResource( 129 ), SubResource( 130 ), SubResource( 131 ), SubResource( 132 ), SubResource( 133 ), SubResource( 134 ), SubResource( 135 ), SubResource( 136 ), SubResource( 137 ), SubResource( 138 ), SubResource( 139 ), SubResource( 140 ) ], "frames": [ SubResource( 137 ), SubResource( 138 ), SubResource( 139 ), SubResource( 140 ), SubResource( 141 ), SubResource( 142 ), SubResource( 143 ), SubResource( 144 ), SubResource( 145 ), SubResource( 146 ), SubResource( 147 ) ],
"loop": false, "loop": false,
"name": "roll", "name": "roll",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 141 ), SubResource( 142 ), SubResource( 143 ), SubResource( 144 ), SubResource( 145 ), SubResource( 146 ), SubResource( 147 ), SubResource( 148 ), SubResource( 149 ), SubResource( 150 ) ], "frames": [ SubResource( 148 ), SubResource( 149 ), SubResource( 150 ), SubResource( 151 ), SubResource( 152 ), SubResource( 153 ), SubResource( 154 ), SubResource( 155 ), SubResource( 156 ), SubResource( 157 ) ],
"loop": true, "loop": true,
"name": "run", "name": "run",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 151 ), SubResource( 152 ), SubResource( 153 ), SubResource( 154 ), SubResource( 155 ), SubResource( 156 ), SubResource( 157 ), SubResource( 158 ), SubResource( 159 ), SubResource( 160 ) ], "frames": [ SubResource( 158 ), SubResource( 159 ), SubResource( 160 ), SubResource( 161 ), SubResource( 162 ), SubResource( 163 ), SubResource( 164 ), SubResource( 165 ), SubResource( 166 ), SubResource( 167 ) ],
"loop": true, "loop": true,
"name": "run_shoot", "name": "run_shoot",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 161 ), SubResource( 162 ), SubResource( 163 ) ], "frames": [ SubResource( 168 ), SubResource( 169 ), SubResource( 126 ) ],
"loop": false, "loop": false,
"name": "shoot", "name": "shoot",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 164 ), SubResource( 165 ), SubResource( 166 ), SubResource( 166 ), SubResource( 167 ), SubResource( 168 ), SubResource( 169 ), SubResource( 170 ), SubResource( 170 ), SubResource( 171 ), SubResource( 172 ), SubResource( 173 ), SubResource( 174 ), SubResource( 175 ), SubResource( 176 ), SubResource( 177 ), SubResource( 178 ), SubResource( 179 ), SubResource( 180 ), SubResource( 181 ), SubResource( 182 ), SubResource( 183 ) ], "frames": [ SubResource( 170 ), SubResource( 171 ), SubResource( 172 ), SubResource( 172 ), SubResource( 173 ), SubResource( 174 ), SubResource( 175 ), SubResource( 176 ), SubResource( 176 ), SubResource( 177 ), SubResource( 178 ), SubResource( 179 ), SubResource( 180 ), SubResource( 181 ), SubResource( 182 ), SubResource( 183 ), SubResource( 184 ), SubResource( 185 ), SubResource( 186 ), SubResource( 187 ), SubResource( 188 ), SubResource( 189 ) ],
"loop": true, "loop": true,
"name": "slash", "name": "slash",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 107 ), SubResource( 184 ), SubResource( 185 ), SubResource( 186 ), SubResource( 187 ) ], "frames": [ SubResource( 118 ), SubResource( 190 ), SubResource( 191 ), SubResource( 192 ), SubResource( 193 ) ],
"loop": true, "loop": false,
"name": "stand", "name": "stand",
"speed": 1.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 188 ) ], "frames": [ SubResource( 194 ) ],
"loop": false, "loop": false,
"name": "step", "name": "step",
"speed": 10.0 "speed": 10.0
}, { }, {
"frames": [ SubResource( 189 ) ], "frames": [ SubResource( 195 ) ],
"loop": false, "loop": false,
"name": "step_shoot", "name": "step_shoot",
"speed": 10.0 "speed": 10.0
@ -495,16 +550,20 @@ script = ExtResource( 3 )
actor_type = "Player" actor_type = "Player"
player_number = 1 player_number = 1
[node name="AnimatedSprite" parent="." index="0"] [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
position = Vector2( 0, -3.5 )
shape = SubResource( 197 )
[node name="AnimatedSprite" parent="." index="1"]
position = Vector2( -1, -51 ) position = Vector2( -1, -51 )
frames = SubResource( 190 ) frames = SubResource( 196 )
animation = "idle_shoot" animation = "idle_shoot"
frame = 0 frame = 0
flip_h = false flip_h = false
__meta__ = { __meta__ = {
"_aseprite_wizard_config_": { "_aseprite_wizard_config_": {
"layer": "", "layer": "",
"o_ex_p": "", "o_ex_p": "_+",
"o_folder": "res://assets", "o_folder": "res://assets",
"o_name": "", "o_name": "",
"only_visible": true, "only_visible": true,
@ -517,38 +576,36 @@ __meta__ = {
[node name="movement_component" parent="." index="2"] [node name="movement_component" parent="." index="2"]
script = ExtResource( 2 ) script = ExtResource( 2 )
player_number = 1 player_number = 1
interactable_node = NodePath("../Interactable_Receiver")
[node name="movement_state_machine" parent="." index="3"]
debug_state_machine = true
[node name="idle" parent="movement_state_machine" index="0"] [node name="idle" parent="movement_state_machine" index="0"]
script = ExtResource( 4 ) script = ExtResource( 4 )
debug_state = true
move_speed = 0.0
animation_sequence = [ "idle" ] animation_sequence = [ "idle" ]
jump_node = NodePath("../jump") jump_node = NodePath("../jump")
attack_node = NodePath("../attack") attack_node = NodePath("../attack")
dash_node = NodePath("../dash") dash_node = NodePath("../dash")
roll_node = NodePath("../roll") roll_node = NodePath("../roll")
climb_node = NodePath("../climb")
[node name="fall" parent="movement_state_machine" index="1"] [node name="fall" parent="movement_state_machine" index="1"]
script = ExtResource( 6 ) script = ExtResource( 6 )
move_speed = 90.0
animation_sequence = [ "jump" ] animation_sequence = [ "jump" ]
landing_node = NodePath("landing") landing_node = NodePath("")
[node name="landing" type="Node" parent="movement_state_machine/fall" index="0"]
script = ExtResource( 9 )
animation_name = "jump"
modifier_type = "Exit Animation"
starting_frame = 6
pre_append_animation = true
[node name="move" parent="movement_state_machine" index="2"] [node name="move" parent="movement_state_machine" index="2"]
script = ExtResource( 5 ) script = ExtResource( 5 )
move_speed = 90.0
animation_sequence = [ "step", "run" ] animation_sequence = [ "step", "run" ]
jump_node = NodePath("../jump") jump_node = NodePath("../jump")
attack_node = NodePath("../attack") attack_node = NodePath("../attack")
[node name="jump" type="Node" parent="movement_state_machine" index="3"] [node name="jump" type="Node" parent="movement_state_machine" index="3"]
script = ExtResource( 8 ) script = ExtResource( 8 )
move_speed = 90.0
move_modifier_move_acceleration = -100.0
animation_sequence = [ "jump" ] animation_sequence = [ "jump" ]
idle_node = NodePath("../idle") idle_node = NodePath("../idle")
fall_node = NodePath("../fall") fall_node = NodePath("../fall")
@ -557,30 +614,27 @@ jump_force = 250.0
[node name="attack" type="Node" parent="movement_state_machine" index="4"] [node name="attack" type="Node" parent="movement_state_machine" index="4"]
script = ExtResource( 10 ) script = ExtResource( 10 )
timeout_seconds = 2.0 timeout_seconds = 1.5
move_speed = 90.0
animation_sequence = [ "shoot" ] animation_sequence = [ "shoot" ]
jump_node = NodePath("../jump") jump_node = NodePath("../jump")
idle_node = NodePath("../idle") idle_node = NodePath("../idle")
fall_node = NodePath("../fall") fall_node = NodePath("../fall")
move_node = NodePath("../move") move_node = NodePath("../move")
draw_weapon_node = NodePath("draw_weapon")
[node name="draw_weapon" type="Node" parent="movement_state_machine/attack" index="0"]
script = ExtResource( 9 )
animation_name = "_shoot"
modifier_type = "Animation Suffix"
timeout_seconds = 2.2
animation_suffix = true
[node name="hurt" type="Node" parent="movement_state_machine" index="5"] [node name="hurt" type="Node" parent="movement_state_machine" index="5"]
script = ExtResource( 12 ) script = ExtResource( 12 )
timeout_seconds = 1.0 timeout_seconds = 2.0
move_speed = -10.0 move_speed = -10.0
animation_sequence = [ "stand" ] animation_sequence = [ "hurt" ]
idle_node = NodePath("../idle") idle_node = NodePath("../idle")
[node name="dash" type="Node" parent="movement_state_machine" index="6"] [node name="dash" type="Node" parent="movement_state_machine" index="6"]
script = ExtResource( 11 ) script = ExtResource( 11 )
move_speed = 90.0
move_speed_modifier = 90.0
move_modifier_move_acceleration = -100.0
jerk_factor = -20.0
animation_sequence = [ "dash" ] animation_sequence = [ "dash" ]
fall_node = NodePath("../fall") fall_node = NodePath("../fall")
idle_node = NodePath("../idle") idle_node = NodePath("../idle")
@ -589,11 +643,24 @@ jump_node = NodePath("../jump")
[node name="roll" type="Node" parent="movement_state_machine" index="7"] [node name="roll" type="Node" parent="movement_state_machine" index="7"]
script = ExtResource( 14 ) script = ExtResource( 14 )
move_speed = 90.0 move_speed = 150.0
animation_sequence = [ "roll" ] animation_sequence = [ "roll" ]
emitter_frame_subscriptions = {
2: "roll"
}
fall_node = NodePath("../fall") fall_node = NodePath("../fall")
idle_node = NodePath("../idle") idle_node = NodePath("../idle")
[node name="die" type="Node" parent="movement_state_machine" index="8"]
script = ExtResource( 15 )
animation_sequence = [ "die" ]
[node name="climb" type="Node" parent="movement_state_machine" index="9"]
script = ExtResource( 17 )
debug_state = true
animation_sequence = [ "climb_step", "climb", "climb_upstep" ]
idle_node = NodePath("../idle")
[node name="Hurtbox_Component" parent="." index="4"] [node name="Hurtbox_Component" parent="." index="4"]
collision_layer = 16 collision_layer = 16
collision_mask = 128 collision_mask = 128
@ -608,7 +675,7 @@ max_health = 100
[node name="Gun" type="Position2D" parent="." index="7"] [node name="Gun" type="Position2D" parent="." index="7"]
physics_interpolation_mode = 1 physics_interpolation_mode = 1
position = Vector2( 25, -5 ) position = Vector2( 23, -9 )
script = ExtResource( 13 ) script = ExtResource( 13 )
[node name="Cooldown" type="Timer" parent="Gun" index="0"] [node name="Cooldown" type="Timer" parent="Gun" index="0"]
@ -616,9 +683,30 @@ wait_time = 0.5
one_shot = true one_shot = true
[node name="Line2D" type="Line2D" parent="Gun" index="1"] [node name="Line2D" type="Line2D" parent="Gun" index="1"]
points = PoolVector2Array( -5, 0, 5, 0 ) position = Vector2( -3, 0 )
points = PoolVector2Array( -5, 0, 1.25483, 0, 5, 0 )
width = 2.0 width = 2.0
default_color = Color( 1, 0.607843, 0, 1 ) default_color = Color( 1, 0.607843, 0, 1 )
[node name="Interactable_Receiver" type="Node2D" parent="." index="8"]
script = ExtResource( 16 )
interactable_parent_callback = "touch_the_thing"
[node name="Modifier_Receiver" parent="." index="9" instance=ExtResource( 9 )]
modifier_parent_callback = "receive_modifier"
debug_receiver = true
[node name="Ladder_Detection" type="RayCast2D" parent="." index="10"]
modulate = Color( 0.247059, 0.92549, 0.0313726, 1 )
position = Vector2( 0, 5 )
enabled = true
cast_to = Vector2( 0, 15 )
collision_mask = 1024
collide_with_areas = true
collide_with_bodies = false
[connection signal="do_attack" from="movement_state_machine/attack" to="." method="_on_attack_do_attack"] [connection signal="do_attack" from="movement_state_machine/attack" to="." method="_on_attack_do_attack"]
[connection signal="frame_reached" from="movement_state_machine/roll" to="." method="_on_roll_frame_reached"]
[connection signal="state_exited" from="movement_state_machine/roll" to="." method="_on_roll_state_exited"]
[connection signal="state_entered" from="movement_state_machine/die" to="." method="_on_die_state_entered"]
[connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"] [connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"]

View File

@ -17,12 +17,31 @@ extends MovementComponent
export var player_number: int = 1 export var player_number: int = 1
export (NodePath) var interactable_node
onready var interactable_receiver_node: Interactable_Receiver = get_node(interactable_node)
onready var ladder_detection:RayCast2D = $"../Ladder_Detection"
var ladder_collision: RayCast2D
func _ready():
ladder_collision = ladder_detection
# Guess there isn't a hit from inside in 3.5
# Remember to make raycast as tall as needed for the player
#ladder_collision.hit_from_inside = true
func process_physics(delta): func process_physics(delta):
PlayerInfo.player_position = owner.global_position PlayerInfo.player_position = owner.global_position
func process_input(event: InputEvent): func process_input(event: InputEvent):
var interactables = interactable_receiver_node.interactable_function_callables
for interactable in interactables: # Iterate through the interactable collection
if interactable is Interactable: # Make sure we didn't push something dumb in there.
if (Input.is_action_pressed("ui_up")): # We pressed up?
interactable.trigger_interaction()
get_movement_direction() get_movement_direction()
# Return the desired direction of movement for the character # Return the desired direction of movement for the character
# in the range [-1, 1], where positive values indicate a desire # in the range [-1, 1], where positive values indicate a desire
# to move to the right and negative values to the left. # to move to the right and negative values to the left.
@ -59,6 +78,40 @@ func wants_roll() -> bool:
else: else:
return false return false
func wants_climb() -> bool:
if ladder_detection.is_colliding() and Input.is_action_pressed("ui_up"):
#print("betcha wanna climb though!")
return true
else:
return false
func get_climb_shape_location() -> Vector2:
if ladder_detection.is_colliding():
var point: Vector2 = ladder_collision.get_collision_point()
var shape_id = ladder_collision.get_collider_shape()
var object = ladder_collision.get_collider()
# This works but doesn't get the shapes location.
# if object is Area2D:
# print("You got an area bro!" , object.global_position)
# This appears to get the shapes location!
var area = Physics2DServer.area_get_transform(object)
var areashape = Physics2DServer.area_get_shape_transform(object, shape_id)
var y_dir = Input.get_axis("ui_up" , "ui_down")
#var target = get_collider() # A CollisionObject2D.
#var shape_id = get_collider_shape() # The shape index in the collider.
#var owner_id = target.shape_find_owner(shape_id) # The owner ID in the collider.
#var shape = target.shape_owner_get_owner(owner_id)
#UiManager.debug_text = str(round(point.x)) + ' ' + str(round(point.y)) #( "Mod(" + str(sign(_move_speed_modifier)) + ") Dir(" + str(move_direction) + ") Vel(" + str(sign(current_x_velocity)) + ") Mov(" + str(sign(move_component.desired_movement_vector.x)) +
return Vector2(areashape.origin.x, y_dir)
else:
return Vector2(-1,-1)
## Other needed variables ## Other needed variables
# desired_movement_vector: Vector2 - Used to store desired movement depending on the state # desired_movement_vector: Vector2 - Used to store desired movement depending on the state

View File

@ -6,36 +6,53 @@ export (NodePath) var fall_node
export (NodePath) var move_node export (NodePath) var move_node
export (NodePath) var draw_weapon_node export (NodePath) var draw_weapon_node
onready var jump_state: State = get_node(jump_node) onready var jump_state: StateAnimatedActor = get_node(jump_node)
onready var idle_state: State = get_node(idle_node) onready var idle_state: StateAnimatedActor = get_node(idle_node)
onready var fall_state: State = get_node(fall_node) onready var fall_state: StateAnimatedActor = get_node(fall_node)
onready var move_state: State = get_node(move_node) onready var move_state: StateAnimatedActor = get_node(move_node)
onready var weapon_state_modifier: StateModifier = get_node(draw_weapon_node) #onready var weapon_state_modifier: StateModifier = get_node(draw_weapon_node)
var can_fire = true var can_fire = true
signal do_attack() signal do_attack()
func enter() -> void: var draw_weapon_modifier: StateModifier
#.enter()
##TODO: Turn this to clear only the animation modifiers. func _ready():
modifier_stack_ref.clear() state_timeout.connect("timeout", self, "disable_cooldown")
mod_animation_sequence.clear() draw_weapon_modifier = StateModifier.new()
#mod_animation_sequence = animation_sequence.duplicate(true) var mod_timer :Timer = draw_weapon_modifier.ready( "draw_weapon", "_shoot" , draw_weapon_modifier.TYPE.ANIMATION_SUFFIX, 2.0)
mod_animation_sequence.append_array(animation_sequence) add_child(mod_timer)
# Reset animation suffix in case there isn't one
animation_suffix = ''
animation_index = 0 func disable_cooldown():
current_animation_sequence = 0 if debug_state:
#var enter_animation = '' print("Attack state cooldown timeout. Can attack again.")
var enter_frame = 0 state_ready = true
if debug_state: func enter() -> void:
print(parent.name, " entering State: ", self.name) if modifier:
move_component.current_movement_state = self.name if modifier.get_instance_id() == draw_weapon_modifier.get_instance_id():
emit_signal("state_entered") #print ("They the same cannot apply modifier: ", draw_weapon_modifier.get_instance_id())
modifier = null
.enter()
##TODO: Turn this to clear only the animation modifiers.
# modifier_stack_ref.clear()
# mod_animation_sequence.clear()
# #mod_animation_sequence = animation_sequence.duplicate(true)
# mod_animation_sequence.append_array(animation_sequence)
# # Reset animation suffix in case there isn't one
# animation_suffix = '_shoot'
# animation_index = 0
# current_animation_sequence = 0
# #var enter_animation = ''
# var enter_frame = 0
#
# if debug_state:
# print(parent.name, " entering State: ", self.name)
# move_component.current_movement_state = self.name
# emit_signal("state_entered")
state_timeout.start()
can_fire = true can_fire = true
# if modifier_stack_ref.has($"../draw_weapon") == false: # if modifier_stack_ref.has($"../draw_weapon") == false:
# $"../draw_weapon".enter() # $"../draw_weapon".enter()
@ -45,21 +62,43 @@ func enter() -> void:
previous_state_frame_number, " ", previous_state_name) previous_state_frame_number, " ", previous_state_name)
match previous_animation_name: match previous_animation_name:
"idle": "idle":
animations.play("shoot") #animations.play("idle_shoot")
if debug_state:
print("no need to change idle animation")
"run": "run":
animations.play("run_shoot") animations.play("run_shoot")
animations.frame = previous_state_frame_number animations.frame = previous_state_frame_number
"jump": "jump":
animations.play("jump_shoot") animations.play("jump_shoot")
animations.frame = previous_state_frame_number animations.frame = previous_state_frame_number
if debug_state:
print("Starting Animation: jump_shoot at frame ", animations.animation , animations.frame)
_: _:
print("Warning!: Attack state encountered unhandled prev animation: ", previous_animation_name) print("Warning!: Attack state encountered unhandled prev animation: ", previous_animation_name)
# An example where the modifier is left to alert on a timeout
#mod_timer.connect("timeout", draw_weapon_modifier, "_on_Timer_timeout")
# An example where the current node subscribes
#mod_timer.connect("timeout", self, "_on_Timer_timeout")
state_timeout.start()
draw_weapon_modifier.state_timeout.start()
state_ready = false
animation_finished = false
func _on_Timer_timeout():
print("Modifier Timeout from attack! Forcing animation recall")
#animations.stop()
func process_frame(delta: float) -> State: func process_frame(delta: float) -> State:
if animation_finished:
draw_weapon_modifier.state_timeout.start()
modifier = draw_weapon_modifier
return idle_state
# if animations.frame == 2: # if animations.frame == 2:
# animations.stop() # animations.stop()
if state_timeout.time_left == 0 and animations.animation == "shoot": # if state_timeout.time_left == 0 and animations.animation == "shoot":
return idle_state # return idle_state
return null return null
@ -70,14 +109,19 @@ func process_physics(delta: float) -> State:
can_fire = false can_fire = false
if move_component.wants_jump() and parent.is_on_floor(): if move_component.wants_jump() and parent.is_on_floor():
draw_weapon_modifier.state_timeout.start()
jump_state.modifier = draw_weapon_modifier
return jump_state return jump_state
move_actor_as_desired(delta) move_actor_as_desired(delta)
if previous_state_name == "move" and move_component.velocity.x == 0.0: # if previous_state_name == "move" and move_component.velocity.x == 0.0:
return idle_state # return idle_state
if previous_state_name == "idle" and move_component.velocity.x != 0.0: if move_component.velocity.x != 0.0:
draw_weapon_modifier.state_timeout.start()
move_state.modifier = draw_weapon_modifier
#draw_weapon_modifier.transfer_owner(move_state)
return move_state return move_state
if move_component.get_movement_direction() != 0.0: if move_component.get_movement_direction() != 0.0:
@ -87,16 +131,10 @@ func process_physics(delta: float) -> State:
# return move_state # return move_state
if !parent.is_on_floor(): if !parent.is_on_floor():
draw_weapon_modifier.state_timeout.start()
fall_state.modifier = draw_weapon_modifier
return fall_state return fall_state
return null return null
func exit() -> void:
# force timer reset
weapon_state_modifier.state_timeout.start()
push_animation_state_modifier(weapon_state_modifier)
#$"../draw_weapon".state_timeout.start()
return

View File

@ -0,0 +1,51 @@
extends StateAnimatedActor
export (NodePath) var idle_node
onready var idle_state: StateAnimatedActor = get_node(idle_node)
#onready var landing_mod: StateModifier = get_node(landing_node)
var climbing_modifier: StateModifier
func _ready():
climbing_modifier= StateModifier.new()
#add_child(modifier)
#modifier.init_ref()
# climbing_modifier.ready( "landing", "jump" , climbing_modifier.TYPE.EXIT_ANIMATION)
# climbing_modifier.starting_frame = 6
#print("ready! MOD")
func enter() -> void:
.enter()
animations.frame = 5
func process_physics(delta: float) -> State:
# First allow horizontal movement.
#move_actor_as_desired(delta)
# Make wure we still want to climb
var ladder_location = move_component.get_climb_shape_location()
if ladder_location != Vector2(-1,-1):
UiManager.debug_text = str(ladder_location) + '\n' + str(ladder_location - parent.global_position) #+ '\n' + str(parent.global_position.distance_to(ladder_location))
# An attempt to snap to the ladder location
if parent.global_position.x != round(ladder_location.x):
parent.global_translate(Vector2(round((ladder_location.x - parent.global_position.x)),(ladder_location.y * move_speed) * delta))
if ladder_location.y != 0:
animations.play()
else:
# Make sure we hopped the step index
if animation_index > 0:
animations.stop()
else:
return idle_state
#parent.move_local_x()
#Flip the character before tha actual move maybe.
if move_component.get_movement_direction() != 0.0:
parent.transform.x.x = move_component.get_movement_direction()
# if parent.is_on_floor():
# #modifier.reference()
# idle_state.modifier = climbing_modifier
# return idle_state
return null

View File

@ -10,13 +10,7 @@ onready var fall_state: State = get_node(fall_node)
onready var idle_state: State = get_node(idle_node) onready var idle_state: State = get_node(idle_node)
onready var attack_state: State = get_node(attack_node) onready var attack_state: State = get_node(attack_node)
var speed_multiplier := 1.0 #var speed_decay_rate := 1.0
var speed_decay_rate := 1.0
func enter():
.enter()
speed_multiplier = 2.8
speed_decay_rate = 2.0
func process_physics(delta: float) -> State: func process_physics(delta: float) -> State:
@ -25,24 +19,54 @@ func process_physics(delta: float) -> State:
if move_component.wants_jump(): if move_component.wants_jump():
return jump_state return jump_state
if speed_multiplier > 1.0:
#print(speed_multiplier,", ", delta)
speed_multiplier -= delta * speed_decay_rate
speed_decay_rate += delta
elif speed_multiplier < 1.0:
speed_multiplier += delta * speed_decay_rate
speed_decay_rate += delta
# Deadzone
if speed_multiplier < 1.1 and speed_multiplier > 0.9:
speed_multiplier = 1.0
move_component.velocity.y += gravity * delta # Move the last direction we were facing.
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) move_actor_as_desired(delta, parent.transform.x.x)
#print(speed_multiplier) # # Assuming adjusted_move_speed is set to the mood speed modifier on state entry
move_component.velocity.x = parent.transform.x.x * move_speed * speed_multiplier # # Move speed is the base speed plus the modifier minus the decay adjusted for time
move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) # jerk += jerk_factor * delta
# adjusted_move_speed += move_modifier_move_acceleration * delta
# var new_move_speed = move_speed + (move_acceleration * delta) + adjusted_move_speed + jerk
#
# # A really crappy normalization to prevent modifying past the base move speed.
# if move_speed_modifier > 0 and new_move_speed < move_speed: # positive modifier
# #print("nope1")
# new_move_speed = move_speed
# elif move_speed_modifier < 0 and new_move_speed > move_speed: # negative modifier
# #print("nope2")
# new_move_speed = move_speed
# else:
# UiManager.debug_text = str(round(adjusted_move_speed)) + "," + str(round(new_move_speed)) + "," + str(round(jerk))
# #print(adjusted_move_speed, ",", new_move_speed, ",", jerk)
#
# #print(new_move_speed, " ", adjusted_move_speed)
#
# move_component.velocity.y += gravity * delta
# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
# #print(speed_multiplier)
# move_component.velocity.x = parent.transform.x.x * new_move_speed
# move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
## Trying a whole new model
# var new_move_speed = move_speed * speed_multiplier
# if speed_multiplier > 1.0:
# print("PPS: ", new_move_speed * delta)
# speed_multiplier -= delta * (speed_decay_rate * speed_multiplier)
# #speed_decay_rate += delta * speed_decay_rate
#
# elif speed_multiplier < 1.0:
# speed_multiplier += delta * (speed_decay_rate * speed_multiplier)
# #speed_decay_rate += delta * speed_decay_rate
#
# # Deadzone
# if speed_multiplier < 1.1 and speed_multiplier > 0.9:
# speed_multiplier = 1.0
#
# move_component.velocity.y += gravity * delta
# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
# #print(speed_multiplier)
# move_component.velocity.x = parent.transform.x.x * new_move_speed
# move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
if move_component.velocity.x == 0.0 or animations.playing == false: if move_component.velocity.x == 0.0 or animations.playing == false:

12
src/playerD/states/die.gd Normal file
View File

@ -0,0 +1,12 @@
extends StateAnimatedActor
func enter() -> void:
# modifier_stack_ref.clear()
.enter()
move_component.velocity.x = 0
func process_physics(_delta: float) -> State:
#Dead Dead dead.
#move_actor_as_desired(_delta)
return null

View File

@ -3,10 +3,25 @@ extends StateAnimatedActor
export (NodePath) var idle_node export (NodePath) var idle_node
export (NodePath) var landing_node export (NodePath) var landing_node
onready var idle_state: State = get_node(idle_node) onready var idle_state: StateAnimatedActor = get_node(idle_node)
onready var landing_mod: StateModifier = get_node(landing_node) #onready var landing_mod: StateModifier = get_node(landing_node)
var landing_modifier: StateModifier
func _ready():
landing_modifier= StateModifier.new()
#add_child(modifier)
#modifier.init_ref()
landing_modifier.ready( "landing", "jump" , landing_modifier.TYPE.EXIT_ANIMATION)
landing_modifier.starting_frame = 6
#print("ready! MOD")
func enter() -> void: func enter() -> void:
# var landing_mod_index = modifier_stack_ref.rfind(landing_mod)
# if landing_mod_index != -1:
# #print("You're Supposed to be dead!?: ", landing_mod_index)
# modifier_stack_ref.remove(landing_mod_index)
.enter() .enter()
# Jump to fall frame # Jump to fall frame
animations.frame = 5 animations.frame = 5
@ -22,13 +37,14 @@ func process_physics(delta: float) -> State:
parent.transform.x.x = move_component.get_movement_direction() parent.transform.x.x = move_component.get_movement_direction()
if parent.is_on_floor(): if parent.is_on_floor():
#modifier.reference()
idle_state.modifier = landing_modifier
return idle_state return idle_state
return null return null
func exit() -> void: #func exit() -> void:
.exit() # .exit()
push_animation_state_modifier(landing_mod) ## push_animation_state_modifier(landing_mod)
# $"../landing".enter() ## $"../landing".enter()
# modifier_stack_ref.push_front($"../landing") ## modifier_stack_ref.push_front($"../landing")
return # return

View File

@ -4,13 +4,28 @@ export (NodePath) var idle_node
onready var idle_state: State = get_node(idle_node) onready var idle_state: State = get_node(idle_node)
var flash_color = Color.yellow
var store_modifier: StateModifier
func enter() -> void: func enter() -> void:
if modifier:
if debug_state:
print(name, " skipping modifier and holding for next state.")
store_modifier = modifier
modifier = null
# modifier_stack_ref.clear()
.enter() .enter()
move_component.velocity.x = 0 move_component.velocity.x = 0
#parent.set_hurtbox(false) #parent.set_hurtbox(false)
#TODO: Error check if timer was actually instanced #TODO: Error check if timer was actually instanced
state_timeout.start() state_timeout.start()
func exit() -> void:
modifier = store_modifier
.exit()
animations.modulate = Color.white
func process_input(_event: InputEvent) -> State: func process_input(_event: InputEvent) -> State:
# move_component.wants_jump() # move_component.wants_jump()
move_component.get_movement_direction() move_component.get_movement_direction()
@ -19,6 +34,11 @@ func process_input(_event: InputEvent) -> State:
func process_frame(delta: float) -> State: func process_frame(delta: float) -> State:
# Apply a little effect when damage taken.
#UiManager.debug_text = str(abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5)))
animations.modulate = flash_color.linear_interpolate(Color.white, abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5)))
if state_timeout.time_left == 0: if state_timeout.time_left == 0:
return idle_state return idle_state
return null return null
@ -27,7 +47,7 @@ func process_frame(delta: float) -> State:
func process_physics(delta: float) -> State: func process_physics(delta: float) -> State:
move_component.velocity.y += gravity * delta move_component.velocity.y += gravity * delta
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
move_component.velocity = parent.transform.x * move_speed move_component.velocity.x = parent.transform.x.x * move_speed
# if (parent.direction.x > 0): # if (parent.direction.x > 0):
# parent.velocity.x = 1 * move_speed # parent.velocity.x = 1 * move_speed
# else: # else:

View File

@ -6,6 +6,7 @@ export (NodePath) var jump_node
export (NodePath) var attack_node export (NodePath) var attack_node
export (NodePath) var dash_node export (NodePath) var dash_node
export (NodePath) var roll_node export (NodePath) var roll_node
export (NodePath) var climb_node
onready var fall_state: State = get_node(fall_node) onready var fall_state: State = get_node(fall_node)
onready var move_state: State = get_node(move_node) onready var move_state: State = get_node(move_node)
@ -13,11 +14,13 @@ onready var jump_state: State = get_node(jump_node)
onready var attack_state: State = get_node(attack_node) onready var attack_state: State = get_node(attack_node)
onready var dash_state: State = get_node(dash_node) onready var dash_state: State = get_node(dash_node)
onready var roll_state: State = get_node(roll_node) onready var roll_state: State = get_node(roll_node)
onready var climb_state: State = get_node(climb_node)
func enter() -> void: func enter() -> void:
.enter() .enter()
# parent.set_hurtbox(true) # parent.set_hurtbox(true)
move_component.velocity.x = 0 #move_component.velocity.x = 0
#move_component.momentum.x *= -1
if debug_state: if debug_state:
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x) print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
@ -33,13 +36,15 @@ func process_physics(delta: float) -> State:
if move_component.wants_dash() and parent.is_on_floor(): if move_component.wants_dash() and parent.is_on_floor():
return dash_state return dash_state
if move_component.wants_climb():
return climb_state
if move_component.wants_shoot(): if move_component.wants_shoot():
return attack_state return attack_state
move_actor_as_desired(delta) move_actor_as_desired(delta)
if move_component.velocity.x != 0.0: if move_component.desired_movement_vector.x != 0 and move_component.velocity.x != 0:
return move_state return move_state
if !parent.is_on_floor(): if !parent.is_on_floor():

View File

@ -4,15 +4,22 @@ extends StateAnimatedActor
export (NodePath) var idle_node export (NodePath) var idle_node
export (NodePath) var fall_node export (NodePath) var fall_node
export (NodePath) var attack_node export (NodePath) var attack_node
export (NodePath) var landing_node
onready var idle_state: State = get_node(idle_node) onready var idle_state: State = get_node(idle_node)
onready var fall_state: State = get_node(fall_node) onready var fall_state: State = get_node(fall_node)
onready var attack_state: State = get_node(attack_node) onready var attack_state: State = get_node(attack_node)
#onready var landing_mod: StateModifier = get_node(landing_node)
export var jump_force: float = 200.0 export var jump_force: float = 200.0
func enter() -> void: func enter() -> void:
# var landing_mod_index = modifier_stack_ref.rfind(landing_mod)
# if landing_mod_index != -1:
# #print("You're Supposed to be dead!?: ", landing_mod_index)
# modifier_stack_ref.remove(landing_mod_index)
# if modifier_stack_ref.has(landing_mod):
# print("Jump from Landing Mod at: ", modifier_stack_ref.rfind(landing_mod))
.enter() .enter()
# Apply initial jump velocity on state enter # Apply initial jump velocity on state enter
move_component.velocity.y = -jump_force move_component.velocity.y = -jump_force

View File

@ -19,12 +19,15 @@ func process_physics(delta: float) -> State:
move_actor_as_desired(delta) move_actor_as_desired(delta)
if move_component.velocity.x == 0.0: # if move_component.velocity.x == 0.0:
return idle_state # return idle_state
#Flip the character before tha actual move maybe. #Flip the character before tha actual move maybe.
if move_component.get_movement_direction() != 0.0: if move_component.get_movement_direction() != 0.0:
parent.transform.x.x = move_component.get_movement_direction() parent.transform.x.x = move_component.get_movement_direction()
if move_component.desired_movement_vector.x == 0:
return idle_state
if !parent.is_on_floor(): if !parent.is_on_floor():
return fall_state return fall_state

View File

@ -6,9 +6,13 @@ export (NodePath) var idle_node
onready var fall_state: State = get_node(fall_node) onready var fall_state: State = get_node(fall_node)
onready var idle_state: State = get_node(idle_node) onready var idle_state: State = get_node(idle_node)
var speed_multiplier := 1.0
var speed_decay_rate := 1.0 var speed_decay_rate := 1.0
func enter():
#remove_animation_state_modifiers()
.enter()
func process_physics(delta: float) -> State: func process_physics(delta: float) -> State:
# if move_component.wants_shoot(): # if move_component.wants_shoot():

View File

@ -0,0 +1,13 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var player_start_position: Position2D
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -9,6 +9,8 @@ var dialog_text = 'foo'
var dialog_portrait = preload("res://icon.png") var dialog_portrait = preload("res://icon.png")
var current_pane = UI_PANES.OFF var current_pane = UI_PANES.OFF
var debug_text :String
# Declare member variables here. Examples: # Declare member variables here. Examples:
# var a = 2 # var a = 2
# var b = "text" # var b = "text"

View File

@ -8,8 +8,9 @@ signal state_entered()
signal state_exited() signal state_exited()
# Declare member variables here. Examples: # Declare member variables here. Examples:
var modifier_stack_ref: Array # Well this didn't work #var modifier_stack_ref: Array # Well this didn't work
var state_timeout: Timer var state_timeout: Timer
var state_ready: bool = true
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():

View File

@ -16,7 +16,20 @@ extends State
## Deprecated ## Deprecated
# export var animation_name: String # export var animation_name: String
# Movement Speed in Pixels Per Second
export var move_speed: float = 60 export var move_speed: float = 60
export var move_acceleration: float = 0
export var move_speed_modifier: float = 0
export var move_modifier_move_acceleration: float = 0
export var jerk_factor: float = 0
#var adjusted_move_speed: float
var jerk: float
var physics_modifier :StateModifier
##TODO: Deprecate this useless fool!
var speed_multiplier: float = 1.0
export(Array, String) var animation_sequence export(Array, String) var animation_sequence
@ -24,6 +37,9 @@ signal frame_reached(state_name, animation_name, frame_number)
export(Dictionary) var emitter_frame_subscriptions export(Dictionary) var emitter_frame_subscriptions
var frame_signal_emitted: bool = false var frame_signal_emitted: bool = false
var animation_finished: bool = false
# this just wouldn't work well. Maybe I can try a resource # this just wouldn't work well. Maybe I can try a resource
# export(Array, NodePath) var transition_state_nodes # export(Array, NodePath) var transition_state_nodes
@ -45,6 +61,9 @@ var parent: KinematicBody2D
var previous_animation_name : String var previous_animation_name : String
var previous_state_frame_number : int var previous_state_frame_number : int
var previous_state_name: String var previous_state_name: String
var previous_speed_multiplier: float
var modifier: StateModifier
#var animation_sequence_timer: Timer #var animation_sequence_timer: Timer
@ -59,76 +78,75 @@ func _ready():
state_timeout.one_shot = true state_timeout.one_shot = true
state_timeout.autostart = false state_timeout.autostart = false
add_child(state_timeout) add_child(state_timeout)
#modifier = StateModifier.new()
# If called, this will attempt to make the most appropriate animation change
# would likely be triggered from an animation sequence finishing or a
# modifier being applied/removed outside of enter/exit transitions.
func update_animation(enter_frame := 0, index := 0, suffix := ''):
## TODO:
# Need to find a way to attempt to keep and transfer the Index or frame
#
# if clear_modifier:
# print("Goodbye Modifiers!")
# modifier = null
# if modifier:
# if modifier.state_timeout and modifier.timeout_seconds == 0:
# modifier = null
func enter() -> void: # By Default, we build an animation sequence off of this state's before checking
# animations.connect("animation_finished", self, "_on_AnimatedSprite_animation_finished") # for modifiers
mod_animation_sequence.clear() mod_animation_sequence.clear()
#mod_animation_sequence = animation_sequence.duplicate(true)
mod_animation_sequence.append_array(animation_sequence) mod_animation_sequence.append_array(animation_sequence)
# Reset animation suffix in case there isn't one # Reset animation suffix in case there isn't one
animation_suffix = '' animation_suffix = suffix
animation_index = 0 animation_index = index
current_animation_sequence = 0 current_animation_sequence = animation_index
#var enter_animation = '' #var enter_animation = ''
var enter_frame = 0 #var enter_frame = 0
if debug_state:
print(parent.name, " entering State: ", self.name)
move_component.current_movement_state = self.name
emit_signal("state_entered")
#modifier_stack_ref = state_modifiers
# A new attempt at animation modifiers
if modifier_stack_ref.empty() == false:
print("nope: ")
var i = modifier_stack_ref.size() - 1
##NOTE: i apparently reverse range itteration doesn't work
#for i in range(modifier_stack_ref.size(), 0): # work in reverse
while (i >= 0 and modifier_stack_ref[i].modifier_type != "None"):
print("Animation Modifier!: ",modifier_stack_ref[i].modifier_type)
match modifier_stack_ref[i].modifier_type:
"Exit Animation":
mod_animation_sequence.push_front(modifier_stack_ref[i].animation_name)
enter_frame = modifier_stack_ref[i].starting_frame
# Gonna ty and avoid this for now
#modifier_stack_ref.pop_at(i) # we're done with this modifier
"Animation Suffix":
if animations.frames.has_animation(mod_animation_sequence[animation_index] + modifier_stack_ref[i].animation_name):
animation_suffix = modifier_stack_ref[i].animation_name
else:
print("Warning!: Animation suffix that doesn't exist ",
mod_animation_sequence[animation_index] + modifier_stack_ref[i].animation_name)
"Replace Animation":
#animations.play(modifier_stack_ref[i].animation_name)
#animations.frame = modifier_stack_ref[i].starting_frame
mod_animation_sequence.clear()
mod_animation_sequence.push_back(modifier_stack_ref[i].animation_name)
enter_frame = modifier_stack_ref[i].starting_frame
i -= 1
if modifier != null:
# if modifier.modifier_type == modifier.TYPE.EXIT_ANIMATION:
# #print("OHHH Modifier Applies! ", modifier.animation_name)
# mod_animation_sequence.push_front(modifier.animation_name)
# enter_frame = modifier.starting_frame
match modifier.modifier_type:
modifier.TYPE.EXIT_ANIMATION:
mod_animation_sequence.push_front(modifier.animation_name)
enter_frame = modifier.starting_frame
# if modifier_stack_ref.empty() == false: # a modifier is applied modifier.TYPE.ANIMATION_SUFFIX:
# if modifier_stack_ref[-1].animation_name != '': # the first one has an animation if animations.frames.has_animation(mod_animation_sequence[animation_index] + modifier.animation_name):
# if modifier_stack_ref[-1].animation_suffix: # it's a suffix type animation_suffix = modifier.animation_name
# if mod_animation_sequence.size() > 0: # the current animation is multipart (sequence > 0) else:
# animation_index = 0 print("Warning!: Modifier attempting to apply suffix that doesn't exist ",
# current_animation_sequence = 0 mod_animation_sequence[animation_index] + modifier.animation_name)
# # Guess I don't need this one anymore
# #if animations.frames.get_animation_names().has(animation_sequence[animation_index] + modifier_stack_ref[-1].animation_name): modifier.TYPE.REPLACE_ANIMATION:
# if animations.frames.has_animation(mod_animation_sequence[animation_index] + modifier_stack_ref[-1].animation_name): #animations.play(modifier_stack_ref[i].animation_name)
# animation_suffix = modifier_stack_ref[-1].animation_name #animations.frame = modifier_stack_ref[i].starting_frame
# elif modifier_stack_ref[-1].pre_append_animation == true: # it's a pre-append type mod_animation_sequence.clear()
# #animation_sequence.size() mod_animation_sequence.push_back(modifier.animation_name)
# print ("DEBUG: A prepend animation") enter_frame = modifier.starting_frame
# #mod_animation_sequence = animation_sequence
# mod_animation_sequence.push_front(modifier_stack_ref[-1].animation_name) # Some safety checks with supplied update parameters
# else: if animation_index != 0:
# animations.play(modifier_stack_ref[-1].animation_name) if mod_animation_sequence.size() < animation_index + 1:
# animations.frame = modifier_stack_ref[-1].starting_frame if debug_state:
# return print("Warning!: attempting to set to non-existant index ")
animation_index = 0
current_animation_sequence = animation_index
if animations.frames.has_animation(mod_animation_sequence[animation_index] + animation_suffix) == false:
if debug_state:
print("Warning!: Animation doesn't exist! ")
if enter_frame != 0:
if animations.frames.get_frame_count(animations.animation) != animations.frames.get_frame_count(mod_animation_sequence[animation_index] + animation_suffix):
if debug_state:
print("Warning!: attempting to set a mismatched frame ")
enter_frame = 0
if mod_animation_sequence.size() > 0: if mod_animation_sequence.size() > 0:
if debug_state: if debug_state:
@ -140,17 +158,75 @@ func enter() -> void:
print("Error! Resolved to empty animation sequence!?") print("Error! Resolved to empty animation sequence!?")
return return
func enter() -> void:
if debug_state:
print(parent.name, " entering State: ", self.name)
move_component.current_movement_state = self.name
emit_signal("state_entered")
#modifier_stack_ref = state_modifiers
update_animation()
# Reset movespeed counters
#move_component.momentum.x = move_speed_modifier
jerk = 0
return
func exit() -> void: func exit() -> void:
emit_signal("state_exited") emit_signal("state_exited")
# animations.disconnect("animation_finished", self, "_on_AnimatedSprite_animation_finished") # animations.disconnect("animation_finished", self, "_on_AnimatedSprite_animation_finished")
#modifier = null
return return
func transfer_modifiers(exiting_state_modifier : StateModifier):
if modifier == null: # We have no existing modifier applied.
match exiting_state_modifier.modifier_type:
exiting_state_modifier.TYPE.ANIMATION_SUFFIX:
if debug_state:
print("Transferring Animation Suffix")
modifier = exiting_state_modifier
exiting_state_modifier.TYPE.EXIT_ANIMATION:
if debug_state:
print("Exit Animation: well this was useless.")
else:
print("Insert modifier merge function here...")
func process_input(_event: InputEvent) -> State: func process_input(_event: InputEvent) -> State:
return null return null
func process_frame(_delta: float) -> State: func process_animations():
#if animation_sequence.size() > 0 and current_animation_sequence != animation_index:
if mod_animation_sequence.size() > animation_index and current_animation_sequence != animation_index: if modifier != null:
if modifier.state_timeout and modifier.state_timeout.time_left == 0:
print("Expired Modifier, updating animation.")
#modifier = null
match modifier.modifier_type:
modifier.TYPE.ANIMATION_SUFFIX:
# Attempt to seemlessly transition animations.
modifier = null
update_animation(animations.frame,animation_index)
modifier.TYPE.REPLACE_ANIMATION:
if debug_state:
print("I don't have anything for replacements yet.")
modifier = null
update_animation()
_:
modifier = null
return
# We have no more sequence animations and the current one doesn't loop
# we do this to prevent the default idle animation from playing.
##TODO: between this and the signal based iterator I get some really strange behavior
if animation_index >= mod_animation_sequence.size() and animations.frames.get_animation_loop(
animations.animation) == false:
#print(animations.animation, " Animation Stopped")
animations.stop()
#animation_finished = true
elif mod_animation_sequence.size() > animation_index and current_animation_sequence != animation_index:
#TODO: why was I doing this #TODO: why was I doing this
# if animation_index >= mod_animation_sequence.size(): # if animation_index >= mod_animation_sequence.size():
# animation_index = 0 # animation_index = 0
@ -160,11 +236,8 @@ func process_frame(_delta: float) -> State:
print("An animation sequence: ", mod_animation_sequence[animation_index - 1], " -> ", print("An animation sequence: ", mod_animation_sequence[animation_index - 1], " -> ",
animations.animation , " (", animation_index, ")") animations.animation , " (", animation_index, ")")
current_animation_sequence = animation_index current_animation_sequence = animation_index
# We have no more sequence animations and the current one doesn't loop
# we do this to prevent the default idle animation from playing. ##TODO: Could probably add some more checks here.
if animation_index >= mod_animation_sequence.size() and animations.frames.get_animation_loop(
animations.animation) == false:
animations.stop()
# Singal based frame call. # Singal based frame call.
if emitter_frame_subscriptions.has(animations.frame): if emitter_frame_subscriptions.has(animations.frame):
@ -176,6 +249,7 @@ func process_frame(_delta: float) -> State:
else: else:
frame_signal_emitted = false frame_signal_emitted = false
func process_frame(_delta: float) -> State:
return null return null
func process_physics(_delta: float) -> State: func process_physics(_delta: float) -> State:
@ -186,53 +260,194 @@ func process_physics(_delta: float) -> State:
# if animations.frames.get_animation_loop(animations.animation) == false: # if animations.frames.get_animation_loop(animations.animation) == false:
# animation_index += 1 # animation_index += 1
func move_actor_as_desired(delta: float): func move_actor_as_desired(delta: float, x_move_direction_override: float = 0):
move_component.velocity.y += gravity * delta
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1)) var _move_speed = move_speed
move_component.velocity.x = move_component.desired_movement_vector.x * move_speed var _move_speed_modifier = move_speed_modifier
move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1)) var _move_modifier_move_acceleration = move_modifier_move_acceleration
var _move_acceleration = move_acceleration
var _jerk_factor = jerk_factor
var _gravity = gravity
func push_animation_state_modifier(modifier: StateModifier): if physics_modifier:
## This function attempt to optimally place multiple modifiers in an array #physics_modifier.modifier_properties.jerk_factor
# in such a way where the first elements are modifiers without animation changes #print(physics_modifier.name)
# the last elements are animation changes or animation suffixes. #UiManager.debug_text = physics_modifier.name + str(round(adjusted_move_speed))
# there is some potential for performance issues at scale with this kinds of operations. var mod_props :ModifierProperties = physics_modifier.get_modifier_properties()
if mod_props.move_speed != 0 and mod_props.directional_modifier == false:
# This function will grow in complexity as needed but the idea is that here is _move_speed = mod_props.move_speed
# where different modifier logic can be tested and developed. _move_speed_modifier += mod_props.move_speed_modifier
_move_acceleration += mod_props.move_acceleration
# First assure this modifer isn't already there. If it is, maybe I should reset it? _move_modifier_move_acceleration += mod_props.move_modifier_move_acceleration
if modifier_stack_ref.has(modifier) == false: _jerk_factor += mod_props.jerk_factor
modifier.enter() # call enter function of the modifier
if modifier_stack_ref.size() > 0: # only bother with this if multiple modifers applied var help_me_not_be_dumb = ''
# Get the last modifier in the stack
var last_modifer: StateModifier = modifier_stack_ref[-1] # Allow us to bump out of halt.
# If the modifier at the back and the new one are the same type, we have a problem. if _move_speed == 0 and move_component.desired_movement_vector.x != 0:
if last_modifer.modifier_type == modifier.modifier_type and last_modifer.modifier_type != 'None': _move_speed = abs(move_component.desired_movement_vector.x)
print("WARNING: Multiple same type modifiers applying.")
# Replace the modifier # Determine or physics movement direction
modifier_stack_ref.pop_back() var current_x_velocity = move_component.velocity.x #move_component.velocity.x
modifier_stack_ref.push_back(modifier) var move_direction = 0.0
else: # Determine movement direction if we have momentum
match last_modifer.modifier_type: if move_component.momentum.x != 0:
"None": if x_move_direction_override == 0:
# no special processing, push it to the front of a list move_direction = sign(current_x_velocity)
modifier_stack_ref.push_front(modifier) # if move_component.desired_movement_vector.x != 0:
"Exit Animation": # # set the move direction to the desired direction
if modifier.modifier_type == "Animation Suffix": # move_direction = move_component.desired_movement_vector.x
# We place this at the back so we can still modify it maybe? # else:
modifier_stack_ref.push_back(modifier) # # Set move direction to the transform direction
"Animation Suffix": # move_direction = parent.transform.x.x
if modifier.modifier_type == "Exit Animation":
# We have to place this one right before maybe?
# Whoops! Forgot to actually do this
#modifier_stack_ref.push_back(modifier)
modifier_stack_ref.insert(modifier_stack_ref.size() - 1, modifier)
# if last_modifer.animation_name != '': # and if an animation applies
# if last_modifer.pre_append_animation == modifier.pre_append_animation: # They're the same type
# if modifier.pre_append_animation == true and modifier_stack_ref[-1].animation_suffix == true:
# modifier.animation_suffix
# modifier_stack_ref.push_back(modifier)
else: else:
modifier_stack_ref.push_front(modifier) move_direction = x_move_direction_override
else: # No current momentum in place
if x_move_direction_override == 0:
move_direction = move_component.desired_movement_vector.x
else:
move_direction = x_move_direction_override
## TODO: I hate that I have to do this check again.
if physics_modifier:
var mod_props :ModifierProperties = physics_modifier.get_modifier_properties()
if mod_props.move_speed != 0 and mod_props.directional_modifier == true:
# Since move_direction is always positive
if sign(move_direction) == sign(mod_props.move_speed):
_move_speed += mod_props.move_speed
else:
_move_speed -= mod_props.move_speed
if sign(move_direction) == 0:
move_direction = sign(mod_props.move_speed) * -1
#print("doing this? ")
# Determine the maximum move speed
var MAX_SPEED :float = 0
var MIN_SPEED :float = 0
if sign(_move_speed_modifier) == -1: # decreased speed modifier
help_me_not_be_dumb += '-SpeedMod'
# Move speed cannot go below zero with modifier applied
MIN_SPEED = _move_speed + _move_speed_modifier
# Poor man's clamp
if MIN_SPEED < 0:
MIN_SPEED = 0
MAX_SPEED = _move_speed
elif sign(_move_speed_modifier) == +1: # increased speed modifier
help_me_not_be_dumb += '+SpeedMod'
MIN_SPEED = _move_speed
MAX_SPEED = _move_speed + _move_speed_modifier
else: # physics won't apply here
help_me_not_be_dumb += '_Speed' # Neutral Speed
MIN_SPEED = _move_speed
MAX_SPEED = _move_speed
# get the latest aggregate acceleration
# If we have any acceleration applying
if (_move_modifier_move_acceleration + _move_acceleration) != 0:
# The acceleration is differant
# Perhaps it would be better to trigger this on a difference in modifier but they usually go together.
if abs(move_component.acceleration.x) != abs(_move_modifier_move_acceleration + _move_acceleration):
if move_direction:
print("Acceleration changed.", abs(move_component.acceleration.x), "-", (_move_modifier_move_acceleration + _move_acceleration))
move_component.acceleration.x = _move_modifier_move_acceleration + _move_acceleration
# If we're no longer tryingg to move int the direction of our movement and momentum.
if sign(current_x_velocity) != sign(move_component.desired_movement_vector.x) and move_component.momentum.x != 0:
if sign(_move_speed_modifier) == -1 : # decreased speed modifier
# Maybe we can compare the direction of the acceleration
# The direction of the acceleration should usually be positive at this point.
# when the modifier is negative.
if sign(move_direction) == sign(current_x_velocity):
if sign(move_component.acceleration.x) == sign(move_component.momentum.x):
print("Whoh Woah")
# Flip the direction of the acceleration
move_component.acceleration.x *= -1
if (sign(move_component.desired_movement_vector.x) == -1 and
sign(current_x_velocity) == 1) or (sign(move_component.desired_movement_vector.x) == -1 and
sign(current_x_velocity) == -1):
print("be more opposite")
# if sign(_move_speed_modifier) == 1: # increased speed modifier
# print("faster faster.")
elif sign(move_component.desired_movement_vector.x) == sign(current_x_velocity) and move_component.momentum.x != 0:
if sign(move_component.acceleration.x) != sign(move_component.momentum.x) and x_move_direction_override == 0:
print("Step it up!")
# Flip the direction of the acceleration
move_component.acceleration.x *= -1
# Apply momentum and acceleration if a modifer exists
if move_component.momentum.x <= 0 and _move_speed_modifier !=0:
#if we're trying to move but we have no momentum applied currently
#if move_component.desired_movement_vector.x != 0:
if move_direction:
move_component.acceleration.x = _move_modifier_move_acceleration + _move_acceleration
##TODO: I don't know where I should actually set the momentum. :
if sign(_move_speed_modifier) == -1: # decreased speed modifier
move_component.momentum.x = 0
elif sign(_move_speed_modifier) == +1: # increased speed modifier
##TODO: in most cases this should only be applied once. need to find a way to warn against this.
move_component.momentum.x = abs(move_speed_modifier)
print("momentum applied!")
# Reverse the accelerations if we carry over momentum but the modifier no longer applies.
if move_component.momentum.x > 0 and _move_speed_modifier == 0:
if sign(move_component.acceleration.x) == sign(move_component.momentum.x):
print("Whoh Woah your done.")
# Flip the direction of the acceleration
move_component.acceleration.x *= -1
# We're going to adjust our move speed only to the modifier
move_component.momentum.x += move_component.acceleration.x * delta
jerk += _jerk_factor * delta
var new_move_speed :float = 0
if sign(_move_speed_modifier) == -1: # decreased speed modifier
# MIN_SPEED = _move_speed + _move_speed_modifier
# MAX_SPEED = _move_speed
move_component.momentum.x = clamp(move_component.momentum.x, 0, abs(_move_speed_modifier))
# new_move_speed = (_move_speed + _move_speed_modifier ) + (sign(_move_speed_modifier) * -1 * move_component.momentum.x) # + jerk
new_move_speed = MIN_SPEED + (sign(_move_speed_modifier) * -1 * move_component.momentum.x) # + jerk
elif sign(_move_speed_modifier) == +1: # increased speed modifier
# MIN_SPEED = _move_speed
# MAX_SPEED = _move_speed + _move_speed_modifier
move_component.momentum.x = clamp(move_component.momentum.x, 0, _move_speed_modifier )
new_move_speed = _move_speed + move_component.momentum.x # + jerk
else: # physics won't apply here
# move_component.acceleration.x = 0
# move_component.momentum.x = 0
# new_move_speed = _move_speed
move_component.momentum.x = clamp(move_component.momentum.x, 0, MIN_SPEED )
new_move_speed = _move_speed + move_component.momentum.x # + jerk
#new_move_speed = clamp(new_move_speed, MIN_SPEED, MAX_SPEED)
var sim_move_speed = (MIN_SPEED + (sign(_move_speed_modifier) * -1 * move_component.momentum.x))
# if move_component.momentum.x != 0:
if true:
UiManager.debug_text = ( "Mod(" + str(sign(_move_speed_modifier)) + ") Dir(" + str(move_direction) + ") Vel(" + str(sign(current_x_velocity)) + ") Mov(" + str(sign(move_component.desired_movement_vector.x)) +
")\nNS:" + str(round(sim_move_speed)) + #" Z:" + str(sign(_move_speed_modifier) * -1 * move_component.momentum.x) +
"\nS:" + str(round(_move_speed + _move_speed_modifier)) + ",M" + str(round(move_component.momentum.x)) +
",A" + str(round(move_component.acceleration.x)) +
"\nVel:" + str(round(move_component.velocity.x)) + "Min:" + str(round(MIN_SPEED)) + ",Max:" + str(round(MAX_SPEED))
) # str(round(jerk))
move_component.sim_velocity.x = move_direction * sim_move_speed
#print(adjusted_move_speed, ",", new_move_speed, ",", jerk)
#print(new_move_speed, " ", adjusted_move_speed)
move_component.velocity.y += _gravity * delta
#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
#print(speed_multiplier)
# move_component.velocity.x = move_component.desired_movement_vector.x * _move_speed
move_component.velocity.x = move_direction * new_move_speed
#move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2.UP)
var snap = Vector2.DOWN * 8
if move_component.velocity.y < -8:
snap = Vector2.ZERO
move_component.velocity = parent.move_and_slide_with_snap(move_component.velocity, snap , Vector2.UP, true)

View File

@ -4,7 +4,7 @@ export (NodePath) var starting_state
export var debug_state_machine: bool = false export var debug_state_machine: bool = false
var current_state: State var current_state: State
var state_modifiers: Array #var state_modifiers: Array
# Initialize the state machine by giving each child state a reference to the # Initialize the state machine by giving each child state a reference to the
# parent object it belongs to and enter the default starting_state. # parent object it belongs to and enter the default starting_state.
@ -13,7 +13,7 @@ func init() -> void:
if child is State: if child is State:
if debug_state_machine: if debug_state_machine:
print("Initializing State Node: ", child.name) print("Initializing State Node: ", child.name)
child.modifier_stack_ref = state_modifiers # child.modifier_stack_ref = state_modifiers
if debug_state_machine: if debug_state_machine:
child.debug_state = true child.debug_state = true
@ -27,10 +27,10 @@ func change_state(new_state: State) -> void:
current_state = new_state current_state = new_state
current_state.enter() current_state.enter()
if(state_modifiers.size() > 0 and debug_state_machine): # if(state_modifiers.size() > 0 and debug_state_machine):
print("Active Modifiers:") # print("Active Modifiers:")
for mods in state_modifiers: # for mods in state_modifiers:
print(mods.name) # print(mods.name)
# Pass through functions for the Player to call, # Pass through functions for the Player to call,
# handling state changes as needed. # handling state changes as needed.

View File

@ -1,25 +1,37 @@
class_name StateMachineAnimatedActor extends StateMachine class_name StateMachineAnimatedActor extends StateMachine
#var physics_modifier : StateModifier
func change_state(new_state: State) -> void: func change_state(new_state: State) -> void:
if new_state.state_ready == false:
# Don't transition to unready state
return
if current_state: if current_state:
current_state.exit() current_state.exit()
# Set parameters for information
# Set parameters for information if new_state is StateAnimatedActor and current_state is StateAnimatedActor:
if new_state is StateAnimatedActor and current_state is StateAnimatedActor: set_previous_animation( current_state, new_state)
set_previous_animation( current_state, new_state) if current_state.modifier: # Current state has a modifier
new_state.transfer_modifiers(current_state.modifier)
current_state.modifier = null
if current_state.physics_modifier: # Current state has a physics modifier
new_state.physics_modifier = current_state.physics_modifier
current_state.physics_modifier = null
current_state = new_state current_state = new_state
current_state.enter() current_state.enter()
if(state_modifiers.size() > 0 and debug_state_machine): # if(state_modifiers.size() > 0 and debug_state_machine):
print("Active Modifiers:") # print("Active Modifiers:")
for mods in state_modifiers: # for mods in state_modifiers:
print(mods.name) # print(mods.name)
func set_previous_animation( old_state: StateAnimatedActor, new_state: StateAnimatedActor ) -> void: func set_previous_animation( old_state: StateAnimatedActor, new_state: StateAnimatedActor ) -> void:
new_state.previous_animation_name = old_state.mod_animation_sequence[old_state.current_animation_sequence] # added this to help prevent nul index crashes. (Usually because of signal based state changes.)
if old_state.mod_animation_sequence:
new_state.previous_animation_name = old_state.mod_animation_sequence[old_state.current_animation_sequence]
new_state.previous_state_frame_number = old_state.animations.frame new_state.previous_state_frame_number = old_state.animations.frame
new_state.previous_state_name = old_state.name new_state.previous_state_name = old_state.name
new_state.previous_speed_multiplier = old_state.speed_multiplier
#animation_name :String, frame_number : int, animation_sequence :Array #animation_name :String, frame_number : int, animation_sequence :Array
return return
@ -34,7 +46,7 @@ func init_animated_actor(parent: KinematicBody2D, animations: AnimatedSprite, mo
child.parent = parent child.parent = parent
child.animations = animations child.animations = animations
child.move_component = move_component child.move_component = move_component
child.modifier_stack_ref = state_modifiers # child.modifier_stack_ref = state_modifiers
if debug_state_machine: if debug_state_machine:
child.debug_state = true child.debug_state = true
@ -47,95 +59,67 @@ func process_frame(delta: float) -> void:
# If the modifier is no longer valid, pop it from the stack. # If the modifier is no longer valid, pop it from the stack.
# We could iterate through a whole list of states but I'm not sure i want # We could iterate through a whole list of states but I'm not sure i want
# states to be that complex. # states to be that complex.
var current_anim_state :StateAnimatedActor = current_state # var current_anim_state :StateAnimatedActor = current_state
if state_modifiers.empty() == false: # if state_modifiers.empty() == false:
for i in range(state_modifiers.size()): # for i in range(state_modifiers.size()):
# if this modifer is a timer based one # # if this modifer is a timer based one
if state_modifiers[i].state_timeout.time_left == 0 and state_modifiers[i].timeout_seconds !=0: # if state_modifiers[i].state_timeout.time_left == 0 and state_modifiers[i].timeout_seconds !=0:
# Need to do extra stuff if it's an animation based one # # Need to do extra stuff if it's an animation based one
if state_modifiers[i].modifier_type == "Animation Suffix": # if state_modifiers[i].modifier_type == "Animation Suffix":
if debug_state_machine: # if debug_state_machine:
print("State Modifier Timeout: ", state_modifiers[i].name, " -> ", state_modifiers[i].animation_name) # print("State Modifier Timeout: ", state_modifiers[i].name, " -> ", state_modifiers[i].animation_name)
# Reset animation suffix # # Reset animation suffix
current_anim_state.animation_suffix = '' # current_anim_state.animation_suffix = ''
# Get the current frame of animation # # Get the current frame of animation
var current_frame = current_anim_state.animations.frame # var current_frame = current_anim_state.animations.frame
#
# Set the animation index to the current one # # Set the animation index to the current one
current_anim_state.animation_index = current_anim_state.current_animation_sequence # current_anim_state.animation_index = current_anim_state.current_animation_sequence
#current_anim_state.current_animation_sequence # #current_anim_state.current_animation_sequence
#current_anim_state.animations.play() # #current_anim_state.animations.play()
#
current_anim_state.animations.play( # current_anim_state.animations.play(
current_anim_state.mod_animation_sequence[current_anim_state.animation_index]) # current_anim_state.mod_animation_sequence[current_anim_state.animation_index])
# Try to set the current frame to the same as before. # # Try to set the current frame to the same as before.
current_anim_state.animations.frames.frames.size() >= current_frame # current_anim_state.animations.frames.frames.size() >= current_frame
current_anim_state.animations.frame = current_frame # current_anim_state.animations.frame = current_frame
#
##TODO: # if debug_state_machine:
# no longer needed this way maybe. way to overengineer man. # print("Pop State Modifier: ", state_modifiers[i].name)
# if current_anim_state.animation_sequence.size() >= current_anim_state.mod_animation_sequence.size(): # state_modifiers.pop_at(i)
# print("Change sequence!: ", current_anim_state.mod_animation_sequence) if current_state is StateAnimatedActor:
# print("Origin sequence!: ", current_state.mod_animation_sequence) current_state.process_animations()
# current_anim_state.animations.play(
# current_anim_state.mod_animation_sequence[current_anim_state.animation_index])
# # Try to set the current frame to the same as before.
# current_anim_state.animations.frames.frames.size() >= current_frame
# current_anim_state.animations.frame = current_frame
# else:
# current_anim_state.animations.play(
# current_anim_state.animation_sequence[0])
if debug_state_machine:
print("Pop State Modifier: ", state_modifiers[i].name)
state_modifiers.pop_at(i)
# if state_modifiers[-1].state_timeout.time_left == 0 and state_modifiers[-1].pre_append_animation == false:
# if debug_state_machine:
# print("Pop State Modifier: ", state_modifiers[-1].name)
# state_modifiers.pop_back()
# # Reset animation suffix
# current_state.animation_suffix = ''
# var current_frame = current_state.animations.frame
# #current_state.animations.play(current_state.animation_sequence[current_state.animation_index])
# #TODO: Bodge to fix crash
# current_state.animation_index = 0
# current_state.current_animation_sequence = 0
# current_state.animations.play(current_state.animation_sequence[0])
# current_state.animations.frame = current_frame;
var new_state = current_state.process_frame(delta) var new_state = current_state.process_frame(delta)
if new_state: if new_state:
change_state(new_state) change_state(new_state)
func _on_AnimatedSprite_animation_finished(): func _on_AnimatedSprite_animation_finished():
# if debug_state_machine:
# print("Stop!!!!!")
##TODO: ##TODO:
# It's hard to pop an exit animation off when it's stacked with another kind of animation. # It's hard to pop an exit animation off when it's stacked with another kind of animation.
for i in state_modifiers.size(): # for i in state_modifiers.size():
if state_modifiers[i].modifier_type == "Exit Animation": # if state_modifiers[i].modifier_type == "Exit Animation":
#print("Time to pop state modifer: ", state_modifiers[i].animation_name, current_state.animation_suffix, " <-> ", current_state.animations.animation + current_state.animation_suffix) # #print("Time to pop state modifer: ", state_modifiers[i].animation_name, current_state.animation_suffix, " <-> ", current_state.animations.animation + current_state.animation_suffix)
if (state_modifiers[i].animation_name + current_state.animation_suffix) == current_state.animations.animation: # if (state_modifiers[i].animation_name + current_state.animation_suffix) == current_state.animations.animation:
print("Time to pop state modifer: ", state_modifiers[i].animation_name, current_state.animation_suffix, " <-> ", current_state.animations.animation ) # print("Time to pop state modifer: ", state_modifiers[i].animation_name, current_state.animation_suffix, " <-> ", current_state.animations.animation )
print(current_state.mod_animation_sequence) # print(current_state.mod_animation_sequence)
state_modifiers.pop_at(i) # state_modifiers.pop_at(i)
current_state.animation_index += 1 # current_state.animation_index += 1
break # break
# if current_state is StateAnimatedActor:
# if state_modifiers.empty() == false: # current_state.animation_finished = true
# if state_modifiers[-1].pre_append_animation == true:
# if debug_state_machine:
# print("Pop State Modifier: ", state_modifiers[-1].name)
# state_modifiers.pop_back()
##TODO:
# consider just stopping the animation and index increment here.
if current_state.animations.frames.get_animation_loop( if current_state.animations.frames.get_animation_loop(
current_state.animations.animation) == false: current_state.animations.animation) == false:
#print("Stop!!!!!", current_state.animation_sequence.size(), " - ", current_state.animation_index)
if current_state.animation_sequence.size() > 0: if current_state.animation_sequence.size() > 0:
print("<-- next anim.") #print("<-- next anim.")
current_state.animation_index += 1 current_state.animation_index += 1
if current_state.animation_index >= current_state.animation_sequence.size():
#print("Stop!!!!!")
current_state.animation_finished = true

View File

@ -1,5 +1,5 @@
class_name StateModifier class_name StateModifier
extends Node extends Reference
## State modification ## State modification
## ##
## A state modifier doesn't have any direct control of a game object. ## A state modifier doesn't have any direct control of a game object.
@ -10,26 +10,41 @@ extends Node
## ##
## @WIP ## @WIP
export var debug_state: bool = false enum TYPE {NONE,EXIT_ANIMATION, ANIMATION_SUFFIX, REPLACE_ANIMATION}
export var animation_name: String var debug_state: bool = false
## These should be the original properties set when the modifier is created.
# property changes can be applied over time but these are the instantiated values.
var modifier_properties: ModifierProperties
## Animation modifier variables
## The name of the animation that could be applied and starting frame
var animation_name: String
var starting_frame: int = 0
##TODO: Animation speed
## Modification Type ## Modification Type
## if an animation is specified, the default behavior will be just to override ## if an animation is specified, the default behavior will be just to override
## the state animation. Or perform a 'Replace Animation' ## the state animation. Or perform a 'Replace Animation'
export(String, "None", var modifier_type = TYPE.NONE
"Exit Animation",
"Animation Suffix", var name :String = ''
"Replace Animation") var modifier_type = "None"
# Move Speed in Pixels Per Second
# These should only apply if Modification Type Set to None.
# (But I'm not sure if I like that model.)
#var move_speed: float
#var move_speed_modifier: float = 0
#var move_speed_modifier_decay: float = 0
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
export var starting_frame: int = 0
export var move_speed: float = 60
export var timeout_seconds: float = 0.0
# Attempting to use this as an animation suffix that can linger after # Attempting to use this as an animation suffix that can linger after
# state transition like 'run-fire' to 'idle-fire' 'jump-fire' etc. # state transition like 'run-fire' to 'idle-fire' 'jump-fire' etc.
export var animation_suffix: bool = false #var animation_suffix: bool = false
export var pre_append_animation: bool = false #var pre_append_animation: bool = false
# not sure if I can do the array thing from state change. Maybe? # not sure if I can do the array thing from state change. Maybe?
# disabling this sequencing for now. # disabling this sequencing for now.
@ -37,32 +52,82 @@ export var pre_append_animation: bool = false
# var animation_index: int = 0 # var animation_index: int = 0
# var current_animation_sequence: int = 0 # var current_animation_sequence: int = 0
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
#var animation_sequence_timer: Timer #var animation_sequence_timer: Timer
var state_timeout: Timer var state_timeout: Timer
var timeout_seconds: float = 0.0
func _ready(): # Meant to be called on timeout or other counters this modifier may have.
# Should be updated whenever modifier owner transfers
var state_call_function: FuncRef
## Can't do it this way.
#func copy_modifier() -> StateModifier:
# var new_modifier = StateModifier.new()
# new_modifier.ready(animation_name, modifier_type, timeout_seconds)
#
# return StateModifier.new()
#
func merge_modifier(merging_mod: ModifierProperties):
if merging_mod.modifier_type != TYPE.NONE:
print("Warning Merging modifier types that aren't set to 'none' is not supported!")
return
# Can't support timeouts or animation stuff right now.
#timeout_seconds = merging_mod.timeout_seconds
# move_speed = merging_mod.move_speed
# gravity = merging_mod.gravity
# move_speed_modifier = merging_mod.move_speed_modifier
# move_speed_modifier_decay = merging_mod.move_speed_modifier_decay
func get_modifier_properties() -> ModifierProperties:
#( p_move_speed:float, p_gravity:int , p_move_acceleration , p_move_speed_modifier:float,
# p_move_modifier_move_acceleration:float, p_jerk_factor: float):
var mp = ModifierProperties.new( modifier_properties.move_speed,
modifier_properties.gravity,
modifier_properties.move_acceleration,
modifier_properties.move_speed_modifier,
modifier_properties.move_modifier_move_acceleration,
modifier_properties.jerk_factor)
mp.directional_modifier = modifier_properties.directional_modifier
return mp
func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeout : float = 0, parent:Node = null, function_name : String = "") -> Timer:
name = modifier_name
# If somebody forgot to specify the type # If somebody forgot to specify the type
if animation_name != '' and modifier_type == "None": if anim_name != '' and type == TYPE.NONE:
modifier_type = "Replace Animation" modifier_type = TYPE.REPLACE_ANIMATION
state_timeout = Timer.new() animation_name = anim_name
if timeout_seconds > 0: modifier_type = type
state_timeout.wait_time = timeout_seconds # if parent != null and function_name != "":
state_timeout.one_shot = true # state_call_function = funcref(parent, function_name)
state_timeout.autostart = false
add_child(state_timeout)
func enter() -> void: modifier_properties = ModifierProperties.new(0,0,0,0,0,0)
if debug_state:
print("Apply State Modifier: ", self.name)
state_timeout.start()
#modifier_stack_ref = state_modifiers
return
func exit() -> void: if timeout > 0:
pass state_timeout = Timer.new()
state_timeout.wait_time = timeout
state_timeout.one_shot = true
state_timeout.autostart = false
return state_timeout
#add_child(state_timeout)
#ModifierProperties.new()
return null
func _update():
pass ## Transfer and callback related methods. These sort of worked but I didn't end up using them
## They're an interesting idea though.
func transfer_owner(parent:Node):
print("Modifier owner will now be: ", parent.name)
state_call_function = funcref(parent, 'update_animation')
func _on_Timer_timeout():
#print("Oh Crap! I can't beleive it worked")
if state_call_function:
if state_call_function.is_valid():
state_call_function.call_func()
else:
print("Warning! Modifier timed out with no callback to alert.")
else:
print("Warning! no function applies.")

View File

@ -0,0 +1,28 @@
class_name ModifierProperties
extends Reference
var modifier_type: int = 0
#var timeout_seconds: float = 0.0
var move_speed: float = 0.0
var move_acceleration: float = 0.0
var move_speed_modifier: float = 0.0
var move_modifier_move_acceleration: float = 0.0
var jerk_factor: float = 0
var gravity:int = 0
# Bad name. Just means that it is intended to apply in a certain direction
# (Positive or negative) not an offset of the existing values.
var directional_modifier: bool = false
func _init( p_move_speed:float, p_gravity:int , p_move_acceleration , p_move_speed_modifier:float,
p_move_modifier_move_acceleration:float, p_jerk_factor: float):
#timeout_seconds = p_timeout_seconds
move_speed = p_move_speed
move_acceleration = p_move_acceleration
gravity = p_gravity
move_speed_modifier = p_move_speed_modifier
move_modifier_move_acceleration = p_move_modifier_move_acceleration
jerk_factor = p_jerk_factor

View File

@ -1,59 +0,0 @@
extends Actor
onready var actor_hurtbox = $Hurtbox_Component/CollisionShape2D
#var sound_effects = preload("res://src/playerC/resources/sound_effects.tres")
func _ready() -> void:
movement_state_machine.init_animated_actor(self, movement_animations, movement_component)
# Experimenting with sound based resources I did this and it worked
#sound_effect_player.stream = sound_effects.sounds["pew"]
#print(sounds.sounds["pew"])
#sound_effects.play()
# Trying something new with a custom resourse.
for i in SoundEffects:
sound_effects_dict[i.animation_name + str(i.frame_number)] = i.sound
print (sound_effects_dict)
func _unhandled_input(event: InputEvent) -> void:
movement_state_machine.process_input(event)
func _physics_process(delta: float) -> void:
movement_state_machine.process_physics(delta)
# #TODO: So much hack
# if direction.x != 0:
# gun.set_scale( Vector2(direction.x,1))
# Commented out to try parent transforms instead
# if direction.x < 0:
# var t = Transform2D()
# # Translation
# t.origin = Vector2(gun.offset_position.x * -1, gun.offset_position.y)
# gun.transform = t
# elif direction.x > 0:
# var t = Transform2D()
# # Translation
# t.origin = Vector2(gun.offset_position.x, gun.offset_position.y)
# gun.transform = t
# Attempting a Kinematic2D level scale for flip operations instead.
#self.transform
#self.scale.x = -1
func _process(delta: float) -> void:
movement_component.process(delta)
movement_state_machine.process_frame(delta)
play_sound_frame(movement_animations.animation , movement_animations.frame)
##TODO: I don't like player class having do do this.
## Figure out how to programatically signal subscribe
#func _on_AnimatedSprite_animation_finished():
# if movement_animations.frames.get_animation_loop(movement_animations.animation) == false:
# movement_state_machine.current_state.animation_index += 1

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1] [ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/state_machine_animated_actor.gd" type="Script" id=2] [ext_resource path="res://src/state_machine_animated_actor.gd" type="Script" id=2]
@ -41,9 +41,6 @@ animations = [ {
"speed": 5.0 "speed": 5.0
} ] } ]
[sub_resource type="RectangleShape2D" id=74]
extents = Vector2( 14, 18.5 )
[sub_resource type="CircleShape2D" id=82] [sub_resource type="CircleShape2D" id=82]
[node name="ActorTemplate" type="KinematicBody2D"] [node name="ActorTemplate" type="KinematicBody2D"]
@ -52,7 +49,7 @@ script = ExtResource( 8 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."] [node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 75 ) frames = SubResource( 75 )
frame = 4 frame = 3
playing = true playing = true
flip_h = true flip_h = true
__meta__ = { __meta__ = {
@ -68,10 +65,6 @@ __meta__ = {
} }
} }
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -3.5 )
shape = SubResource( 74 )
[node name="movement_component" type="Node" parent="."] [node name="movement_component" type="Node" parent="."]
script = ExtResource( 5 ) script = ExtResource( 5 )

View File

@ -0,0 +1,48 @@
class_name Interactable
extends Area2D
## I'm not quite sure what to do with this yet but the idea is having an
# area2d that detects not just a body entering a certain zone but triggering an
# interract status. For a player this would probably be pressing a button.
# the component can perhaps have a prompt of some sort to indicate what they're
# supposed to do. Additionaly the interraction could perhaps trigger some
# sort of animation when the action is performed.
# This may have to be implemented as a bi-directional mediator pattern where
# the player node is given some sort of call back upon entering the region and
# when it happens it fires off that call back.
# This means that whatever entity that is supposed to interract with these
# objects should also have a receiver function of some kind.
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var type_name :String
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func trigger_interaction():
# This is something that should maybe be extended for every differant interactible.
# They could inherit from this base class and implement this function.
# sprite.frame = 1
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
# When a body enters this area
# We want to give that body (a player I assume) a callback or a reference to this
# Node.
func _on_Interactable_Component_body_entered(body):
var colliding_node = body
if colliding_node.has_node("Interactable_Receiver"):
colliding_node.get_node("Interactable_Receiver").register_interactable(self)
func _on_Interactable_Component_body_exited(body):
var colliding_node = body
if colliding_node.has_node("Interactable_Receiver"):
colliding_node.get_node("Interactable_Receiver").remove_interactable(self)

View File

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/templates/Interactable/Interactable_Component.gd" type="Script" id=2]
[node name="Interactable_Template" type="Area2D"]
script = ExtResource( 2 )
[connection signal="body_entered" from="." to="." method="_on_Interactable_Component_body_entered"]
[connection signal="body_exited" from="." to="." method="_on_Interactable_Component_body_exited"]

View File

@ -0,0 +1,48 @@
class_name Interactable_Receiver
extends Node2D
# This may be stupid but we're going to have two kinds of callbacks here.
# It's going to be up to the parent/actor/kinematicbody2d/whatever to know
# what conditions have to be met before being able to call that interactible's
# function.
# This is a nice and generic interface that I might be able to use for
# things like opening doors in a level, opening chests/flipping switches etc.
# This node can keep an array of various interactibles within a level
# and provide several helper functions for managing them perhaps.
export(String) var interactable_parent_callback = ""
var call_function: FuncRef
var interactable_function_callables = []
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
if interactable_parent_callback:
call_function = funcref(owner, interactable_parent_callback)
else:
print("Warning: No interactable receiver function defined on ", owner.name)
# Switching to a new model that starts with Hitbox
func register_interactable(sender):
print("Interactable Registered " + sender.name)
if call_function.is_valid():
var should_register: bool = call_function.call_func(sender)
if should_register:
interactable_function_callables.append(sender)
else:
print("Interactable handled by Player")
func remove_interactable(sender):
print("Interactable Removal " + sender.name)
if interactable_function_callables.has(sender):
var sender_index = interactable_function_callables.rfind(sender)
if sender_index != -1:
interactable_function_callables.remove(sender_index)