derkork / godot-statecharts

A state charts extension for Godot 4
MIT License
761 stars 39 forks source link

Strange lack of 'state transitions' #20

Closed Dangomation closed 1 year ago

Dangomation commented 1 year ago

I don't even know whats going on here. Simply put I call '_state_chart.send_event("air")' and this happens:

Node tree: image

I'm not crazy right? this is all you need to change states:

@onready var _state_chart = $StateChart as StateChart

func _on_grounded_state_physics_processing(delta):
    # temp gravity
    velocity.y += -2.5

    if self.is_on_floor() and jump_queued:
        velocity.y += 20
        _state_chart.send_event("air")

# This is just to show the complete picture:
func _on_grounded_state_input(event):
    pass

# Ariel Movement 🪂
func _on_air_state_entered():
    print("hello???")

func _on_air_state_physics_processing(delta):
    move_and_slide()

The signals are connected and just double check right now. Gonna start reinstalling everything including godot cause this is a silly problem tbh.

Dangomation commented 1 year ago

Nvm I'm just an idiot. Have a nice day

derkork commented 1 year ago

I'm glad you found a solution! If you have ideas/suggestions on how I could improve the manual so it is clearer how things work, please let me know. Good luck with your project!

Dangomation commented 1 year ago

I was trying to transition states though code like normal but I failed to identify the 'transition state' node was integral along with 'event' property and not just put the name of the node you wanted to 'send event' to as a StringName.