Animated sprite fix for animation sequence. This whole thing needs some work.
This commit is contained in:
parent
c5fa3e8edb
commit
94274cd447
|
|
@ -1,6 +1,8 @@
|
|||
class_name AnimatedSprite_StateReceiver
|
||||
extends AnimatedSprite
|
||||
|
||||
export var debug_component: bool = false
|
||||
|
||||
export var callable_state_machine :NodePath
|
||||
|
||||
onready var current_state = StateAnimatedActor.new()
|
||||
|
|
@ -55,6 +57,8 @@ func _process(delta):
|
|||
call('_state_process_' + current_state.name)
|
||||
|
||||
func _on_animation_finished():
|
||||
if debug_component:
|
||||
var foo = 2+2
|
||||
if frames.get_animation_loop(animation) == false:
|
||||
#print("Stop!!!!!", current_state.animation_sequence.size(), " - ", current_state.animation_index)
|
||||
if current_state.animation_sequence.size() > 0:
|
||||
|
|
@ -63,6 +67,8 @@ func _on_animation_finished():
|
|||
if animation_index >= current_state.animation_sequence.size():
|
||||
#print("Stop!!!!!")
|
||||
current_state.animation_finished = true
|
||||
else:
|
||||
change_animation(0,animation_index)
|
||||
##TODO: Allow a way to stop animation even if in a looped sequence
|
||||
|
||||
# If called, this will attempt to make the most appropriate animation change
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ states = [ ExtResource( 3 ), ExtResource( 6 ) ]
|
|||
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
||||
frames = ExtResource( 2 )
|
||||
playing = true
|
||||
debug_component = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="4"]
|
||||
position = Vector2( -5, 6 )
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user