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

Objects deleting after room switch despite persistence? GM:S 2

P

Pafbar

Guest
Hello!
The title is basically the crux of the issue. In a particular project, I have a player object (set to persistent) that, when touching a door object, should teleport to the next room to specific coordinates. However, after I switch rooms, the player object is destroyed even though I have it set to persistent. The floor and exit door instances appear, but they were deliberately placed in the room editor.
Also, when the player object is destroyed, somehow it can still move and collide??? If I move backwards and touch the exit door (I am assuming that's what's happening, because I can't see the player object), the room switches back and the player object is fully visible once again. It was working fine yesterday! The biggest changes I have made to my system since yesterday are some changes in sprite masks and combining two rooms. Thanks to anyone who responds- I'm frustratingly new at this program.
 

Binsk

Member
If collisions and movement are still happening then it isn't being destroyed.

Double check your drawing code; do you have any special conditions that could be goofing up the render? Have you tried debugging the position to make sure it's in the expected spot when invisible and not just offscreen?

In my 15 years of using GM I've never used persistence because it always ended up causing more issues than it was worth, honestly.
 
P

Pafbar

Guest
If collisions and movement are still happening then it isn't being destroyed.

Double check your drawing code; do you have any special conditions that could be goofing up the render? Have you tried debugging the position to make sure it's in the expected spot when invisible and not just offscreen?

In my 15 years of using GM I've never used persistence because it always ended up causing more issues than it was worth, honestly.
Hey Binsk!
I'm sorry, I figured out it was due to me putting the player object in the wrong layer after switching rooms. Thanks for your reply!
 
Top