Windows FATAL ERROR on shooting bullets

i am very new to programming and so i am following a tutorial to learn the beginnings.

but now i made a gun and a bullet, this bullet contains 2 frames.

but when i am in the game and i shoot the game crashes and the Memory usage skyrockets to over 3GB while my game freezes. after that i get this error message:


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object objectGUN:

Memory allocation failed: Attempting to allocate 201326592 bytes
at gml_Object_objectGUN_Step_0 (line 6) - while(instance_create_layer(x,y,"BULLET",ObjectBULLET))
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_objectGUN_Step_0 (line 6)



i don't know what to do at this point so could someone maybe pleas help me out with this?

my code where the FATAL ERROR encounters:
GML:
firingdelay = firingdelay -1;
if (mouse_check_button(mb_left)) and (firingdelay < 0)
{
    firingdelay = 5;
    
    while(instance_create_layer(x,y,"BULLET",ObjectBULLET))
    {
        speed = 20;
        direction = other.image_angle;
        image_angle = direction;
    }
    
}
if you need anything else to help me out pleas tell me!
 
This subforum is for actual errors with GMS itself, not errors in your programming. You should have posted this in the Programming subforum. However, the problem is that you have used while
Code:
while(instance_create_layer(x,y,"BULLET",ObjectBULLET))
When you should have used with
Code:
with(instance_create_layer(x,y,"BULLET",ObjectBULLET))
When you are programming, you need to pay very careful and close attention to what you are typing. Any errors at all and you will get bugs like you have experienced here.
 
oh didn't know i was posting it in the wrong subforum sorry for that šŸ˜…

ah i see it now! thank you so much!

i will try to pay some closer attention to what i am typing next time!
 
Top