• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Volcano lava bomb path generator

Axl Trauts

Member
Hi,

I am planning on creating a Volcano that shoots lava bombs. I know that the best way to do it is creating paths, and assign each bomb one. But I think that maybe I can create something more dynamic and which saves resources, such as a dynamic path. So, I am assuming that using path_change_point will work.
Those randomized points though, should have a constraint, as I don't want to create illogical paths.

I have this image as an example of the first path. My idea is that a generated lava bomb starts that path. Some moments later, a second lava bomb. is shot, following a slightly different path but keeping the general curved shape, falling down to the "sea".

The simplest way is creating multiple paths and randomly assign new bombs to one of those, of course.

Do you have any ideas?

upload_2016-6-28_14-34-41.png
* Disclaimer: the volcano sprite is just for testing purposes, I too the image from Internet. I do not intend to use it later.
 
Last edited:
J

jackhigh24

Guest
i would do it random so all your doing is creating lave bombs and each will choose a random direction and fall under gravity, not sure why you want to have pre set paths as thats not going to look like a volcano chucking stuff out.
 

Axl Trauts

Member
Not that I like to have pre set paths, but as I don´t know how to make constrained randomized paths, I was thinking of that option.

Constrained because I'd like that the points in the path follow a certain logic, the first starts at the mouth of the volcano, following ballistic path that first goes up from the fixed origin, travels left and falls to the ground at the last point. Of course, randomly mirror the path to shoot bombs to the right.
 

Axl Trauts

Member
Well, as I solved it fastest than I thought, I'd like this thread to be useful to other people. I'd appreciate if you guys can help me with something that can be better.

First I created one path with four points, as show in the above screen, called path_volcano_1

Then, in obj_volcano_1, I made this:
Code:
CREATE EVENT:
var_time=0;
Code:
STEP EVENT:
if var_time<10
{   var_time+=1;
}
if tiempo=10
{   instance_create(320,272,obj_lava_bomb);
    var_time=0;
}
In obj_lava_bomb:
Code:
CREATE EVENT:
/* Path original
path_volcano_1
punto 0: 320,272
punto 1: 272,112
punto 2: 160,128
punto 3: 128,368
*/

//New temporary path duplicated from the original path
temp_path = path_add();
path_assign(temp_path, path_volcano_1)

//change path coordinated
for (var i = 1; i < path_get_number(temp_path); i ++)
    {
    var px = path_get_point_x(temp_path, i) + 32 - random(64);
    var py = path_get_point_y(temp_path, i) + 32 - random(64);
    path_change_point(temp_path, i, px, py, 100);
    }

if irandom(2)=2
{   path_mirror(temp_path);
    path_shift(temp_path, 160, 0);
    path_start(temp_path,10,path_action_stop,1);
}
else path_start(temp_path,10,path_action_stop,1);
Code:
END OF PATH EVENT:
instance_destroy();
path_delete(temp_path);
Here is the result. You can see the path is even mirrored randomly.
upload_2016-6-28_16-35-9.png
 
Top