Functions for seperate instances

Get help using Construct 2

Post » Tue Nov 08, 2016 6:20 am

Hi,

In my game there's a simple melee contact recognition system where an enemy goes to its "hit" animation and runs a "hit function" when they overlap player's hitbox. How do I make the function to only affect the ones overlapping the hitbox? Right now when the enemy overlaps it and calls the function, the function affects every object of its type. I'm trying to cut the amount of events by using functions as often as possible, so this needs to be solved somehow.

Thanks!
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Tue Nov 08, 2016 6:44 am

Pass in the enemies UID, and pick it again by UID.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Tue Nov 08, 2016 7:16 am

blackhornet wrote:Pass in the enemies UID, and pick it again by UID.


Could you give me an example? Do you perheaps mean saving the UID into a global variable and catching it from there? Because I think that could cause problems when more than one instance triggers the same function at the exact same time.

Edit: Okay, tried that method. Only seems to trigger for only one instance even if more are hit at the same time.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Tue Nov 08, 2016 3:00 pm

ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Nicolas951, tarek2 and 12 guests