Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[GM7] Random Explosions


Mr.S

Recommended Posts

Can't you just set a variable in objBoss to 1, and when that value is 1 ( or true ), create the random explosions?

While the value ( we'll call it Explode ) is one, you can check if another value ( which we'll call TimedExplode ) in objBoss is 0. If it is, create an explosion with a random set of coordinates and set TimedExplode up a bit say like 6. Then have this value count down by 1 while Explode equals 1 until it reaches 0 again. If your frame rate is 60, then this will cause ten explosions with slightly random coordinates around objBoss per second, but only while Explode equals 1. This way, you can easily set that value to 0 to stop the exploding process.

Link to comment
Share on other sites

What exactly do you want to be randomized? The location? The shape? The frequency (in the case of multiple explosions as is common in Sonic boss deaths)?

Here's the code I've used more than a couple times in the past in order to create an exploding boss:

CREATE EVENT:

alarm[0] = 5;

ALARM 0 EVENT:

{
    instance_create(x + random(64)-32,y+ random(64)-32,objExplosion);
    alarm[0] = 5 + floor(random(10));
}

objExplosion is just an object with an explosion sprite that terminates when its animation is over (by using the Animation end event, found in the Other tab). It also plays a sound in its create event.

Obviously tweaking the random values will tweak the effect. In general you want the number in place of 64 to be twice the number in place of 32 (that way you have an even distribution around the center of the object).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...