How do I pick every other object of the same type?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Is there any way to make actions trigger on objects of the same type other than the one that is in the initial condition?

    I want to collide the player sprite with an object, then pick a different object of the same type (with a different instance variable) to move the player to. However when I create the action it uses the original object from the collision instead of a picked object with the different instance variable. I can't seem to find a way to disassociate the initial event object from the one in the sub event. Any tips?

  • When there is a collision objects that touch automatically pick up and it is convenient.

    You can add a sub-event listing all objects and in it another sub-event with a variable comparison.

    Like this

    + COLLISION.

    ----+ System: For each Sprite

    --------+ Sprite: Variable1 = 0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When there is a collision objects that touch automatically pick up and it is convenient.

    You can add a sub-event listing all objects and in it another sub-event with a variable comparison.

    Like this

    + COLLISION.

    ----+ System: For each Sprite

    --------+ Sprite: Variable1 = 0

    Thanks for the reply! I still couldn't quite get it to work like that, however I took what you said and separated it with custom actions and it seemed to work perfectly. Thanks!

    + Sprite: On collision with Sprite2

    -> Sprite: Record_door

    * Sprite action 'Record_door'

    ----+ Sprite: Is overlapping Sprite2

    -----> Sprite: Set Direction to Sprite2.Direction

    -----> Sprite: Set Room_X to Sprite2.Room_X

    -----> Sprite: Set Room_Y to Sprite2.Room_Y

    -----> System: Wait for previous actions to complete

    -----> Sprite: Teleport

    * Sprite action 'Teleport'

    ----+ Sprite: Direction = "East"

    --------+ System: For each Sprite2

    ------------+ System: Pick Sprite2 where Sprite2.Room_X = Sprite.Room_X+1

    ------------+ System: Pick Sprite2 where Sprite2.Room_Y = Sprite.Room_Y

    ----------------+ System: Pick Sprite2 where Sprite2.Direction = "West"

    -----------------> Sprite: Set position to (Sprite2.ImagePointX("East"), Sprite2.Y)

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