• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

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