Y-Position Triggering Issue

Get help using Construct 2

Post » Sat Mar 19, 2016 11:23 pm

Image

How would I fix this code so that it would work with individual enemies as opposed to it only working when detecting the player being at ALL of the objects' Y positons?
B
30
S
14
G
6
Posts: 29
Reputation: 5,507

Post » Sun Mar 20, 2016 11:23 am

Give the enemies an identification code (on creation) by use of an instance-variable. Then add an event that checks that instance-variable.

By instance. Give the enemies an instance-variable 'id', make it 'text'. Give 'id' a value when you create enemy. First enemy, value = "Peter". Second enemy, value = "John" and so on ....
Then add a condition thogheter with the Y-checking: instance-variable of enemy = "Peter" > do this

Dont have to be text, ofcourse, it is just easy to explain that way.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Mar 28, 2016 9:52 pm

Would there be a good/feasable way to have it so I wouldn't have to manually give events/rename the IDs of the springers? I've tried setting the IDs to the UIDs of the objects, but that doesn't seem to work.
B
30
S
14
G
6
Posts: 29
Reputation: 5,507

Post » Mon Mar 28, 2016 10:42 pm

Put a "Foreach Springer" in front of each, so you pick each item individually. Don't separate out the "set alerted" from the frame & speed actions, do it at the same time (and possibly get rid of the alerted).
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Wed Mar 30, 2016 8:11 pm

blackhornet wrote:Put a "Foreach Springer" in front of each, so you pick each item individually. Don't separate out the "set alerted" from the frame & speed actions, do it at the same time (and possibly get rid of the alerted).


Thank you very much! Issue solved.
B
30
S
14
G
6
Posts: 29
Reputation: 5,507


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests