Making instances work independently of each other

Get help using Construct 2

Post » Fri Nov 29, 2013 2:06 pm

As in the title: making instances of a sprite work independently?

I've followed a few examples on the matter but haven't been able to solve my dilemma. I've looked at pick.capx and pickBHT.capx and whilst these were understandable they weren't functional.

I'm having sprites generated (spawned) and then move onto the layout. These carry the boolean 'Stopped' (initially set to 'false'). On collision with the player's character I've made it so that Stopped is set to 'true' and in another event sprites which are Stopped, don't move anymore.

I just want to have the single instance which has collided with the player stop. However, this becomes true for all instances of that sprite (all of them stop), which I don't want.

I feel like I'm missing some pretty simple understanding here. Any help on the matter would be appreciated.

Thanks in advance,
Praxis
B
8
Posts: 5
Reputation: 310

Post » Fri Nov 29, 2013 2:14 pm

Hey, I think what you need is the "Pick by evaluate" condition - I asked something similar yesterday and there's a couple of helpful capx on my thread

http://www.scirra.com/forum/test-if-true-for-each-instance-of-an-object_topic81125.html
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Fri Nov 29, 2013 2:15 pm

The event you made checks if there is a sprite that has a boolean stopped is true and stops all sprites if so.

This is because in this event you haven't picked a sprite so all actions will be performed on all sprites.

You could set the sprite to stop as a subevent of the collision event, for that certainly picks the right sprite, or you could change the event that stops the motion into picking.

Using a for each sprite would work..

Pick by evaluate would probably be better.
LittleStain2013-11-29 14:16:03
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 30, 2013 10:30 am

Thanks, guys, big help. I was using 'for each' incorrectly.
B
8
Posts: 5
Reputation: 310


Return to How do I....?

Who is online

Users browsing this forum: Bing [Bot] and 11 guests