How do I prioritize actions?

Hi! I'm fairly new to game salad and I'm trying to make some form of an AI for an enemy actor. One of the actions that it's supposed to do randomly is move right a few pixels, rotate few degrees so it's looking down, and jump into a sort of "portal" actor. However, I can't get it passed rotation. It rotates then moves. Is there anyway I can control the order? Thanks in advance!

Comments

  • quantumsheepquantumsheep Member Posts: 8,188

    You can make a 'self' variable called 'state'.

    When you open up your actor, its info (e.g. position, size) are in the window on the left.

    At the bottom of this window are +/- buttons - pressing '+' will make a new self.variable

    You can choose the type - let's make an 'integer' one (whole numbers) and call it 'state'.

    Set it to 0.

    Now you can break up your actions into state numbers:

    • Move Right - State 1
    • Rotate - State 2
    • Jump into Portal - State 3

    Essentially, when it's finished a state add a 'change attribute' behaviour to make self.state = self.state +1

    Each state would have a rule:

    • If State =1 Move Right
    • If State =2 Rotate
    • If State =3 Jump into Portal

    Hopefully that'll give you a start!

    QS =D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.