0 votes

In my code I am trying to create transitions for some new animations in a match statement. Adding anything after states.fall gives me the ": expected at end of line." error.

I tried playing around with my code formatting but to no avail.

Here's the full function:

func _get_transition(delta):
    match state:
        #inactive state transistions
        states.idle:
            if !parent.is_on_floor():
                if parent.motion.y < 0:
                    return states.jump
                elif parent.motion.y > 0:
                    return states.fall
            elif parent.motion.x > parent.move_speed - 128 or parent.motion.x < -parent.move_speed + 128:
                return states.run

        states.run:
            if !parent.is_on_floor():
                if parent.motion.y < 0:
                    return states.jump
                elif parent.motion.y > 0:
                    return states.fall
            elif parent.motion.x < parent.move_speed - 128 and parent.motion.x > -parent.move_speed + 128:
                return states.idle

        states.jump:
            if parent.is_on_floor():
                return states.idle

            elif parent.motion.y >= 0:
                return states.fall

        states.fall:
            if parent.is_on_floor():
                return states.idle

            elif parent.motion.y <= 0:
                return states.jump

        #1h active state transitions
        states.1h_run:  
            if combat_mode == true:
                            return states.1h_run

    return null
Godot version 3.3.4
in Engine by (19 points)
edited by

Are you missing some code? There's a missing statement after

states.1h_run:  
    if combat_mode == true:

1 Answer

0 votes
Best answer

Weirdly enough, adding an underscore to the beginning of the dictionary values made the error go away.

by (19 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.