How do I change each block type separately?

  • Hi!

    I am currently working on an RPG type of game.

    There is a grass tile that has 3 animation frames(Dirt, Planted, Harvestable). If I were to duplicate this tile, using a function on one will change all the duplicated ones too. I want the functions used to be used uniquely on the tile selected. Is there a way to do that(using families maybe)?

    Thank you!

  • Try right clicking the tile and selecting "clone object type". This allows you to set separate behaviors and events to each individual sprite.

  • Basically, you need to pass a parameter to your function that will allow you to pick the tile in the function itself (possibly the UID of the tile).

    From there, the picking can be several things (an instance variable, the IID, the UID, a position...) it just depends on your project.

    The thing to remember is that a function called does not remember the previously picked instances.

    For example, if you call a function inside a "On touched object" event, the touched instance won't be passed into the function automatically.

    This is something you have to do yourself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try right clicking the tile and selecting "clone object type". This allows you to set separate behaviors and events to each individual sprite.

    That is correct, but it is not what I am trying to do. If I did that, I would have to redo all the functions again. Is there a way to do the following?

    Imagine a button and a selector.

    When tile is selected->Save UID on a Global Variable

    On touched button->Change animation frame of the selected UID

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