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

0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • 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"?

  • 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".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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?

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