Mushroom Kingdom Fusion Reactor > Game Maker Boards > General Game Maker Help
Your Ad Here
Full Version: getting shots to destroy selves when off screen
captain caveman
in the event outside view[0] i put coding destroy() on the bullet and it doesnt seem to work, is there a way of fixing this or a different way completely of doing it?
AdminJS
Did you enter...
CODE
destroy()

...or...
CODE
instance_destroy()


The second code line is correct.
captain caveman
QUOTE (Mukor @ Feb 2 2009, 07:55 PM)
Did you enter...
CODE
destroy()

...or...
CODE
instance_destroy()


The second code line is correct.

i meant to say instance_destroy() sry, yeh thats what i put in
captain caveman
bump
Psychopath
look at the code for the cannonballs or other projectiles...they are destroyed when out of view...try to duplicate it...

and I don't think that using outside view 0 is best...I don't think it really does anything extra or less...I put all of my code in the step event...so I put the code for "out of view" as well...do whatever you like... :V
nuser_uame
possible problems:

-You are not using view[0] at all. Check if you're using another view, or if you're even using one.
-You put the code in the wrong place (not very likely, if you know what you're doing) It has to be in the bullet object if you want to destroy the instance of the bullet
-if you're sure you are using view[0], try entering this code in the step event of the bullet object:

if x < view_xview[0] || x > view_xview[0] + view_wview[0]
instance_destroy()


I'd also like to question how you know it's not working. What specifically is happening when you run the game? If the bullet is off the screen, how do you know it's still there? Either it's doing something while it travels, telling you it's still alive, or you made one slow bullet.
Powered by IP.Board v1.3 © 2003 - iPBFree v.2.1 © 2007