Making instances work independently of each other

0 favourites
  • 4 posts
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • 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

  • 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 <img src="smileys/smiley4.gif" border="0" align="middle" />

    scirra.com/forum/test-if-true-for-each-instance-of-an-object_topic81125.html

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, guys, big help. I was using 'for each' incorrectly.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)