Problem picking objects

This forum is currently in read-only mode.
From the Asset Store
Pick Up Items Sounds
$3 USD
50% off
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hi everyone!

    I'm pretty new to construct. And I'm completely new to the board. I've been experimenting with construct a lot and have been amazed by the possibilities it offers.

    I get along pretty okay with the event sheets since it's just another way to write scripts.

    But the concept of picking certain instances from an object is pretty new to me so I've ran into a problem.

    I need to know how to pass on picked objects to other conditions. Let me explain what im trying to do:

    EVENT: Sprite.Value('Type') = "Wood"

    ---SUBEVENT: Fire is Overlapping with Sprite ACTION: Set Sprite.Value('On Fire') to 1

    I think it's pretty clear what I'm trying to do here: If the Sprite instance with the type string of "Wood" is overlapping with the fire object the 'On Fire' private variable is set to 1.

    Instead the program just looks if there is ANY Instance with the value "Wood" is available and then applies the sub condition to all instances which overlap.

    So my question is: Is there any way to reference the instances you picked before?

    Thanks in advance.

    mode7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • EVENT: Sprite.Value('Type') = "Wood"

    ---SUBEVENT: Fire is Overlapping with Sprite ACTION: Set Sprite.Value('On Fire') to 1

    First you're picking the correct instances of your sprite. But with your subevent, you're newly picking instances of the sprite that overlap the fire object. If you switch the object order of that condition, it'll work correctly:

    EVENT: Sprite.Value('Type') = "Wood"

    ---SUBEVENT: Sprite is Overlapping with Fire ACTION: Set Sprite.Value('On Fire') to 1

    There's no need for a subevent btw, it could all be conditions of the same event.

    Oh, and welcome to the community!

  • Thanks that worked!!

    I knew it was something as simple as that.

    Just one more question: Is it possible to pick one instance when two instances of the same object collide

  • Thanks that worked!!

    I knew it was something as simple as that.

    Just one more question: Is it possible to pick one instance when two instances of the same object collide

    It is possible to do this by assigning a family or an attribute to your object.

    For instance, if you have enemies that you want to bounce off of each other, you can put them in the Enemy family. Then your collision condition would look like this:

    + EnemySprite: On collision with Enemy (family)
        -> EnemySprite: Do bouncing actions
    [/code:ktxsh2en]
    
    You can also do that with attributes, but it's more limited in scope.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)