Instance variables for each sprite

Get help using Construct 2

Post » Tue Mar 25, 2014 2:54 pm

Hi,

I have a puzzle pieces that are duplicated. I want that each of the pieces have their own attributes, I define some instances variables for the sprites, but all the pieces have the same values and if I change to one of them all are changed. I read about the instances variables belong to each object.

Maybe I can use one sprite for each piece but I don't know how affect it to performance.

What I'm doing wrong?

Salut,
Josep M

Captura de pantalla 2014-03-25 15.55.03.png

Captura de pantalla 2014-03-25 15.55.18.png
You do not have the required permissions to view the files attached to this post.
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Tue Mar 25, 2014 3:02 pm

You aren't picking the specific instance. I'm assuming event 4 is the problem. You are saying on ANY Right click, subtract one from ALL Sprite2 objects. By default, all of an object are picked. If you made the mouse check the Sprite2, like you did with event 2, it should work.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Thu Mar 27, 2014 7:50 am

The event 4 is for simulate that the piece lost RES (resistance) but when I left-click on any of the others pieces always show the same RES value, no matter what right-click, even the same value.
I want simulate that each of the pieces have one start values, and then as the game run with the user interaction the pieces lost RES.

Salut,
Josep
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Thu Mar 27, 2014 8:14 am

What Blackhornet was saying is change event 4 to

on right button click on sprite2 -- sprite2 subtract 1 from Res

the way you have it now it does not know which sprite you want to (subtract 1 from res) from so it is doing it to all sprite2s

by using "on right button click on sprite2" it will only pick the sprite2 that your mouse in on while right clicking
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882


Return to How do I....?

Who is online

Users browsing this forum: FabianB, ST314 and 32 guests