Teo
Teo

Reputation: 13

Projectiles In Gamemaker Studio 2 Not Moving

My gun's begin step code:

if (global.night == true) {

    image_angle = point_direction(x, y, mouse_x, mouse_y);
    image_index = 1;
    alarm[0] = 0.5 * room_speed;
    firingdelay -= 1;

    if (mouse_check_button_pressed(mb_left)) && (firingdelay < 0) {

        firingdelay = 10;
        with (instance_create_layer(Revolver.x+12, Revolver.y, "Bullets", Bullet)) {
            direction = Revolver.image_angle;
            speed = 25;
            image_angle = direction;
        } 
    }
}

It creates the bullets, but they don't move. Can anyone help?

Upvotes: 0

Views: 501

Answers (1)

Rob
Rob

Reputation: 4987

If you have physics enabled in a room, the regular speed and direction variables will not work. Do you have physics enabled? The code looks fine.

Upvotes: 1

Related Questions