Destroy and replace

  • Here is what I want to accomplish:

    When X object is clicked destroy Y object and Create Z object specified by X, Z Object now performs events that Y object previously did.

    I know I probably need to use the family system, but still not quite sure how to tie in the whole create and destroy process...

    Basically, I am trying to make a large number of cards and monsters, when a card is clicked the player turns into the corresponding monster, animations and all.

    Any assistance would be greatly appreciated (and credited). I looked through a lot of threads but wasn't quite sure what exactly this procedure would be called.

  • How about using families for each of the sprites. Have Y and each of the variations of Z in a family called Player. Then you can set the events to use the family rather than just a specific sprite.

    e.g. Event: mouse click on Sprite X; Action: Create Object Z, Move Sprite Z to Y.X, Y.Y, Destroy Y.

    Event: Press Space Bar; Action: Family Player [do a certain action]

  • Hmm, I might give that a try. Stay tuned.

    Anyone else have suggestions?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dang, I have the free edition... forgot you couldnt do families uless you upgrade... anyone else have a workaround?

  • ok so far I have the create and destroy system without the family, but it will end up a new event for each time I want to destroy and revert back, I am think I will just have to spend the $80, going to drive me crazy knowing there is a more efficient way to do it and not have access to it.

  • It's possible you don't need families, could you perhaps upload the .capx to dropbox, so we can have a look? (or recreate the problem if you don't want to show your game)

    You might be able to do it with animation frames, arrays or variables, kinda depends on how your game works.

    Although I don't think you will regret buying a license. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • You are right, I have more peace of mind now that I have bought the license.

    I went to a family system; however, I ran into a problem it seems many others have where you cannot "create" a specific object from a family or create an object using its name.

    Currently the only method I have working is where I can put all the "transformations" into one object and just reference the animation name to make it happen. However I still have some problems with that method. I will post a capx file soon once I get it all cleaned up. Noobishly messy, was trying a lot of diff things.

  • Ok so I am using a hybrid or the two concepts. I have the cards as one object with each card as a different animation. Then I have all the transformations as one object with each form as a different animation.

    -On Left Click of card-X:

    A. set array1,1 to animationName

    B. sprite start animation array1,1 "&Idle"

    Each animation starts with frames 1-4 to show the transformation then loops back to frame 5 from that point on.

    What I am hoping to do is to use the value pushed to array1,1 to track stats for each of the individual transformations. But I haven't gotten that far yet. Just wanted to confirm that I found a solution, and hopefully that it will function with the rest of the design down the road.

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