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

Need help with paths

Pkirkby

Member
Hi everyone, I'm working on a day/night cycle and I have a path for my sun to follow, and keep in mind I have alot to learn, but I can't get it to work proper. Here's my simple code:

Sun Script:
path_start(pathSun, 20, path_action_restart, false);
with(oParent)
{
//variables for shadows
var min_distance = 1;
var max_distance = 20000;
var distance = point_distance(oSun.x, oSun.y, x, y);
var shadow_alpha = 0.5 - clamp((distance - min_distance) / (max_distance - min_distance), 0, 0.5);

var sx = oSun.x + x;
var sy = oSun.y + y;

//Draw Shadow
gpu_set_fog(true,c_black,0,1);
draw_sprite_pos(
sprite_index,
image_index,
x - sprite_width / 2 - sx,
y-sy,
x + sprite_width / 2 - sx,
y-sy,
x + sprite_width / 3,
y,
x - sprite_width / 2,
y,
shadow_alpha);

//draw_sprite_ext(sprite_index,image_index,x-5,y-5,image_xscale,image_yscale,0,c_black,0.5);

//This sets fog to disable,white is default.
gpu_set_fog(false,c_white,0,0);
}

within this part of the code "path_start(pathSun, 20, path_action_restart, false);" my oSun does move along the path, but instead of following the path as an arc, it just goes straight forever, and doesn't restart as the code calls for. I'm new to basically all of this, so what might I be missing? Thanks alot.
 
Top