Destroy and replace

Get help using Construct 2

Post » Fri Jun 29, 2012 5:13 pm

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.
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Fri Jun 29, 2012 5:32 pm

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]
B
6
S
1
Posts: 5
Reputation: 810

Post » Fri Jun 29, 2012 5:38 pm

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

Anyone else have suggestions?
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Fri Jun 29, 2012 5:52 pm

Dang, I have the free edition... forgot you couldnt do families uless you upgrade... anyone else have a workaround?
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Fri Jun 29, 2012 7:29 pm

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.
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Fri Jun 29, 2012 7:36 pm

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.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jun 30, 2012 3:32 am

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.
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Mon Jul 02, 2012 5:30 pm

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.
B
6
S
3
G
1
Posts: 102
Reputation: 1,379


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests