How do I "check out" an object in a family?

Get help using Construct 2

Post » Tue May 06, 2014 10:22 am

Hi, I have a small problem with my game. (see attachment)

Okay, so I have the 6 objects, 3 on each side. What the player is supposed to do is drag the object in the middle to the object with the corresponding starting sound (the sunflower in portuguese is girasol, which starts with a j sound, so you'd drag it into the object with the J's) and it is destroyed, and then another appears.

I'm doing this by having all the middle objects in a family, and it spawns a random object when the other is destroyed, so if I put the sunflower in it's correct place, it is destroyed and another random object from that family (e.g a shoe) shows up in the middle, and so on.

Until there I got it working fine, my problem is that the objects repeat themselves. Like after a few tries, the sunflower can appear again, and I don't want that. How can I say "okay sunflower was destroyed, so don't spawn that one anymore"?
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 5
Reputation: 215

Post » Tue May 06, 2014 11:39 am

Use a variable of boolean type (true / false) on the family itself, to control it. When the image is correct, change the variable to "false" in the moment before destroying the sprite. In action in which you create a new sprite, put a new condition for the spawn occurs only when the boolean variable is "true".
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Tue May 06, 2014 12:59 pm

Hi! Thanks a bunch for the reply.

I'm trying to implement it but I'm still having some problems.

I set added an instance variable on the family itself like you said, so the [familyname] has an instance variable "Use" which is defaulted "true"

And then I change the boolean to "false" when correct, so it doesn't call that one again, I'm setting it false on the specific object, not the family, so for example

[girasol] is correct -> [girasol] set Use to False
[girasol] destroy

And then I call a new one object from the family

On [familyname] destroyed
[familyname] Is Use -> spawn [familyname] ...

But this makes no object spawn for some reason. Is there anything I'm doing wrong?

Thanks again for the trouble
B
4
Posts: 5
Reputation: 215

Post » Tue May 06, 2014 1:33 pm

Hi @viaoceanica

Try to use only the "familyname" instead to use "girasol".

It would be better if I could see your script. Could you provide your CAPX?
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 50 guests