System picking question.

Get help using Construct 2

Post » Sun Jan 26, 2014 10:53 pm

Hello again! I just have a simple question that I can't figure out on my own. What would be the proper way to select different instances of the same sprite? I start out with the original one on my board for the match 3 game I'm making, but I made it so that every time I left click another instance spawns. I want to control these individually. Any help would be greatly appreciated!!! Thanks!
B
8
S
1
Posts: 42
Reputation: 1,159

Post » Mon Jan 27, 2014 12:45 am

Each object that gets created gets assigned a "UID" eg: sprite.UID

this number is unique to each object running in the game, so you can check against that to pick a specific instance.

Using, pick by evaluate, or pick by comparison events.

B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Mon Jan 27, 2014 4:58 am

@justifun Thanks for replying justifun! Would pick by evaluate or comparison work for large amounts of the same sprite, and possibly unexpected outcomes? Like say the person playing loses within just the first few minutes and no more sprites need to be spawned, or the opposite they survive a very long time and hundreds of the same sprite need to be spawned. Please let me know, and thanks again!
B
8
S
1
Posts: 42
Reputation: 1,159

Post » Mon Jan 27, 2014 2:06 pm

Here's some more info
https://www.scirra.com/manual/130/common-features

So yes, to answer your question, you should not run into any issues.

Each time a new instance is created it gets assigned a number (UID).

Then depending on when you want to isolate that particular instance eg:

Mouse on object click "enemy"
->pick by evaulate enemy.UID = 57 -> enemy Destroy
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Tue Jan 28, 2014 9:31 am

@justifun Thanks for the info justifun! I'll let you know how it goes. Have a great night.
B
8
S
1
Posts: 42
Reputation: 1,159


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo, nickar and 43 guests