How do I do random sprite animations [Set AI]

0 favourites
  • 3 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • How do some of you set your AI with the animations...

    I want my AI to do random animations ever x seconds.

    Like first the sprite starts walking...then it may fall asleep or start eating

    then I want to loop these animations...Sprite starts walking again then falls to sleep again blah blah

    So how would I go about doing this?

    Please post .capx if you can!

  • Hello, i dont really know but is it what u was looking for ?

    https://www.dropbox.com/s/pj02fabhmh549 ... .capx?dl=0

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ideally you would set up a bunch of different "states" for your character. and assign him a variable called "state".

    if: state = "walking" -> do walking animations etc.

    and make seperate conditions for each state he might get into.

    this allows you to group a number of actions together and he will be able to do lots of different things depending on the movment required and which animation needs to be played.

    then one simple way to pick which state he'd go into randomly is

    every X seconds - set enemy.state to = choose ['walk', 'sleep', 'run', 'pushups']

    so it will randomly throw him into a new state every x seconds.

    or base it on other conditions like.

    while enemy.state = "walk" -> every 1 second, add 1 to enemy.walkingsteps.

    if enemy.walkingsteps > 100 - set enemy.state to "sleep"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)