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

Windows FATAL ERROR on shooting bullets

V

vleermuis2003

Guest
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.
 
V

vleermuis2003

Guest
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