Patrolling enemies bug

Get help using Construct 2

Post » Tue Oct 23, 2012 11:30 pm


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

B
8
S
2
G
1
Posts: 21
Reputation: 1,492

Post » Wed Oct 24, 2012 12:03 am

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"keepee2012-10-24 01:43:14
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Wed Oct 24, 2012 9:14 am


Great, thanks a lot Keepee, that got it working as expected :)

Simon
B
8
S
2
G
1
Posts: 21
Reputation: 1,492


Return to How do I....?

Who is online

Users browsing this forum: bluemonkey, Khamsou and 24 guests