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

Im trying to make the bullets speed relate to the distance from the mouse. But i wish to clamp the varible to 6, 10. Its not working?

DeltAxShaRD

Member
Pardon my bad variable names
GML:
//Shoot
firingdelay = firingdelay - 1;
if (mouse_check_button(mb_left)) && (firingdelay < 0)
{
    firingdelay = 5;
    with (instance_create_layer(x+image_xscale*12,y-6,"bullets",oBlob))
    {
        speed = distance_to_point(mouse_x,mouse_y) / 10;
        clamp(speed,6,10)
        direction = other.pointgunthing;
    }
}
 

Reprom

Member
These kind of mistakes, where the engine will not spew an error and just rolls with it, can be most frustrating.

If I can give you an advice for future, that would be, to get comfortable with debugger and using break points. You have no idea how useful it will be.
 
Top