Patrolling enemies bug

0 favourites
  • 3 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • Hi

    I'm continuing work on my platform game, taking snippets from various tutorials and examples but have a little bug with my patrolling enemies.

    They move from left to right correctly, I added a for each loop so I can kill each one and the others still move but when one sprite is mirrored they are all mirrored.

    I tried adding a for each on the actual sprite but that didn't work. I'm thinking I need to use UIDs but not sure where to start with them.

    My snippet of code looks like this so far:

    Any help is appreciated.

    Simoon

    <img src="https://dl.dropbox.com/u/3796932/enemy_patrol_bug.jpg" border="0" />

  • yep, don't be afraid of assigning UID's, it's actually quite simple once you've done it a few times.

    First you'll need to give enemy01_box an instance variable which will contain the UID of the actual character sprite. I'll call the variable "CharUID"

    underneath "pin to..", add another action:

    -> enemy01_box set value CharUID to enemy_01.UID

    and then after this, in order to pick the correct character sprite for the box, add the following underneath the "For each.. " condition:

    + enemy_01 pick instance with UID: enemy01_box.CharUID

    *edit: I accidentally typed "enemy_01.uid pick" instead of "enemy_01 pick"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Great, thanks a lot Keepee, that got it working as expected :)

    Simon

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