Manage multiple, overlapping pinned objects

Get help using Construct 2

Post » Sun Feb 24, 2013 5:26 pm

Hi all!

Hope you can help, having lots of fun on a game I can't wait to show you but right now I'm a bit stumped.

When I have more than one enemy hit by touch, then they each take damage and "die" correctly, but the associated health bars don't all get picked up. Only one does.



I can't figure out what do to.. Are any of the following possible?

1, Prevent touch/click hitting multiple overlapped family objects (so, only hit the top one..)

or

2, How to fix the issue with "only one" health bar being found in the for loop, even though multiple "Prey" are picked.

or

3, How to assign health bars to family at run time via a family container (then hp bars would destroy with enemies). Don't think this is possible.silkc22013-02-24 17:28:33
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sun Feb 24, 2013 7:34 pm

1. You could use 'pick top instance' in the first event
[code]
+Touch: On touched Prey
+Prey: Speed = 0
+Prey: Pick top instance
[/code]

2. You need to loop through the prey as well:
[code]
+System: For each Prey
+System: For each HealthBar
+System: Compare two values [HealthBar.Pin.PinnedUID = Prey.UID]
[/code]
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Mon Feb 25, 2013 9:32 am

I'm starting to think you are the forum superstar here! I'll give those a try, thanks. :)

Have gone with option 1, makes more sense. :)silkc22013-02-25 11:11:31
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Wed Sep 14, 2016 2:21 am

ramones wrote:1. You could use 'pick top instance' in the first event
Code: Select all
+Touch: On touched Prey
+Prey: Speed = 0
+Prey: Pick top instance


2. You need to loop through the prey as well:
Code: Select all
+System: For each Prey
+System: For each HealthBar
+System: Compare two values [HealthBar.Pin.PinnedUID = Prey.UID]


This was very useful for me. Thank you :D :D
B
25
S
5
Posts: 94
Reputation: 1,374


Return to How do I....?

Who is online

Users browsing this forum: mjj1990, Vodakman and 8 guests