How do I create gibs (break apart pieces) of a sprite.

Get help using Construct 2

Post » Tue May 31, 2016 10:14 pm

I am creating a game in which you fly a space ship. I want the ship to break into many different pieces when it gets destroyed. I have it set up to remove the base sprite and replace them with pieces i chopped up in a photo editor. I just need to know the best way about getting them to take the place of the original ship, and then slowly float apart.
B
3
Posts: 2
Reputation: 179

Post » Wed Jun 01, 2016 9:39 am

Theres a few ways you could do something like this. I would use the pin behaviour initially, and then disable it and apply different velocities to the individual pieces. Eg if you assemble the ship out of the broken parts outside of your play window - then when your main ship is destroyed call an action which pins the ship pieces together (if they're set up correctly on the layout it will pin them as they are layed out) then destroy the main ship whilst swapping out the position of the ship pieces to where the ship was. Then unpin them and apply force to each piece.
B
65
S
25
G
4
Posts: 211
Reputation: 7,032

Post » Wed Jun 01, 2016 12:11 pm

I would make 2 animations.

Animation 1 = ship that breaks up towards complete transparantion. Lets say, if the nose breaks off, this animation has on that place nothing.

Animation 2 = all the parts. Animation speed set to zero.


When the ship gets destroyd. You start animation 1.
When animation 1 is at frame 0, spawn the sprite with animation 2. Set its frame to the first part. Move it in a direction that you want to.
When animation 1 is at frame 1, spawn the sprite with animation 2. Set its frame to the second part ..

And so on.

Destroy object with first animation on animation end.
Destroy the spawn parts with a timer behaviour.

Ofcourse you will have to us 'once while true' with the frame comparing.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jun 01, 2016 12:27 pm

I think the other replies may have missed your last sentence.
I just need to know the best way about getting them to take the place of the original ship, and then slowly float apart.


I don't have a nice easy solution to this, but I'm guessing there isn't one.
I would just bite the bullet and set the individual pieces to the right positions and angles when you create them.
If they have the physics behavior, you might need to be careful with the collision polygons overlapping.

If you want to set this up without needing to test it constantly, I'd suggest disabling all collisions/physics/moving parts and place each gib where it should be over the object. Then you can print out the position of each (relative to the main object) and move it by that much when they are eventually created.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Wed Jun 01, 2016 1:27 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: Lancifer, richcoz81 and 27 guests