extends AnimatedSprite_StateReceiver var attack_sword: StateModifierAnimatedActor func _ready(): # Lets see if this nutty thing works var state_ref :State #state_ref = get_node(callable_state_machine).get_state_reference('fall') #state_ref.connect("state_entered", self, "_on_state_entered_fall") state_ref = get_node(callable_state_machine).get_state_reference('attack_sword') state_ref.connect("state_exited", self, "_on_state_exited_attack_sword") attack_sword = StateModifierAnimatedActor.new() attack_sword.setup('sword_drawn',StateModifier.TYPE.ANIMATION_SUFFIX,5.0) add_child(attack_sword.timeout) attack_sword.animation_name = 'PoopenStein' attack_sword.animation_suffix = '-attack-sword' add_state_modifier.call_func(attack_sword) # I don't need this right now but I proved it can be done! #func _state_process_idle(): # print("I got called!") #func _state_process_fall(): # print("I got called!") #func _on_state_entered_idle(): # print("Anim Knows Idle State Entered!") ## Processing order is interesting here. #Got call to enter state fall #2? got the state change signal jump #1? got the state change signal fall #It's an animated Actor state! ## State signal comes before state machine. I'm not sure that's ## Good. Maybe I shouldn't subscribe to signals emitted by the state. #func _on_state_entered_fall(): # print ("State Enter Signal ", current_state.name) # frame = 2 # stop() #func _on_state_change_idle(): # change_animation() # if previous_state_name == 'attack_sword': # animation = 'idle-attack-sword' func _on_state_change_fall(): change_animation() frame = 2 stop() func _on_state_exited_attack_sword(): print("you just swung your sword, you should get a modifier.") #attack_sword.timeout.start() attack_sword.activate() print ("you has merged as? :" ,modifier.animation_name)