• 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!

GML [1.4.9999] help with proper positioning of solar flare

woods

Member
back to fighting with lengthdir..

i want the flare to appear along the outer edge of the sun and shoot out from center.

i have the flare being created on a timer in the sun object.
instance_create(x + lengthdir_x(300,image_angle), y + lengthdir_y(300,image_angle), obj_flare);
this give me the flare at the right side of the sun .. shooting in random directions. i cant figure out how to rotate the create point along the sun's edge...

1594626028410.jpeg

obj_sun_3 step event -
Code:
/// cycle flare

if (delay_flare >= 0)
{delay_flare -= 1;} 
else 
{
instance_create(x + lengthdir_x(300,image_angle), y + lengthdir_y(300,image_angle), obj_flare);
delay_flare = room_speed * 5; // resets timer    
}
obj_flare create event
Code:
/// resize

image_xscale = 10;
image_yscale = 10;
image_speed = 0.2;
image_angle = irandom(360);
 

Roleybob

Member
I think it is to do with the order of events. Just do it all from obj_sun_3:

GML:
with (instance_create(x, y, obj_flare))
{
    image_xscale = 10;
    image_yscale = 10;
    image_speed = 0.2;
    image_angle = irandom(360);

    x += lengthdir_x(300,image_angle);
    y += lengthdir_y(300,image_angle);

}
The origin of the flare sprite needs to be positioned correctly on the sprite and remember to randomise the seed so that irandom() doesn't follow the same pattern every time
 

woods

Member
so the calling object will override the create event.. handy piece of information to have ;o)
i had the right variables and the right flow of information... just in the wrong spot

works perfect..thanks Roley

fun sidenote:
0400 in the morning and been at this all half the day and all night.. on auto pilot. house is dead quiet....
i didnt add the timer reset at the of the calling script. about 60 flares popped off all at once and kept going..
you shoulda seen my poor pitbull come unglued
;o) poor girl
hahahahha
 
Top