Animation Restraints

921creative921creative Member, PRO Posts: 140
edited November -1 in Working with GS (Mac)
I'm going to throw this out there because it's bugging me and I know there must be a simple answer.

I have an enemy character that animates differently depending on the state or position of the main character. Problem is, the position of the main character can cause 2 of the attributes (states) of the enemy character to be true at the same time, causing the enemy character to run 2 of its animation sequences at the same time.

What's the best way to restrain the enemy character to using only one animation at a time (basically, the first one that's triggered) before doing a different animation? I'm sure timers are involved here but I want to make sure I do it right.

Comments

  • calvin9403calvin9403 Member Posts: 3,186
    make one attribute named animate? bool false

    when the attribute animate is false and the attribute you have is true, animate the enemy

    Calvin
  • old_kipperold_kipper Member Posts: 1,420
    Have the animated states in rule dependant on an interger self attribute. Then use rules to switch the interger based on proximity but have an threshold to switch out behaviour higher than to enter the state so it doesn't keep flipping between state on the borders.

    Hope that helps kipper
  • 921creative921creative Member, PRO Posts: 140
    Thanks. Kipper, can you explain further how to establish the threshold? I have four basic states for my enemy: stand, walk, run, jump. So if the main character is at a certain location relative to the enemy, set the integer to 1. If he is within another location, set it to 2, etc.?
  • old_kipperold_kipper Member Posts: 1,420
    Seeing that you are moving the enemy actor the movement behaviours are tied into the animation and have to also be linked to the constraints. I would therefore have states for the movement with animations and then switch states based on an integer. This is turn would have rules that switched it. Your proximity I am guessing is already set up and probably uses magnitude? How you get the proximity is not really important to the switching as long as you have a value that can be checked. But given that you do I suggest that you set up a ladder of rules that switch the integer but you also have a second condition in the rule that check the integer state. Imagine zones or distances for each state. To enter a state has a smaller zone than to exit it. The buffer area or distance stops the flipping of state immediately if you move the player object back and forward over a couple of pixels.

    hope that helps. kip
Sign In or Register to comment.