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

[SOLVED] Code Error - Variable not set

L

Liron

Guest
Hello, I'm new in GM,
I try to create bullet and I have this error:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event1
for object obj_Gun:

Variable obj_Gun.objBullet(100003, -2147483648) not set before reading it.
at gml_Object_obj_Gun_Step_1 (line 10) - with (instance_create_layer(x, y, "Bullets", objBullet))
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_Gun_Step_1 (line 10)
and this is the code: (obj_Gun, Begin Step)
Code:
x = obj_Player.x + 20;
y = obj_Player.y + 13;

image_angle = point_direction(x, y, mouse_x, mouse_y);

firingdelay = firingdelay - 1;
if(mouse_check_button(mb_left)) && (firingdelay < 0)
{
        firingdelay = 5;
        with (instance_create_layer(x, y, "Bullets", objBullet))
        {
            speed = 25;
            direction = other.image_angle;
            image_angle = direction;
        }
}
 
Last edited by a moderator:
P

Pyxus

Guest
Hello, I'm new in GM,
I try to create bullet and I have this error:


and this is the code: (obj_Gun, Begin Step)
Code:
x = obj_Player.x + 20;
y = obj_Player.y + 13;

image_angle = point_direction(x, y, mouse_x, mouse_y);

firingdelay = firingdelay - 1;
if(mouse_check_button(mb_left)) && (firingdelay < 0)
{
        firingdelay = 5;
        with (instance_create_layer(x, y, "Bullets", objBullet))
        {
            speed = 25;
            direction = other.image_angle;
            image_angle = direction;
        }
}
mind posting the error that gamemaker gives you? All you posted was a segment of your code.
 
Top