Instances problem

Get help using Construct 2

Post » Sat Feb 09, 2013 10:35 pm

I just have a quick question about sprites and instances of them.

I have an enemy Sprite and it follows a path, every 2 seconds another one spawns. In the container of the sprite I have a red and green bar that will show the health above each of the sprites. Every tick it moves the bar along with the sprite.

The bar follows each sprite but the problem is when I do the calculation to make the width of the green bar smaller (set the width of the green bar when a bullet collides with the sprite), it makes all of the green bars smaller, not just that instance of it.

Am I missing something? I thought since it was just that instance of the container it should be only changing the width of the one that was collided with correct?
Twitter: https://twitter.com/pudgyplatypus

Learn to make a clicker game for cheap!
https://www.scirra.com/store/games-with ... e-game-666

Try out Pixel Golf on the Scirra Arcade!
https://www.scirra.com/arcade/sports-ga ... el-golf-67

Pudgy Platypus Games website!
www.pudgyplatypus.com
B
53
S
16
G
5
Posts: 206
Reputation: 6,826

Post » Sun Feb 10, 2013 12:04 am

If you are making the green bar smaller inside of an event where you picked that sprite instance it applies to just that container. If you are making the green bar smaller in an event that doesn't pick one of those sprite instances (or a particular instance of that green bar) it's going to apply it to all or them (or just the first one it finds, depending on the circumstance).
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Sun Feb 10, 2013 12:30 am

Are you using r118? There was a bug fix related to 'on collision' and container picking.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Sun Feb 10, 2013 7:50 am

Ah interesting, im on r117, ill try that out!
Twitter: https://twitter.com/pudgyplatypus

Learn to make a clicker game for cheap!
https://www.scirra.com/store/games-with ... e-game-666

Try out Pixel Golf on the Scirra Arcade!
https://www.scirra.com/arcade/sports-ga ... el-golf-67

Pudgy Platypus Games website!
www.pudgyplatypus.com
B
53
S
16
G
5
Posts: 206
Reputation: 6,826

Post » Sun Feb 10, 2013 7:54 am

That was it, awesome! Thanks
Twitter: https://twitter.com/pudgyplatypus

Learn to make a clicker game for cheap!
https://www.scirra.com/store/games-with ... e-game-666

Try out Pixel Golf on the Scirra Arcade!
https://www.scirra.com/arcade/sports-ga ... el-golf-67

Pudgy Platypus Games website!
www.pudgyplatypus.com
B
53
S
16
G
5
Posts: 206
Reputation: 6,826


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt and 32 guests