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

Discussion in 'Programming' started by Pafbar, May 19, 2019.

  1. Pafbar

    Pafbar Member

    Joined:
    May 19, 2019
    Posts:
    14
    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.
     
  2. Binsk

    Binsk Member

    Joined:
    Jun 22, 2016
    Posts:
    596
    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.
     
  3. Pafbar

    Pafbar Member

    Joined:
    May 19, 2019
    Posts:
    14
    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!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice