Compare commits

...

5 Commits

14 changed files with 802 additions and 369 deletions

BIN
assets/Mega.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

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

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Mega.png"
dest_files=[ "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.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

@ -78,6 +78,10 @@ config/name="Mega Moves"
run/main_scene="res://Main.tscn"
config/icon="res://icon.png"
[aseprite]
animation/layers/exclusion_pattern="_"
[autoload]
PlayerInfo="*res://src/singleton_autoloads/PlayerInfo.gd"

View File

@ -130,7 +130,7 @@ actor_type = "Enemy"
position = Vector2( 11, -7 )
frames = SubResource( 20 )
animation = "idle"
frame = 2
frame = 1
__meta__ = {
"_aseprite_wizard_config_": {
"layer": "",

View File

@ -17,3 +17,7 @@ func hit_Receiver(damage):
PlayerInfo.player_health = $Health_Component.health
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
$Hurtbox_Component.set_hurtbox(true)
func _on_attack_do_attack():
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=97 format=2]
[gd_scene load_steps=113 format=2]
[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]
@ -7,405 +7,480 @@
[ext_resource path="res://src/playerD/states/move.gd" type="Script" id=5]
[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/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/playerD/states/attack.gd" type="Script" id=10]
[sub_resource type="StreamTexture" id=1]
[sub_resource type="StreamTexture" id=90]
load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex"
[sub_resource type="AtlasTexture" id=2]
atlas = SubResource( 1 )
region = Rect2( 1680, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=3]
atlas = SubResource( 1 )
region = Rect2( 1920, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=4]
atlas = SubResource( 1 )
region = Rect2( 2160, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=5]
atlas = SubResource( 1 )
region = Rect2( 0, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=6]
atlas = SubResource( 1 )
region = Rect2( 240, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=7]
atlas = SubResource( 1 )
region = Rect2( 480, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=8]
atlas = SubResource( 1 )
region = Rect2( 720, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=9]
atlas = SubResource( 1 )
region = Rect2( 960, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=10]
atlas = SubResource( 1 )
region = Rect2( 1200, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=11]
atlas = SubResource( 1 )
region = Rect2( 1440, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=12]
atlas = SubResource( 1 )
region = Rect2( 960, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=13]
atlas = SubResource( 1 )
region = Rect2( 1200, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=14]
atlas = SubResource( 1 )
region = Rect2( 1440, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=15]
atlas = SubResource( 1 )
region = Rect2( 1680, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=16]
atlas = SubResource( 1 )
region = Rect2( 1920, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=17]
atlas = SubResource( 1 )
region = Rect2( 1200, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=18]
atlas = SubResource( 1 )
region = Rect2( 0, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=19]
atlas = SubResource( 1 )
region = Rect2( 1440, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=20]
atlas = SubResource( 1 )
region = Rect2( 1680, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=21]
atlas = SubResource( 1 )
region = Rect2( 1920, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=22]
atlas = SubResource( 1 )
region = Rect2( 2160, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=23]
atlas = SubResource( 1 )
region = Rect2( 2160, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=24]
atlas = SubResource( 1 )
region = Rect2( 0, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=25]
atlas = SubResource( 1 )
region = Rect2( 240, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=26]
atlas = SubResource( 1 )
region = Rect2( 480, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=27]
atlas = SubResource( 1 )
region = Rect2( 720, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=28]
atlas = SubResource( 1 )
region = Rect2( 960, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=29]
atlas = SubResource( 1 )
region = Rect2( 1200, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=30]
atlas = SubResource( 1 )
region = Rect2( 1920, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=31]
atlas = SubResource( 1 )
region = Rect2( 2160, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=32]
atlas = SubResource( 1 )
region = Rect2( 0, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=33]
atlas = SubResource( 1 )
region = Rect2( 240, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=34]
atlas = SubResource( 1 )
region = Rect2( 480, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=35]
atlas = SubResource( 1 )
region = Rect2( 720, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=36]
atlas = SubResource( 1 )
region = Rect2( 960, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=37]
atlas = SubResource( 1 )
region = Rect2( 1200, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=38]
atlas = SubResource( 1 )
region = Rect2( 1440, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=39]
atlas = SubResource( 1 )
region = Rect2( 1680, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=40]
atlas = SubResource( 1 )
region = Rect2( 1920, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=41]
atlas = SubResource( 1 )
region = Rect2( 2160, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=42]
atlas = SubResource( 1 )
region = Rect2( 0, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=43]
atlas = SubResource( 1 )
region = Rect2( 240, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=44]
atlas = SubResource( 1 )
region = Rect2( 480, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=45]
atlas = SubResource( 1 )
region = Rect2( 720, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=46]
atlas = SubResource( 1 )
region = Rect2( 960, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=47]
atlas = SubResource( 1 )
region = Rect2( 1200, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=48]
atlas = SubResource( 1 )
region = Rect2( 1440, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=49]
atlas = SubResource( 1 )
region = Rect2( 1680, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=50]
atlas = SubResource( 1 )
region = Rect2( 1920, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=51]
atlas = SubResource( 1 )
region = Rect2( 2160, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=52]
atlas = SubResource( 1 )
region = Rect2( 0, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=53]
atlas = SubResource( 1 )
region = Rect2( 240, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=54]
atlas = SubResource( 1 )
region = Rect2( 480, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=55]
atlas = SubResource( 1 )
region = Rect2( 720, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=56]
atlas = SubResource( 1 )
region = Rect2( 960, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=57]
atlas = SubResource( 1 )
region = Rect2( 1200, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=58]
atlas = SubResource( 1 )
region = Rect2( 1440, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=59]
atlas = SubResource( 1 )
region = Rect2( 0, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=60]
atlas = SubResource( 1 )
region = Rect2( 240, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=61]
atlas = SubResource( 1 )
region = Rect2( 480, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=62]
atlas = SubResource( 1 )
region = Rect2( 720, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=63]
atlas = SubResource( 1 )
region = Rect2( 1680, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=64]
atlas = SubResource( 1 )
region = Rect2( 1920, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=65]
atlas = SubResource( 1 )
region = Rect2( 2160, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=66]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=91]
atlas = SubResource( 90 )
region = Rect2( 0, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=67]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=92]
atlas = SubResource( 90 )
region = Rect2( 240, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=68]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=93]
atlas = SubResource( 90 )
region = Rect2( 480, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=69]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=94]
atlas = SubResource( 90 )
region = Rect2( 720, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=70]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=95]
atlas = SubResource( 90 )
region = Rect2( 960, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=71]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=96]
atlas = SubResource( 90 )
region = Rect2( 1200, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=72]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=97]
atlas = SubResource( 90 )
region = Rect2( 1440, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=73]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=98]
atlas = SubResource( 90 )
region = Rect2( 1680, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=74]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=99]
atlas = SubResource( 90 )
region = Rect2( 1920, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=75]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=100]
atlas = SubResource( 90 )
region = Rect2( 2160, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=76]
atlas = SubResource( 1 )
region = Rect2( 0, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=101]
atlas = SubResource( 90 )
region = Rect2( 720, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=77]
atlas = SubResource( 1 )
region = Rect2( 240, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=102]
atlas = SubResource( 90 )
region = Rect2( 960, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=78]
atlas = SubResource( 1 )
region = Rect2( 480, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=103]
atlas = SubResource( 90 )
region = Rect2( 1200, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=79]
atlas = SubResource( 1 )
region = Rect2( 720, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=104]
atlas = SubResource( 90 )
region = Rect2( 1440, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=80]
atlas = SubResource( 1 )
region = Rect2( 960, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=105]
atlas = SubResource( 90 )
region = Rect2( 1680, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=81]
atlas = SubResource( 1 )
region = Rect2( 1200, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=106]
atlas = SubResource( 90 )
region = Rect2( 1200, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=82]
atlas = SubResource( 1 )
region = Rect2( 1440, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=107]
atlas = SubResource( 90 )
region = Rect2( 0, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=83]
atlas = SubResource( 1 )
region = Rect2( 240, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=108]
atlas = SubResource( 90 )
region = Rect2( 1440, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=84]
atlas = SubResource( 1 )
region = Rect2( 480, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=109]
atlas = SubResource( 90 )
region = Rect2( 1680, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=85]
atlas = SubResource( 1 )
region = Rect2( 720, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=110]
atlas = SubResource( 90 )
region = Rect2( 1920, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=86]
atlas = SubResource( 1 )
region = Rect2( 960, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=111]
atlas = SubResource( 90 )
region = Rect2( 2160, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=87]
atlas = SubResource( 1 )
[sub_resource type="AtlasTexture" id=163]
atlas = SubResource( 90 )
region = Rect2( 480, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=112]
atlas = SubResource( 90 )
region = Rect2( 1920, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=113]
atlas = SubResource( 90 )
region = Rect2( 2160, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=114]
atlas = SubResource( 90 )
region = Rect2( 0, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=115]
atlas = SubResource( 90 )
region = Rect2( 240, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=116]
atlas = SubResource( 90 )
region = Rect2( 480, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=117]
atlas = SubResource( 90 )
region = Rect2( 720, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=118]
atlas = SubResource( 90 )
region = Rect2( 960, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=119]
atlas = SubResource( 90 )
region = Rect2( 1440, 320, 240, 160 )
[sub_resource type="SpriteFrames" id=88]
[sub_resource type="AtlasTexture" id=120]
atlas = SubResource( 90 )
region = Rect2( 1680, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=121]
atlas = SubResource( 90 )
region = Rect2( 1920, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=122]
atlas = SubResource( 90 )
region = Rect2( 240, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=123]
atlas = SubResource( 90 )
region = Rect2( 480, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=124]
atlas = SubResource( 90 )
region = Rect2( 720, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=125]
atlas = SubResource( 90 )
region = Rect2( 960, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=126]
atlas = SubResource( 90 )
region = Rect2( 1200, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=127]
atlas = SubResource( 90 )
region = Rect2( 1440, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=128]
atlas = SubResource( 90 )
region = Rect2( 1680, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=129]
atlas = SubResource( 90 )
region = Rect2( 1920, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=130]
atlas = SubResource( 90 )
region = Rect2( 2160, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=131]
atlas = SubResource( 90 )
region = Rect2( 0, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=132]
atlas = SubResource( 90 )
region = Rect2( 240, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=133]
atlas = SubResource( 90 )
region = Rect2( 480, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=134]
atlas = SubResource( 90 )
region = Rect2( 720, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=135]
atlas = SubResource( 90 )
region = Rect2( 960, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=136]
atlas = SubResource( 90 )
region = Rect2( 1200, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=137]
atlas = SubResource( 90 )
region = Rect2( 1440, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=138]
atlas = SubResource( 90 )
region = Rect2( 1680, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=139]
atlas = SubResource( 90 )
region = Rect2( 1920, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=140]
atlas = SubResource( 90 )
region = Rect2( 2160, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=141]
atlas = SubResource( 90 )
region = Rect2( 0, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=142]
atlas = SubResource( 90 )
region = Rect2( 240, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=143]
atlas = SubResource( 90 )
region = Rect2( 480, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=144]
atlas = SubResource( 90 )
region = Rect2( 720, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=145]
atlas = SubResource( 90 )
region = Rect2( 960, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=146]
atlas = SubResource( 90 )
region = Rect2( 1200, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=147]
atlas = SubResource( 90 )
region = Rect2( 1440, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=148]
atlas = SubResource( 90 )
region = Rect2( 1680, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=149]
atlas = SubResource( 90 )
region = Rect2( 1920, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=150]
atlas = SubResource( 90 )
region = Rect2( 2160, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=151]
atlas = SubResource( 90 )
region = Rect2( 240, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=152]
atlas = SubResource( 90 )
region = Rect2( 480, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=153]
atlas = SubResource( 90 )
region = Rect2( 720, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=154]
atlas = SubResource( 90 )
region = Rect2( 960, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=155]
atlas = SubResource( 90 )
region = Rect2( 1200, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=156]
atlas = SubResource( 90 )
region = Rect2( 1440, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=157]
atlas = SubResource( 90 )
region = Rect2( 1680, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=158]
atlas = SubResource( 90 )
region = Rect2( 1920, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=159]
atlas = SubResource( 90 )
region = Rect2( 2160, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=160]
atlas = SubResource( 90 )
region = Rect2( 0, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=161]
atlas = SubResource( 90 )
region = Rect2( 0, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=162]
atlas = SubResource( 90 )
region = Rect2( 240, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=164]
atlas = SubResource( 90 )
region = Rect2( 0, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=165]
atlas = SubResource( 90 )
region = Rect2( 240, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=166]
atlas = SubResource( 90 )
region = Rect2( 480, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=167]
atlas = SubResource( 90 )
region = Rect2( 720, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=168]
atlas = SubResource( 90 )
region = Rect2( 960, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=169]
atlas = SubResource( 90 )
region = Rect2( 1200, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=170]
atlas = SubResource( 90 )
region = Rect2( 1440, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=171]
atlas = SubResource( 90 )
region = Rect2( 1680, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=172]
atlas = SubResource( 90 )
region = Rect2( 1920, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=173]
atlas = SubResource( 90 )
region = Rect2( 2160, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=174]
atlas = SubResource( 90 )
region = Rect2( 0, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=175]
atlas = SubResource( 90 )
region = Rect2( 240, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=176]
atlas = SubResource( 90 )
region = Rect2( 480, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=177]
atlas = SubResource( 90 )
region = Rect2( 720, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=178]
atlas = SubResource( 90 )
region = Rect2( 960, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=179]
atlas = SubResource( 90 )
region = Rect2( 1200, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=180]
atlas = SubResource( 90 )
region = Rect2( 1440, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=181]
atlas = SubResource( 90 )
region = Rect2( 1680, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=182]
atlas = SubResource( 90 )
region = Rect2( 1920, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=183]
atlas = SubResource( 90 )
region = Rect2( 2160, 1440, 240, 160 )
[sub_resource type="AtlasTexture" id=184]
atlas = SubResource( 90 )
region = Rect2( 240, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=185]
atlas = SubResource( 90 )
region = Rect2( 480, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=186]
atlas = SubResource( 90 )
region = Rect2( 720, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=187]
atlas = SubResource( 90 )
region = Rect2( 960, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=188]
atlas = SubResource( 90 )
region = Rect2( 2160, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=189]
atlas = SubResource( 90 )
region = Rect2( 0, 640, 240, 160 )
[sub_resource type="SpriteFrames" id=190]
animations = [ {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
"frames": [ SubResource( 91 ), SubResource( 92 ), SubResource( 93 ), SubResource( 94 ), SubResource( 95 ), SubResource( 96 ), SubResource( 97 ), SubResource( 98 ), SubResource( 99 ), SubResource( 100 ) ],
"loop": true,
"name": "climb",
"speed": 10.0
}, {
"frames": [ SubResource( 12 ), SubResource( 12 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 16 ), SubResource( 16 ) ],
"frames": [ SubResource( 101 ), SubResource( 101 ), SubResource( 101 ), SubResource( 102 ), SubResource( 103 ), SubResource( 104 ), SubResource( 105 ), SubResource( 105 ), SubResource( 105 ) ],
"loop": true,
"name": "dash",
"speed": 10.0
}, {
"frames": [ SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ) ],
"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 ) ],
"loop": true,
"name": "idle",
"speed": 10.0
}, {
"frames": [ SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 24 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ) ],
"frames": [ SubResource( 163 ) ],
"loop": true,
"name": "idle_shoot",
"speed": 5.0
}, {
"frames": [ SubResource( 112 ), SubResource( 113 ), SubResource( 114 ), SubResource( 115 ), SubResource( 113 ), SubResource( 116 ), SubResource( 117 ), SubResource( 118 ) ],
"loop": false,
"name": "jump",
"speed": 10.0
}, {
"frames": [ SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ), SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ), SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ) ],
"frames": [ SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 119 ), SubResource( 120 ), SubResource( 121 ) ],
"loop": true,
"name": "jump_shoot",
"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 ) ],
"loop": true,
"name": "roll",
"speed": 10.0
}, {
"frames": [ SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ), SubResource( 56 ), SubResource( 57 ), SubResource( 58 ) ],
"frames": [ SubResource( 141 ), SubResource( 142 ), SubResource( 143 ), SubResource( 144 ), SubResource( 145 ), SubResource( 146 ), SubResource( 147 ), SubResource( 148 ), SubResource( 149 ), SubResource( 150 ) ],
"loop": true,
"name": "run",
"speed": 10.0
}, {
"frames": [ SubResource( 59 ), SubResource( 60 ), SubResource( 61 ), SubResource( 62 ) ],
"frames": [ SubResource( 151 ), SubResource( 152 ), SubResource( 153 ), SubResource( 154 ), SubResource( 155 ), SubResource( 156 ), SubResource( 157 ), SubResource( 158 ), SubResource( 159 ), SubResource( 160 ) ],
"loop": true,
"name": "run_shoot",
"speed": 10.0
}, {
"frames": [ SubResource( 161 ), SubResource( 162 ), SubResource( 163 ) ],
"loop": true,
"name": "shoot",
"speed": 10.0
}, {
"frames": [ SubResource( 63 ), SubResource( 64 ), SubResource( 65 ), SubResource( 65 ), SubResource( 66 ), SubResource( 67 ), SubResource( 68 ), SubResource( 69 ), SubResource( 69 ), SubResource( 70 ), SubResource( 71 ), SubResource( 72 ), SubResource( 73 ), SubResource( 74 ), SubResource( 75 ), SubResource( 76 ), SubResource( 77 ), SubResource( 78 ), SubResource( 79 ), SubResource( 80 ), SubResource( 81 ), SubResource( 82 ) ],
"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 ) ],
"loop": true,
"name": "slash",
"speed": 10.0
}, {
"frames": [ SubResource( 18 ), SubResource( 83 ), SubResource( 84 ), SubResource( 85 ), SubResource( 86 ) ],
"frames": [ SubResource( 107 ), SubResource( 184 ), SubResource( 185 ), SubResource( 186 ), SubResource( 187 ) ],
"loop": true,
"name": "stand",
"speed": 1.0
}, {
"frames": [ SubResource( 87 ) ],
"frames": [ SubResource( 188 ) ],
"loop": false,
"name": "step",
"speed": 10.0
}, {
"frames": [ SubResource( 189 ) ],
"loop": false,
"name": "step_shoot",
"speed": 10.0
} ]
[sub_resource type="RectangleShape2D" id=89]
@ -418,9 +493,9 @@ player_number = 1
[node name="AnimatedSprite" parent="." index="0"]
position = Vector2( -1, -51 )
frames = SubResource( 88 )
animation = "idle"
frame = 22
frames = SubResource( 190 )
animation = "idle_shoot"
frame = 0
flip_h = false
__meta__ = {
"_aseprite_wizard_config_": {
@ -439,17 +514,55 @@ __meta__ = {
script = ExtResource( 2 )
player_number = 1
[node name="movement_state_machine" parent="." index="3"]
debug_state_machine = true
[node name="idle" parent="movement_state_machine" index="0"]
script = ExtResource( 4 )
animation_sequence = [ "idle" ]
jump_node = NodePath("../jump")
attack_node = NodePath("../attack")
[node name="fall" parent="movement_state_machine" index="1"]
script = ExtResource( 6 )
animation_sequence = [ "jump" ]
landing_node = NodePath("landing")
[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"]
script = ExtResource( 5 )
animation_sequence = [ "run" ]
animation_sequence = [ "step", "run" ]
jump_node = NodePath("../jump")
[node name="jump" type="Node" parent="movement_state_machine" index="3"]
script = ExtResource( 8 )
animation_sequence = [ "jump" ]
idle_node = NodePath("../idle")
fall_node = NodePath("../fall")
jump_force = 250.0
[node name="attack" type="Node" parent="movement_state_machine" index="4"]
script = ExtResource( 10 )
timeout_seconds = 2.0
animation_sequence = [ "shoot" ]
jump_node = NodePath("../jump")
idle_node = NodePath("../idle")
fall_node = NodePath("../fall")
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="Hurtbox_Component" parent="." index="4"]
collision_layer = 16
@ -462,3 +575,5 @@ shape = SubResource( 89 )
[node name="Health_Component" parent="." index="6" instance=ExtResource( 7 )]
max_health = 100
[connection signal="do_attack" from="movement_state_machine/attack" to="." method="_on_attack_do_attack"]

View File

@ -0,0 +1,62 @@
extends StateAnimatedActor
export (NodePath) var jump_node
export (NodePath) var idle_node
export (NodePath) var fall_node
export (NodePath) var move_node
export (NodePath) var draw_weapon_node
onready var jump_state: State = get_node(jump_node)
onready var idle_state: State = get_node(idle_node)
onready var fall_state: State = get_node(fall_node)
onready var move_state: State = get_node(move_node)
onready var weapon_state_modifier: StateModifier = get_node(draw_weapon_node)
var can_fire = true
signal do_attack()
func enter() -> void:
.enter()
state_timeout.start()
can_fire = true
# if modifier_stack_ref.has($"../draw_weapon") == false:
# $"../draw_weapon".enter()
# modifier_stack_ref.push_front($"../draw_weapon")
push_animation_state_modifier(weapon_state_modifier)
func process_frame(delta: float) -> State:
if animations.frame == 2:
animations.stop()
if state_timeout.time_left == 0:
return idle_state
return null
func process_physics(delta: float) -> State:
if can_fire: # trying to do this in the physics because irrecular behavior
emit_signal("do_attack")
can_fire = false
if move_component.wants_jump() and parent.is_on_floor():
return jump_state
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
func exit() -> void:
# force timer reset
weapon_state_modifier.state_timeout.start()
#$"../draw_weapon".state_timeout.start()
return

View File

@ -1,19 +1,34 @@
extends StateAnimatedActor
export (NodePath) var idle_node
export (NodePath) var landing_node
onready var idle_state: State = get_node(idle_node)
onready var landing_mod: StateModifier = get_node(landing_node)
func enter() -> void:
.enter()
# Jump to fall frame
animations.frame = 5
animations.stop()
func process_physics(delta: float) -> State:
#parent.velocity.y += gravity * delta
move_component.velocity.y += gravity * delta
move_component.velocity.x = move_component.desired_movement_vector.x * move_speed
move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
# 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():
return idle_state
return null
func exit() -> void:
.exit()
push_animation_state_modifier(landing_mod)
# $"../landing".enter()
# modifier_stack_ref.push_front($"../landing")
return

View File

@ -2,9 +2,13 @@ extends StateAnimatedActor
export (NodePath) var fall_node
export (NodePath) var move_node
export (NodePath) var jump_node
export (NodePath) var attack_node
onready var fall_state: State = get_node(fall_node)
onready var move_state: State = get_node(move_node)
onready var jump_state: State = get_node(jump_node)
onready var attack_state: State = get_node(attack_node)
func enter() -> void:
.enter()
@ -15,10 +19,11 @@ func enter() -> void:
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 move_component.wants_jump() and parent.is_on_floor():
return jump_state
if move_component.wants_shoot():
return attack_state
move_actor_as_desired(delta)

View File

@ -0,0 +1,32 @@
extends StateAnimatedActor
export (NodePath) var idle_node
export (NodePath) var fall_node
onready var idle_state: State = get_node(idle_node)
onready var fall_state: State = get_node(fall_node)
export var jump_force: float = 200.0
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():
return idle_state
return null

View File

@ -2,11 +2,15 @@ extends StateAnimatedActor
export (NodePath) var fall_node
export (NodePath) var idle_node
export (NodePath) var jump_node
onready var fall_state: State = get_node(fall_node)
onready var idle_state: State = get_node(idle_node)
onready var jump_state: State = get_node(jump_node)
func process_physics(delta: float) -> State:
if move_component.wants_jump() and parent.is_on_floor():
return jump_state
move_actor_as_desired(delta)
@ -14,7 +18,8 @@ func process_physics(delta: float) -> State:
return idle_state
#Flip the character before tha actual move maybe.
parent.transform.x.x = move_component.get_movement_direction()
if move_component.get_movement_direction() != 0.0:
parent.transform.x.x = move_component.get_movement_direction()
if !parent.is_on_floor():
return fall_state

View File

@ -33,6 +33,7 @@ var animation_index: int = 0
var current_animation_sequence: int = 0
var animation_suffix: String = '';
var mod_animation_sequence = [PoolStringArray()]
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
@ -57,31 +58,80 @@ func _ready():
func enter() -> void:
# animations.connect("animation_finished", self, "_on_AnimatedSprite_animation_finished")
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 = ''
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")
#modifier_stack_ref = state_modifiers
# A new attempt at animation modifiers
if modifier_stack_ref.empty() == false:
if modifier_stack_ref[-1].animation_name != '':
if modifier_stack_ref[-1].animation_suffix:
if animation_sequence.size() > 0:
animation_index = 0
current_animation_sequence = 0
# 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):
if animations.frames.has_animation(animation_sequence[animation_index] + modifier_stack_ref[-1].animation_name):
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[-1].animation_name
else:
animations.play(modifier_stack_ref[-1].animation_name)
return
if animation_sequence.size() > 0:
animation_index = 0
current_animation_sequence = 0
animations.play(animation_sequence[animation_index] + animation_suffix)
return
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_stack_ref.empty() == false: # a modifier is applied
# if modifier_stack_ref[-1].animation_name != '': # the first one has an animation
# if modifier_stack_ref[-1].animation_suffix: # it's a suffix type
# if mod_animation_sequence.size() > 0: # the current animation is multipart (sequence > 0)
# animation_index = 0
# current_animation_sequence = 0
# # 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):
# if animations.frames.has_animation(mod_animation_sequence[animation_index] + modifier_stack_ref[-1].animation_name):
# animation_suffix = modifier_stack_ref[-1].animation_name
# elif modifier_stack_ref[-1].pre_append_animation == true: # it's a pre-append type
# #animation_sequence.size()
# print ("DEBUG: A prepend animation")
# #mod_animation_sequence = animation_sequence
# mod_animation_sequence.push_front(modifier_stack_ref[-1].animation_name)
# else:
# animations.play(modifier_stack_ref[-1].animation_name)
# animations.frame = modifier_stack_ref[-1].starting_frame
# return
if mod_animation_sequence.size() > 0:
animations.play(mod_animation_sequence[animation_index] + animation_suffix)
#TODO: maybe check current animatio has this frame
animations.frame = enter_frame
else:
print("Error! Resolved to empty animation sequence!?")
return
func exit() -> void:
emit_signal("state_exited")
@ -92,13 +142,21 @@ func process_input(_event: InputEvent) -> State:
return null
func process_frame(_delta: float) -> State:
if animation_sequence.size() > 0 and current_animation_sequence != animation_index:
if animation_index >= animation_sequence.size():
#if animation_sequence.size() > 0 and current_animation_sequence != animation_index:
if mod_animation_sequence.size() > current_animation_sequence and current_animation_sequence != animation_index:
if animation_index >= mod_animation_sequence.size():
animation_index = 0
##TODO: Add a safety check here.
animations.play(animation_sequence[animation_index] + animation_suffix)
print("An animation sequence: ", animations.animation , animation_index)
animations.play(mod_animation_sequence[animation_index] + animation_suffix)
if debug_state:
print("An animation sequence: ", mod_animation_sequence[animation_index - 1], " -> ",
animations.animation , " (", 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.
if animation_index >= mod_animation_sequence.size() and animations.frames.get_animation_loop(
animations.animation) == false:
animations.stop()
# Singal based frame call.
if emitter_frame_subscriptions.has(animations.frame):
@ -126,3 +184,45 @@ func move_actor_as_desired(delta: float):
move_component.velocity.x = move_component.desired_movement_vector.x * move_speed
move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
func push_animation_state_modifier(modifier: StateModifier):
## This function attempt to optimally place multiple modifiers in an array
# in such a way where the first elements are modifiers without animation changes
# the last elements are animation changes or animation suffixes.
# there is some potential for performance issues at scale with this kinds of operations.
# This function will grow in complexity as needed but the idea is that here is
# where different modifier logic can be tested and developed.
# First assure this modifer isn't already there. If it is, maybe I should reset it?
if modifier_stack_ref.has(modifier) == false:
modifier.enter() # call enter function of the modifier
if modifier_stack_ref.size() > 0: # only bother with this if multiple modifers applied
# Get the last modifier in the stack
var last_modifer: StateModifier = modifier_stack_ref[-1]
# If the modifier at the back and the new one are the same type, we have a problem.
if last_modifer.modifier_type == modifier.modifier_type and last_modifer.modifier_type != 'None':
print("WARNING: Multiple same type modifiers applying.")
# Replace the modifier
modifier_stack_ref.pop_back()
modifier_stack_ref.push_back(modifier)
else:
match last_modifer.modifier_type:
"None":
# no special processing, push it to the front of a list
modifier_stack_ref.push_front(modifier)
"Exit Animation":
if modifier.modifier_type == "Animation Suffix":
# We place this at the back so we can still modify it maybe?
modifier_stack_ref.push_back(modifier)
"Animation Suffix":
if modifier.modifier_type == "Exit Animation":
# We have to place this one right before maybe?
modifier_stack_ref.push_back(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:
modifier_stack_ref.push_front(modifier)

View File

@ -24,22 +24,62 @@ func process_frame(delta: float) -> void:
# 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
# states to be that complex.
var current_anim_state :StateAnimatedActor = current_state
if state_modifiers.empty() == false:
if state_modifiers[-1].state_timeout.time_left == 0:
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])
current_state.animations.frame = current_frame;
for i in range(state_modifiers.size()):
# if this modifer is a timer based one
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
if state_modifiers[i].modifier_type == "Animation Suffix":
# Reset animation suffix
current_anim_state.animation_suffix = ''
var current_frame = current_anim_state.animations.frame
current_anim_state.animation_index = current_anim_state.current_animation_sequence
#current_anim_state.current_animation_sequence
#current_anim_state.animations.play()
if current_anim_state.animation_sequence.size() >= current_anim_state.current_animation_sequence:
current_anim_state.animations.play(
current_state.animation_sequence[current_anim_state.current_animation_sequence])
current_anim_state.animations.frames.frames.size() >= current_frame
current_anim_state.animations.frame = current_frame
else:
current_anim_state.animations.play(
current_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)
if new_state:
change_state(new_state)
func _on_AnimatedSprite_animation_finished():
for i in state_modifiers.size():
if state_modifiers[i].animation_name == current_state.animations.animation:
state_modifiers.pop_at(i)
# if state_modifiers.empty() == false:
# if state_modifiers[-1].pre_append_animation == true:
# if debug_state_machine:
# print("Pop State Modifier: ", state_modifiers[-1].name)
# state_modifiers.pop_back()
if current_state.animations.frames.get_animation_loop(
current_state.animations.animation) == false:
if current_state.animation_sequence.size() > 0:

View File

@ -10,14 +10,26 @@ extends Node
##
## @WIP
export var debug_state: bool = false
export var animation_name: String
## Modification Type
## if an animation is specified, the default behavior will be just to override
## the state animation. Or perform a 'Replace Animation'
export(String, "None",
"Exit Animation",
"Animation Suffix",
"Replace Animation") var modifier_type = "None"
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
# state transition like 'run-fire' to 'idle-fire' 'jump-fire' etc.
export var animation_suffix: bool = false
export var pre_append_animation: bool = false
# not sure if I can do the array thing from state change. Maybe?
# disabling this sequencing for now.
@ -32,6 +44,9 @@ var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
var state_timeout: Timer
func _ready():
# If somebody forgot to specify the type
if animation_name != '' and modifier_type == "None":
modifier_type = "Replace Animation"
state_timeout = Timer.new()
state_timeout.wait_time = timeout_seconds
state_timeout.one_shot = true
@ -39,7 +54,8 @@ func _ready():
add_child(state_timeout)
func enter() -> void:
print("Apply State Modifier: ", self.name)
if debug_state:
print("Apply State Modifier: ", self.name)
state_timeout.start()
#modifier_stack_ref = state_modifiers
return