State animations, Finally coming together.
This commit is contained in:
parent
aef17c3d81
commit
b51d69a8f9
BIN
assets/Mega.png
BIN
assets/Mega.png
Binary file not shown.
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 119 KiB |
|
|
@ -169,179 +169,179 @@ region = Rect2( 1200, 1600, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=128]
|
[sub_resource type="AtlasTexture" id=128]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2400, 0, 240, 160 )
|
region = Rect2( 240, 160, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=129]
|
[sub_resource type="AtlasTexture" id=129]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 0, 160, 240, 160 )
|
region = Rect2( 1680, 160, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=130]
|
[sub_resource type="AtlasTexture" id=130]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 240, 160, 240, 160 )
|
region = Rect2( 1920, 160, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=131]
|
[sub_resource type="AtlasTexture" id=131]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1680, 160, 240, 160 )
|
region = Rect2( 2160, 160, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=132]
|
[sub_resource type="AtlasTexture" id=132]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1920, 160, 240, 160 )
|
region = Rect2( 2400, 160, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=133]
|
[sub_resource type="AtlasTexture" id=133]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2160, 160, 240, 160 )
|
region = Rect2( 0, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=134]
|
[sub_resource type="AtlasTexture" id=134]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2400, 160, 240, 160 )
|
region = Rect2( 240, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=135]
|
[sub_resource type="AtlasTexture" id=135]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 0, 320, 240, 160 )
|
region = Rect2( 480, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=136]
|
[sub_resource type="AtlasTexture" id=136]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 240, 320, 240, 160 )
|
region = Rect2( 720, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=137]
|
[sub_resource type="AtlasTexture" id=137]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 480, 320, 240, 160 )
|
region = Rect2( 960, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=138]
|
[sub_resource type="AtlasTexture" id=138]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 960, 320, 240, 160 )
|
region = Rect2( 1200, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=139]
|
[sub_resource type="AtlasTexture" id=139]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1200, 320, 240, 160 )
|
region = Rect2( 1680, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=140]
|
[sub_resource type="AtlasTexture" id=140]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1440, 320, 240, 160 )
|
region = Rect2( 1920, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=141]
|
[sub_resource type="AtlasTexture" id=141]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1680, 640, 240, 160 )
|
region = Rect2( 2160, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=142]
|
[sub_resource type="AtlasTexture" id=142]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1920, 640, 240, 160 )
|
region = Rect2( 2400, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=143]
|
[sub_resource type="AtlasTexture" id=143]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2160, 640, 240, 160 )
|
region = Rect2( 0, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=144]
|
[sub_resource type="AtlasTexture" id=144]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2400, 640, 240, 160 )
|
region = Rect2( 240, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=145]
|
[sub_resource type="AtlasTexture" id=145]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 0, 800, 240, 160 )
|
region = Rect2( 480, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=146]
|
[sub_resource type="AtlasTexture" id=146]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 240, 800, 240, 160 )
|
region = Rect2( 720, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=147]
|
[sub_resource type="AtlasTexture" id=147]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 480, 800, 240, 160 )
|
region = Rect2( 960, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=148]
|
[sub_resource type="AtlasTexture" id=148]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 720, 800, 240, 160 )
|
region = Rect2( 1200, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=149]
|
[sub_resource type="AtlasTexture" id=149]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 960, 800, 240, 160 )
|
region = Rect2( 1440, 800, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=150]
|
[sub_resource type="AtlasTexture" id=150]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1200, 800, 240, 160 )
|
region = Rect2( 1920, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=151]
|
[sub_resource type="AtlasTexture" id=151]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1440, 800, 240, 160 )
|
region = Rect2( 2160, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=152]
|
[sub_resource type="AtlasTexture" id=152]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1920, 320, 240, 160 )
|
region = Rect2( 2400, 320, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=153]
|
[sub_resource type="AtlasTexture" id=153]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2160, 320, 240, 160 )
|
region = Rect2( 0, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=154]
|
[sub_resource type="AtlasTexture" id=154]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2400, 320, 240, 160 )
|
region = Rect2( 240, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=155]
|
[sub_resource type="AtlasTexture" id=155]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 0, 480, 240, 160 )
|
region = Rect2( 480, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=156]
|
[sub_resource type="AtlasTexture" id=156]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 240, 480, 240, 160 )
|
region = Rect2( 720, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=157]
|
[sub_resource type="AtlasTexture" id=157]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 480, 480, 240, 160 )
|
region = Rect2( 960, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=158]
|
[sub_resource type="AtlasTexture" id=158]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 720, 480, 240, 160 )
|
region = Rect2( 1200, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=159]
|
[sub_resource type="AtlasTexture" id=159]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 960, 480, 240, 160 )
|
region = Rect2( 1440, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=160]
|
[sub_resource type="AtlasTexture" id=160]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1200, 480, 240, 160 )
|
region = Rect2( 1920, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=161]
|
[sub_resource type="AtlasTexture" id=161]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1440, 480, 240, 160 )
|
region = Rect2( 2160, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=162]
|
[sub_resource type="AtlasTexture" id=162]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1920, 480, 240, 160 )
|
region = Rect2( 2400, 480, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=163]
|
[sub_resource type="AtlasTexture" id=163]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2160, 480, 240, 160 )
|
region = Rect2( 0, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=164]
|
[sub_resource type="AtlasTexture" id=164]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 2400, 480, 240, 160 )
|
region = Rect2( 240, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=165]
|
[sub_resource type="AtlasTexture" id=165]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 0, 640, 240, 160 )
|
region = Rect2( 480, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=166]
|
[sub_resource type="AtlasTexture" id=166]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 240, 640, 240, 160 )
|
region = Rect2( 720, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=167]
|
[sub_resource type="AtlasTexture" id=167]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 480, 640, 240, 160 )
|
region = Rect2( 960, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=168]
|
[sub_resource type="AtlasTexture" id=168]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 720, 640, 240, 160 )
|
region = Rect2( 1200, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=169]
|
[sub_resource type="AtlasTexture" id=169]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 960, 640, 240, 160 )
|
region = Rect2( 1440, 640, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=170]
|
[sub_resource type="AtlasTexture" id=170]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1200, 640, 240, 160 )
|
region = Rect2( 2400, 0, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=171]
|
[sub_resource type="AtlasTexture" id=171]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
region = Rect2( 1440, 640, 240, 160 )
|
region = Rect2( 0, 160, 240, 160 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=172]
|
[sub_resource type="AtlasTexture" id=172]
|
||||||
atlas = SubResource( 90 )
|
atlas = SubResource( 90 )
|
||||||
|
|
@ -479,36 +479,41 @@ animations = [ {
|
||||||
"name": "idle_shield",
|
"name": "idle_shield",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 128 ), SubResource( 129 ), SubResource( 130 ) ],
|
"frames": [ SubResource( 128 ) ],
|
||||||
"loop": false,
|
"loop": false,
|
||||||
"name": "idle_shoot",
|
"name": "idle_shoot",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 131 ), SubResource( 132 ), SubResource( 133 ), SubResource( 134 ), SubResource( 132 ), SubResource( 135 ), SubResource( 136 ), SubResource( 137 ) ],
|
"frames": [ SubResource( 129 ), SubResource( 130 ), SubResource( 131 ), SubResource( 132 ), SubResource( 130 ), SubResource( 133 ), SubResource( 134 ), SubResource( 135 ) ],
|
||||||
"loop": false,
|
"loop": false,
|
||||||
"name": "jump",
|
"name": "jump",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 138 ), SubResource( 138 ), SubResource( 138 ), SubResource( 138 ), SubResource( 138 ), SubResource( 138 ), SubResource( 139 ), SubResource( 140 ) ],
|
"frames": [ SubResource( 136 ), SubResource( 136 ), SubResource( 136 ), SubResource( 136 ), SubResource( 136 ), SubResource( 136 ), SubResource( 137 ), SubResource( 138 ) ],
|
||||||
"loop": false,
|
"loop": false,
|
||||||
"name": "jump_shoot",
|
"name": "jump_shoot",
|
||||||
"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 ), SubResource( 151 ) ],
|
"frames": [ SubResource( 139 ), SubResource( 140 ), SubResource( 141 ), SubResource( 142 ), SubResource( 143 ), SubResource( 144 ), SubResource( 145 ), SubResource( 146 ), SubResource( 147 ), SubResource( 148 ), SubResource( 149 ) ],
|
||||||
"loop": false,
|
"loop": false,
|
||||||
"name": "roll",
|
"name": "roll",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 152 ), SubResource( 153 ), SubResource( 154 ), SubResource( 155 ), SubResource( 156 ), SubResource( 157 ), SubResource( 158 ), SubResource( 159 ), SubResource( 160 ), SubResource( 161 ) ],
|
"frames": [ SubResource( 150 ), SubResource( 151 ), SubResource( 152 ), SubResource( 153 ), SubResource( 154 ), SubResource( 155 ), SubResource( 156 ), SubResource( 157 ), SubResource( 158 ), SubResource( 159 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "run",
|
"name": "run",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 162 ), SubResource( 163 ), SubResource( 164 ), SubResource( 165 ), SubResource( 166 ), SubResource( 167 ), SubResource( 168 ), SubResource( 169 ), SubResource( 170 ), SubResource( 171 ) ],
|
"frames": [ SubResource( 160 ), SubResource( 161 ), SubResource( 162 ), SubResource( 163 ), SubResource( 164 ), SubResource( 165 ), SubResource( 166 ), SubResource( 167 ), SubResource( 168 ), SubResource( 169 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "run_shoot",
|
"name": "run_shoot",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
|
"frames": [ SubResource( 170 ), SubResource( 171 ), SubResource( 128 ) ],
|
||||||
|
"loop": false,
|
||||||
|
"name": "shoot",
|
||||||
|
"speed": 10.0
|
||||||
|
}, {
|
||||||
"frames": [ SubResource( 172 ), SubResource( 173 ), SubResource( 174 ), SubResource( 174 ), SubResource( 175 ), SubResource( 176 ), SubResource( 177 ), SubResource( 178 ), SubResource( 178 ), SubResource( 179 ), SubResource( 180 ), SubResource( 181 ), SubResource( 182 ), SubResource( 183 ), SubResource( 184 ), SubResource( 185 ), SubResource( 186 ), SubResource( 187 ), SubResource( 188 ), SubResource( 189 ), SubResource( 190 ), SubResource( 191 ) ],
|
"frames": [ SubResource( 172 ), SubResource( 173 ), SubResource( 174 ), SubResource( 174 ), SubResource( 175 ), SubResource( 176 ), SubResource( 177 ), SubResource( 178 ), SubResource( 178 ), SubResource( 179 ), SubResource( 180 ), SubResource( 181 ), SubResource( 182 ), SubResource( 183 ), SubResource( 184 ), SubResource( 185 ), SubResource( 186 ), SubResource( 187 ), SubResource( 188 ), SubResource( 189 ), SubResource( 190 ), SubResource( 191 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "slash",
|
"name": "slash",
|
||||||
|
|
@ -542,7 +547,7 @@ player_number = 1
|
||||||
position = Vector2( -1, -51 )
|
position = Vector2( -1, -51 )
|
||||||
frames = SubResource( 198 )
|
frames = SubResource( 198 )
|
||||||
animation = "idle_shoot"
|
animation = "idle_shoot"
|
||||||
frame = 2
|
frame = 0
|
||||||
flip_h = false
|
flip_h = false
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_aseprite_wizard_config_": {
|
"_aseprite_wizard_config_": {
|
||||||
|
|
@ -562,12 +567,8 @@ script = ExtResource( 2 )
|
||||||
player_number = 1
|
player_number = 1
|
||||||
interactable_node = NodePath("../Interactable_Receiver")
|
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 = 1.0
|
move_speed = 1.0
|
||||||
animation_sequence = [ "idle" ]
|
animation_sequence = [ "idle" ]
|
||||||
jump_node = NodePath("../jump")
|
jump_node = NodePath("../jump")
|
||||||
|
|
@ -601,6 +602,9 @@ 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 )
|
||||||
|
debug_state = true
|
||||||
|
timeout_seconds = 1.5
|
||||||
|
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")
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,36 @@ signal do_attack()
|
||||||
|
|
||||||
var draw_weapon_modifier: StateModifier
|
var draw_weapon_modifier: StateModifier
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
state_timeout.connect("timeout", self, "disable_cooldown")
|
||||||
|
|
||||||
|
|
||||||
|
func disable_cooldown():
|
||||||
|
print("It's butt kicking time!")
|
||||||
|
state_ready = true
|
||||||
|
|
||||||
func enter() -> void:
|
func enter() -> void:
|
||||||
#.enter()
|
if modifier:
|
||||||
|
if modifier.get_instance_id() == draw_weapon_modifier.get_instance_id():
|
||||||
|
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.
|
##TODO: Turn this to clear only the animation modifiers.
|
||||||
# modifier_stack_ref.clear()
|
# modifier_stack_ref.clear()
|
||||||
mod_animation_sequence.clear()
|
# mod_animation_sequence.clear()
|
||||||
#mod_animation_sequence = animation_sequence.duplicate(true)
|
# #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 = '_shoot'
|
# animation_suffix = '_shoot'
|
||||||
animation_index = 0
|
# animation_index = 0
|
||||||
current_animation_sequence = 0
|
# current_animation_sequence = 0
|
||||||
#var enter_animation = ''
|
# #var enter_animation = ''
|
||||||
var enter_frame = 0
|
# var enter_frame = 0
|
||||||
|
#
|
||||||
if debug_state:
|
# if debug_state:
|
||||||
print(parent.name, " entering State: ", self.name)
|
# print(parent.name, " entering State: ", self.name)
|
||||||
move_component.current_movement_state = self.name
|
# move_component.current_movement_state = self.name
|
||||||
emit_signal("state_entered")
|
# emit_signal("state_entered")
|
||||||
|
|
||||||
can_fire = true
|
can_fire = true
|
||||||
# if modifier_stack_ref.has($"../draw_weapon") == false:
|
# if modifier_stack_ref.has($"../draw_weapon") == false:
|
||||||
|
|
@ -46,7 +58,9 @@ 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("idle_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
|
||||||
|
|
@ -65,6 +79,8 @@ func enter() -> void:
|
||||||
# An example where the current node subscribes
|
# An example where the current node subscribes
|
||||||
#mod_timer.connect("timeout", self, "_on_Timer_timeout")
|
#mod_timer.connect("timeout", self, "_on_Timer_timeout")
|
||||||
|
|
||||||
|
state_timeout.start()
|
||||||
|
state_ready = false
|
||||||
animation_finished = false
|
animation_finished = false
|
||||||
|
|
||||||
func _on_Timer_timeout():
|
func _on_Timer_timeout():
|
||||||
|
|
@ -73,11 +89,9 @@ func _on_Timer_timeout():
|
||||||
|
|
||||||
func process_frame(delta: float) -> State:
|
func process_frame(delta: float) -> State:
|
||||||
if animation_finished:
|
if animation_finished:
|
||||||
print("WTF!?!! Finish already!")
|
|
||||||
draw_weapon_modifier.state_timeout.start()
|
draw_weapon_modifier.state_timeout.start()
|
||||||
modifier = draw_weapon_modifier
|
modifier = draw_weapon_modifier
|
||||||
return idle_state
|
return idle_state
|
||||||
.process_frame(delta)
|
|
||||||
# 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":
|
||||||
|
|
@ -117,11 +131,3 @@ func process_physics(delta: float) -> 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
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ 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():
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ var frame_signal_emitted: bool = false
|
||||||
|
|
||||||
var animation_finished: bool = false
|
var animation_finished: bool = false
|
||||||
|
|
||||||
var transition_state: StateAnimatedActor
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
@ -123,6 +122,24 @@ func update_animation(enter_frame := 0, index := 0, suffix := ''):
|
||||||
mod_animation_sequence.push_back(modifier.animation_name)
|
mod_animation_sequence.push_back(modifier.animation_name)
|
||||||
enter_frame = modifier.starting_frame
|
enter_frame = modifier.starting_frame
|
||||||
|
|
||||||
|
# Some safety checks with supplied update parameters
|
||||||
|
if animation_index != 0:
|
||||||
|
if mod_animation_sequence.size() < animation_index + 1:
|
||||||
|
if debug_state:
|
||||||
|
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:
|
||||||
print("Starting Animation: " , mod_animation_sequence[animation_index] + animation_suffix)
|
print("Starting Animation: " , mod_animation_sequence[animation_index] + animation_suffix)
|
||||||
|
|
@ -135,55 +152,57 @@ func update_animation(enter_frame := 0, index := 0, suffix := ''):
|
||||||
|
|
||||||
|
|
||||||
func enter() -> void:
|
func enter() -> void:
|
||||||
mod_animation_sequence.clear()
|
# mod_animation_sequence.clear()
|
||||||
#mod_animation_sequence = animation_sequence.duplicate(true)
|
# #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 = ''
|
||||||
animation_index = 0
|
# animation_index = 0
|
||||||
current_animation_sequence = 0
|
# current_animation_sequence = 0
|
||||||
#var enter_animation = ''
|
# #var enter_animation = ''
|
||||||
var enter_frame = 0
|
# var enter_frame = 0
|
||||||
|
|
||||||
if debug_state:
|
if debug_state:
|
||||||
print(parent.name, " entering State: ", self.name)
|
print(parent.name, " entering State: ", self.name)
|
||||||
move_component.current_movement_state = self.name
|
move_component.current_movement_state = self.name
|
||||||
emit_signal("state_entered")
|
emit_signal("state_entered")
|
||||||
#modifier_stack_ref = state_modifiers
|
#modifier_stack_ref = state_modifiers
|
||||||
|
update_animation()
|
||||||
|
|
||||||
if modifier != null:
|
# if modifier != null:
|
||||||
# if modifier.modifier_type == modifier.TYPE.EXIT_ANIMATION:
|
## if modifier.modifier_type == modifier.TYPE.EXIT_ANIMATION:
|
||||||
# #print("OHHH Modifier Applies! ", modifier.animation_name)
|
## #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)
|
# mod_animation_sequence.push_front(modifier.animation_name)
|
||||||
# enter_frame = modifier.starting_frame
|
# enter_frame = modifier.starting_frame
|
||||||
match modifier.modifier_type:
|
#
|
||||||
modifier.TYPE.EXIT_ANIMATION:
|
# modifier.TYPE.ANIMATION_SUFFIX:
|
||||||
mod_animation_sequence.push_front(modifier.animation_name)
|
# if animations.frames.has_animation(mod_animation_sequence[animation_index] + modifier.animation_name):
|
||||||
enter_frame = modifier.starting_frame
|
# animation_suffix = modifier.animation_name
|
||||||
|
# else:
|
||||||
modifier.TYPE.ANIMATION_SUFFIX:
|
# print("Warning!: Modifier attempting to apply suffix that doesn't exist ",
|
||||||
if animations.frames.has_animation(mod_animation_sequence[animation_index] + modifier.animation_name):
|
# mod_animation_sequence[animation_index] + modifier.animation_name)
|
||||||
animation_suffix = modifier.animation_name
|
#
|
||||||
else:
|
# modifier.TYPE.REPLACE_ANIMATION:
|
||||||
print("Warning!: Modifier attempting to apply suffix that doesn't exist ",
|
# #animations.play(modifier_stack_ref[i].animation_name)
|
||||||
mod_animation_sequence[animation_index] + modifier.animation_name)
|
# #animations.frame = modifier_stack_ref[i].starting_frame
|
||||||
|
# mod_animation_sequence.clear()
|
||||||
modifier.TYPE.REPLACE_ANIMATION:
|
# mod_animation_sequence.push_back(modifier.animation_name)
|
||||||
#animations.play(modifier_stack_ref[i].animation_name)
|
# enter_frame = modifier.starting_frame
|
||||||
#animations.frame = modifier_stack_ref[i].starting_frame
|
#
|
||||||
mod_animation_sequence.clear()
|
# if mod_animation_sequence.size() > 0:
|
||||||
mod_animation_sequence.push_back(modifier.animation_name)
|
# if debug_state:
|
||||||
enter_frame = modifier.starting_frame
|
# print("Starting Animation: " , mod_animation_sequence[animation_index] + animation_suffix ,
|
||||||
|
# " frame count ", animations.frames.get_frame_count(mod_animation_sequence[animation_index] + animation_suffix))
|
||||||
if mod_animation_sequence.size() > 0:
|
# animations.play(mod_animation_sequence[animation_index] + animation_suffix)
|
||||||
if debug_state:
|
# #TODO: maybe check current animatio has this frame
|
||||||
print("Starting Animation: " , mod_animation_sequence[animation_index] + animation_suffix)
|
# animations.frame = enter_frame
|
||||||
animations.play(mod_animation_sequence[animation_index] + animation_suffix)
|
# else:
|
||||||
#TODO: maybe check current animatio has this frame
|
# print("Error! Resolved to empty animation sequence!?")
|
||||||
animations.frame = enter_frame
|
# return
|
||||||
else:
|
|
||||||
print("Error! Resolved to empty animation sequence!?")
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
# A new attempt at animation modifiers
|
# A new attempt at animation modifiers
|
||||||
|
|
@ -237,14 +256,14 @@ func enter() -> void:
|
||||||
# animations.frame = modifier_stack_ref[-1].starting_frame
|
# animations.frame = modifier_stack_ref[-1].starting_frame
|
||||||
# return
|
# return
|
||||||
|
|
||||||
if mod_animation_sequence.size() > 0:
|
# if mod_animation_sequence.size() > 0:
|
||||||
if debug_state:
|
# if debug_state:
|
||||||
print("Starting Animation: " , mod_animation_sequence[animation_index] + animation_suffix)
|
# print("Starting Animation: " , mod_animation_sequence[animation_index] + animation_suffix)
|
||||||
animations.play(mod_animation_sequence[animation_index] + animation_suffix)
|
# animations.play(mod_animation_sequence[animation_index] + animation_suffix)
|
||||||
#TODO: maybe check current animatio has this frame
|
# #TODO: maybe check current animatio has this frame
|
||||||
animations.frame = enter_frame
|
# animations.frame = enter_frame
|
||||||
else:
|
# else:
|
||||||
print("Error! Resolved to empty animation sequence!?")
|
# print("Error! Resolved to empty animation sequence!?")
|
||||||
return
|
return
|
||||||
|
|
||||||
func exit() -> void:
|
func exit() -> void:
|
||||||
|
|
@ -267,17 +286,38 @@ func transfer_modifiers(exiting_state_modifier : StateModifier):
|
||||||
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 modifier != null:
|
if modifier != null:
|
||||||
if modifier.state_timeout and modifier.state_timeout.time_left == 0:
|
if modifier.state_timeout and modifier.state_timeout.time_left == 0:
|
||||||
print("Expired Modifier, updating animation.")
|
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
|
modifier = null
|
||||||
update_animation()
|
update_animation()
|
||||||
|
_:
|
||||||
|
modifier = null
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
#if animation_sequence.size() > 0 and current_animation_sequence != animation_index:
|
# We have no more sequence animations and the current one doesn't loop
|
||||||
if mod_animation_sequence.size() > animation_index and current_animation_sequence != animation_index:
|
# 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
|
||||||
|
|
@ -288,12 +328,7 @@ func process_frame(_delta: float) -> State:
|
||||||
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
|
##TODO: Could probably add some more checks here.
|
||||||
# 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()
|
|
||||||
animation_finished = true
|
|
||||||
|
|
||||||
# Singal based frame call.
|
# Singal based frame call.
|
||||||
if emitter_frame_subscriptions.has(animations.frame):
|
if emitter_frame_subscriptions.has(animations.frame):
|
||||||
|
|
@ -305,6 +340,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:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
class_name StateMachineAnimatedActor extends StateMachine
|
class_name StateMachineAnimatedActor extends StateMachine
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -79,15 +82,16 @@ func process_frame(delta: float) -> void:
|
||||||
# if debug_state_machine:
|
# if debug_state_machine:
|
||||||
# print("Pop State Modifier: ", state_modifiers[i].name)
|
# print("Pop State Modifier: ", state_modifiers[i].name)
|
||||||
# state_modifiers.pop_at(i)
|
# state_modifiers.pop_at(i)
|
||||||
|
if current_state is StateAnimatedActor:
|
||||||
|
current_state.process_animations()
|
||||||
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:
|
# if debug_state_machine:
|
||||||
print("Stop!!!!!")
|
# 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():
|
||||||
|
|
@ -100,13 +104,17 @@ func _on_AnimatedSprite_animation_finished():
|
||||||
# current_state.animation_index += 1
|
# current_state.animation_index += 1
|
||||||
# break
|
# break
|
||||||
|
|
||||||
if current_state is StateAnimatedActor:
|
# if current_state is StateAnimatedActor:
|
||||||
current_state.animation_finished = true
|
# current_state.animation_finished = true
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user