[SOLVED]Are there pitfalls of any kind when using the "save" & "load" system actions?

0 favourites
  • 11 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I like to think my game runs just fine, but lately, I've gotten completely stuck. You see, whenever my player dies, I want the game to reload the last save... and that's where things get weird.

    Watch the video below, I save the game, walk into a room and everything works as intended. For your information, every enemy except for the last plant monster uses the same object, it's nothing but variables that dictate the sprite, the hitboxes and behavior they take.

    After a death, the game reloads my save and re-entering the room suddenly makes every enemy use the same sprite, the hitboxes all get pinned to just one instance (I get hit by nothing after the second death) and the weirdest part is that things sometimes fix themselves. It's inconsistent.

    And by the third death, the last enemy's bubbles start acting up. Things that should only apply to the newly created projectile affect the previous ones as well.

    Subscribe to Construct videos now

    I'm drawing a blank, so I was wondering if there were any beginner's traps I should know about, when using "save" or "load". Or maybe someone ran into similar issues, and knows what kind of silly mistake can cause this? I like to think it's not just me forgetting that I added the "No save" behavior to the ONE thing that breaks it all, but...

    Sorry if this is rather vague, but I'm completely stumped myself.

  • You should check if the issue can happen without load/save feature by entering the room a bunch of times, then it is down to your own events. The load will load the game at the state it was when you saved, if you set the enemy variables later on then it should have no effect really.

  • If you cannot reproduce without doing a save/load then share the project file I am good at debugging.

  • You should check if the issue can happen without load/save feature by entering the room a bunch of times, then it is down to your own events. The load will load the game at the state it was when you saved, if you set the enemy variables later on then it should have no effect really.

    I did try that, but it really only happens after a load. I'll just keep messing around with it, hopefully, eventually, I'll figure something out.

    Thanks for the advice, anyway.

  • This might be a bit obvious but I guess it's not really, check that you're not loading an old save slot or a different one to the one you are saving to. I can't guess where it would go wrong, if your enemies spawn based on logic that happens as you enter the next room. Is it a new layout? Show a screenshot of the spawning logic for the room.

  • This might be a bit obvious but I guess it's not really, check that you're not loading an old save slot or a different one to the one you are saving to. I can't guess where it would go wrong, if your enemies spawn based on logic that happens as you enter the next room. Is it a new layout? Show a screenshot of the spawning logic for the room.

    This took way too long, sorry. My internet decided to go on strike for a bit.

    It's all on several big layouts with Tiled backgrounds (called "Zone") clamping the camera, acting as rooms.

  • You've got a lot of function within function stuff there for just spawning an enemy hehe. Because it's in French also difficult to decipher but if it spawns the enemies on collision with the next zone I don't see why it would break.

  • You've got a lot of function within function stuff there for just spawning an enemy hehe. Because it's in French also difficult to decipher but if it spawns the enemies on collision with the next zone I don't see why it would break.

    Sorry about that, I tried adding english comments on the fly but...! x)

    But yeah, welcome to my world, I see no reasons why this breaks at some point when it works fine at first, but it does (sometimes) and it's driving me nuts x)

  • I can probably debug it, if you wanna share the project privately I am on discord ant#4434. You can't really complete the game with that kind of bug existing.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I can probably debug it, if you wanna share the project privately I am on discord ant#4434. You can't really complete the game with that kind of bug existing.

    I definitely can't, yup x)

    I think I'll give it another go myself, I should probably make a smaller project from scratch, getting rid of all the fluff that actually seems to work, and see if I can reproduce the issues.

  • Turns out, it WAS some kind of bug and is going to be fixed.

    Ah, one less headache to worry about x)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)