Identify Pinned Object

Get help using Construct 2

Post » Sat Jan 14, 2012 12:47 pm

I'm doing a platformer game. As sugested by manual, I've created a rectangle object and pinned the animated sprite.

Now, I'm trying to do the same with the enemies. What I've done is...

On start layout, for each boundingBox:
-boundingBox spawn enemy.
-enemy set position to (boundingBox.X, boundingBox.Y)
-enemy Pin Pin to boundingBox

And it works fine.

But how can I identify each enemy to mirror or change the animations depending on what is the corresponding boundingBox doing?

Thanks,
B
7
S
1
G
2
Posts: 25
Reputation: 1,760

Post » Sat Jan 14, 2012 2:22 pm

Try this, if it's what you're looking for.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Sat Jan 14, 2012 4:29 pm

Thanks! That helped a lot
B
7
S
1
G
2
Posts: 25
Reputation: 1,760

Post » Sun Apr 01, 2012 7:17 pm

A bit buggy, but it does work.
B
5
Posts: 14
Reputation: 428

Post » Tue Jul 30, 2013 11:28 am

@Noga,

Thanks, But can you increase the Enemy Speed ?

B
12
S
2
G
3
Posts: 57
Reputation: 3,439

Post » Fri Jun 19, 2015 2:33 am

I know that this is an old thread, but this page is still the top Google result for most search queries that I used concerning this problem. I didn't like the provided answer because it's too complex and may not work properly if two enemies are at the same position.

After reading more help pages, I've finally managed to create a simple solution. I just wrapped my
enemy movement functions
within these conditions:

Code: Select all
System | For each Enemy_box
  System | Pick Enemy_sprite instance Enemy_box.IID


Since each of my enemy characters is created along with a box, all of them will have a paired IID. When a box hits a wall, only its individual corresponding sprite will be mirrored. I hope that this will be helpful for other beginners. :)
B
3
Posts: 1
Reputation: 177

Post » Sat Jun 27, 2015 11:18 pm

Message: bclikesyou can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
@anewuser Your fix worked for me until I started destroying enemies. With each one destroyed, another would lose it's mirroring.

This thread https://www.scirra.com/forum/viewtopic.php?f=147&t=120872&p=863703&hilit=patrol#p863703 had another solution in @TiAm 's file that worked for me. It ignores instance variables and doesn't use a bounding box which is weird but it's working for me so far!

Image
B
32
S
10
G
1
Posts: 250
Reputation: 2,894


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests