How do I change each block type separately?

Get help using Construct 2

Post » Wed Jun 17, 2015 7:32 am

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!
B
3
Posts: 3
Reputation: 181

Post » Wed Jun 17, 2015 8:03 am

Try right clicking the tile and selecting "clone object type". This allows you to set separate behaviors and events to each individual sprite.
B
4
Posts: 14
Reputation: 228

Post » Wed Jun 17, 2015 11:00 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487

Post » Wed Jun 17, 2015 12:29 pm

Maxwell002 wrote: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
B
3
Posts: 3
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: Syazanie Amirin and 8 guests