Platformer Zombie AI [need help :P]

0 favourites
  • 6 posts
From the Asset Store
Runner Zombie drawing for Zombie Attack Series with nice style and colors.
  • Hey guys. I have some problem with making Zombie AI.

    For make them move and fall I use Platformer behavior (Default controls: no).

    And their movement look like that:

    zombie.x < player.x - simulate control Right

    zombie.x > player.x - simulate control Left

    Also, they need to detect boxes and jump over it

    (if Speed = 0 - [idling] - simulate control Jump)

    But if there will be 2 boxes and one of them will on top of other and zombie needs to destroy first, and then jump over second.

    I tryed to make some kind of detector (sprite with bullet behavior) and it works kinda fine but i'm think there is a way to make it easier.

    Want to see your suggestions :)

  • That's a good one!

    I would have it so that a box detects if there is another one on top of it(There are several ways to do this) and if it does, it creates an invisible box that extends past both sides of the visible box. If a zombie is overlapping with the invisible box, have it skip the jump script and activate an attack script. When the box is destroyed, destroy the invisible one too.

  • You'll want a couple of detector sprites at different heights attached to the zombie. No need to make them bullets.

    EDIT: Previous suggestion made while I was typing will probably work too ;)

  • Okay, couple of detector sprites. But there will be alot of zombies. How to make specific detector follow specific zombie?

    I was trying to make it using private variable in detector (set it to zombie UID):

    Start of layout ->

    + For each zombie - create object detector at zombie.x, zombie.y

                                 - set detector.a = zombie.UID

    Every tick ->

    + For each detector

       + detector overlapping zombie

       + detector.a = zombie.UID - set detector position to zombie.x zombie.y

    but when zombie overlapping other zombie detector's position goes wrong and I'm again start to generate thoughts like: there is another way to make it easier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you all!

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