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

Game despawns the objects in the room

R

r7465

Guest
So I'm working on a room where rooms have a bit too many objects and they despawn unless the player is near them. How can I fix this?
 
R

r7465

Guest
Can you show us your code?
What part of it? The items that disappear have no code, just depth. The player has an activate/deactivate function for objects out of the view but that's unrelated as it seems.

I'll message you the GMK file if you want it though.
 

Chara

Member
What part of it? The items that disappear have no code, just depth. The player has an activate/deactivate function for objects out of the view but that's unrelated as it seems.

I'll message you the GMK file if you want it though.
The code that makes the objects out of the view disappear
 
R

r7465

Guest
The code that makes the objects out of the view disappear

Code:
instance_deactivate_all(true)
instance_activate_region(view_xview-240, view_yview[0], view_xview+(240*view), view_hview[0], true); // main activation code
instance_activate_region(x-250,y-250,x+250,y+250,true); // backup activation code
instance_activate_object(obj_arrow)
instance_activate_object(obj_bg)
instance_activate_object(obj_draw)
instance_activate_object(obj_firedarrow)
instance_activate_object(obj_vertcam)
instance_activate_object(obj_block) // to prevent the player falling in a hole
instance_activate_object(obj_enemybase) // to prevent errors
instance_activate_object(obj_enable)
instance_activate_object(obj_newcam)
instance_activate_object(obj_snowball) // in case it goes over the view
instance_activate_object(obj_polarview)
instance_activate_object(obj_camerapb)
instance_activate_object(obj_polarbear)
instance_activate_object(obj_wall)
instance_activate_object(obj_spikegenerator)
instance_activate_object(obj_drill)
I don't really think this has to do with it but hope it works. I tried removing the backup activation code and it didn't change.
 

Chara

Member
Code:
instance_deactivate_all(true)
instance_activate_region(view_xview-240, view_yview[0], view_xview+(240*view), view_hview[0], true); // main activation code
instance_activate_region(x-250,y-250,x+250,y+250,true); // backup activation code
instance_activate_object(obj_arrow)
instance_activate_object(obj_bg)
instance_activate_object(obj_draw)
instance_activate_object(obj_firedarrow)
instance_activate_object(obj_vertcam)
instance_activate_object(obj_block) // to prevent the player falling in a hole
instance_activate_object(obj_enemybase) // to prevent errors
instance_activate_object(obj_enable)
instance_activate_object(obj_newcam)
instance_activate_object(obj_snowball) // in case it goes over the view
instance_activate_object(obj_polarview)
instance_activate_object(obj_camerapb)
instance_activate_object(obj_polarbear)
instance_activate_object(obj_wall)
instance_activate_object(obj_spikegenerator)
instance_activate_object(obj_drill)
I don't really think this has to do with it but hope it works. I tried removing the backup activation code and it didn't change.
On the second line, what do you have the "view" variable set to?

EDIT: I can't seem to replicate what you're describing. It would probably help if I took you up on the offer to message me the file.
 
Last edited:
Top