How to make the enemy turn into mini cubes when he dies?

0 favourites
  • 15 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
  • Ay bois, this time i want to make an effect for when an enemy die, that his sprite dismantle into mini cubes, like, when he dies, they just drop some cubes of his sprite.

    All of the enemies on my game, is just cubes, so, doens't need a code to get the perfect cube sprite, just something to make it dismantle into cubes.

    if you know how to make it, please tell me!

  • Well... just make some smaller cube sprites and spawn them when an enemy dies? Perhaps you can even use the particle object to simulate this.

    Is there a more specific effect you're trying to achieve?

  • Well... just make some smaller cube sprites and spawn them when an enemy dies? Perhaps you can even use the particle object to simulate this.

    Is there a more specific effect you're trying to achieve?

    No, it's that too, but, i don't know how to do it, i don't use the effects system, so, you could provide an code for me and the final result pls?

  • On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    

    You can add Bullet, Fade, Rotate behaviors to cubes and after creating each cube set random values for bullet speed, angle of motion, rotation speed etc.

  • > On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    

    You can add Bullet, Fade, Rotate behaviors to cubes and after creating each cube set random values for bullet speed, angle of motion, rotation speed etc.

    Thanks, that worked!

  • I was going to suggest using a particle object and just spawn that. You can play around with its attributes to adjust number and size of particles, direction, speed and so on, and make the particles look like cubes. Basically the same effect as what dop said, but instead of fiddling with code you'd need to fiddle with settings.

  • A big disadvantage of Particles object is that particles don't rotate. I imagine that for this effect OP wants cubes to rotate.

  • A big disadvantage of Particles object is that particles don't rotate. I imagine that for this effect OP wants cubes to rotate.

    Hey bro, sorry for asking to much, but, i liked the effect that code gives, but, it's possible to make an effect like in this video when the enemy dies? ( Will be playing at an custom time )

    Link: youtu.be/gzPGmR6R67Y

  • Try Physics. Disable cubes collisions with other cubes, they should only collide with the immovable ground.

    Or you can use Bullet behavior with gravity and Bounce off solids=yes. On Collision with the ground reduce bullet speed. It will not look that nice, but should have better performance.

  • Try Physics. Disable cubes collisions with other cubes, they should only collide with the immovable ground.

    Or you can use Bullet behavior with gravity and Bounce off solids=yes. On Collision with the ground reduce bullet speed. It will not look that nice, but should have better performance.

    Oh, k, thanks, but, sorry for asking more again, but, you could make your own version? Like, everything i made is not that 70%, so, your code should be better in perfomance than me, or just in another way, for me to see will be better, and thanks again for helping me!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My own version of what? What have you tried?

    If you want to try Physics - create a number of cubes in a loop, for each cube set random scale, apply random impulse at random angle, random torque or angular velocity.

  • My own version of what? What have you tried?

    If you want to try Physics - create a number of cubes in a loop, for each cube set random scale, apply random impulse at random angle, random torque or angular velocity.

    Your version of the code, an exemple of the effect in the video for me, just to see the method you'll use.

  • On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    	Cube disable physics collision with Cube
    	Cube set scale to random(0.5, 1.5)
    	Cube apply impulse random(1,2) at angle random(200,340)
    	Cube set angular velocity to random(-300,300)
    	... etc.
    

    Of course, you will need to experiment with all these values and Physics settings (density, damping etc.)

  • > On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    	Cube disable physics collision with Cube
    	Cube set scale to random(0.5, 1.5)
    	Cube apply impulse random(1,2) at angle random(200,340)
    	Cube set angular velocity to random(-300,300)
    	... etc.
    

    Of course, you will need to experiment with all these values and Physics settings (density, damping etc.)

    Thanks man, and yes, i just mess with everything changing all values to see what happens while i'm having some fun xd and to know if is it good or not.

  • > On Enemy destroyed
    Repeat 10 times
    	Create Cube at (Enemy.x+random(-50,50), Enemy.y+random(-50,50))
    	Cube disable physics collision with Cube
    	Cube set scale to random(0.5, 1.5)
    	Cube apply impulse random(1,2) at angle random(200,340)
    	Cube set angular velocity to random(-300,300)
    	... etc.
    

    Of course, you will need to experiment with all these values and Physics settings (density, damping etc.)

    And, sorry for asking again bro, but, you're so helpful for me in all my threads, so, you can see my new problem that i posted in the forum? I really don't know how to fix it.

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