Moving character between layouts not working properly

0 favourites
  • 4 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I have an array set up to keep track of everything I could need for door logic, and filling that array at layout start works as it should. However, my character refuses to spawn where it's supposed to when I go through any of the doors leading to other layouts. It will move my camera to the corner of that layout, but doesn't actually place the character anywhere. I'm pretty lost after debugging for a while. Does anyone spot something off in my code? AT this point I think I'm just missing something obvious. Thank you!

    I should also mention that my character DOES spawn at the start of the first layout where it is supposed to, but that is handled outside of the array (see screenshots).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I know it may not be exactly what you're looking for but in situations like this I usually try to force the result by creating something like

    "on key backspace pressed" -> spawn actions.

    That way you can check and see if your character spawns the way you think they're supposed to spawn, and if they don't, you can glean a little insight into where the code is wrong. I'll keep peeking here, though.

  • Also, can you use debug mode and see if the Player is perhaps spawning incorrectly elsewhere?

  • I know it may not be exactly what you're looking for but in situations like this I usually try to force the result by creating something like

    "on key backspace pressed" -> spawn actions.

    That way you can check and see if your character spawns the way you think they're supposed to spawn, and if they don't, you can glean a little insight into where the code is wrong. I'll keep peeking here, though.

    This ended up not working either, so after some debugging effort, I realized my previous setup required my character not to be global, but this definitely needs them to be since it only sets their location, not destroy/create per layout. After setting them to global, it did sort of work, but the spawn locations for a couple of the doors are off. I can't figure out why, since in the array in debug and in the code the locations look correct.

    door 0 -> room 1 -> door 1 location (works correctly)

    door 1 -> room 0 -> door 0 location (works correctly)

    door 2 -> room 2 (correct) -> last location of door 2, but in room 2 (incorrect, should be door 3)

    door 3 -> room 0 (correct) -> door 0 location (incorrect, should be door 2)

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