Player position after scene change


#1

I was wondering how I modify a player position after a scene change. Specifically to enter and exit buildings and to change the position of the character so he exits the building he entered


#2

you can store coordinates in variables for later use. and you can “teleport” (set position) or create (spawn) player or enemy or anything to a desired coordinate.


#3

Ok so there is no spawn command that I can find can you give me a visual of the events that would make this work? Or a link to a video with a similar concept. Because I’m lost.


#4

I have multiple doors in one scene that lead to other scenes. basically I want to do scene transitions through doors like Pokemon for Gameboy.


#5

the “spawn command” here is the “Create an object” action.


#6

if you want to move an object between scenes, you should create it on every scene or make it Global. when you choose the second potion, you don’t have to create your object again (I think. I couldn’t find a sigle word from this in the Wiki. LoL, thanks :+1:). just move to the desired position in the new scene. I guess…
both solutions needs the accurate coordinates. you should store them in variables, and read back them, when needed. or not. you can use other objects as a destination. the coordinates of the other objects, just to be precise.
it’s up to you. usually there are several solutions for a given task, the situation will decide which one is better.


#7

I know man it’s crazy I’ve been digging for like two days trying to find an answer to this. But even when I create a global object and I switch between scenes it just resets my position back to the original starting position of my player. I’ve tried using conditions like scene has just resumed and pause scene. But I don’t know how to set a condition that’s the player is basically leaving one door in a scene it needs to come through a different door in another scene. I don’t understand why this question has never been asked with all the people using g develop. And like you I was on the wiki for like 2 hours yesterday. Nothing about a Pokemon style game or another type of multiple scene switching game. I mean this really should be a basic mechanic.


#8

you didn’t find one condition for this, because it isn’t exists. I mean this isn’t simple a condition or an action, but something what we can call “game mechanics”. and your job is to create this.
I didn’t do similar task like this, but maybe I would try that:
define spawn locations in each scene. if a scene has more than one, I would assign ID for each. these spawn locations can be objects. and if they are, they can be hidden. after this, when the game changeing sceen, I would use the “at the beginning of the sceene” condition, and execute a “set position of an object” action (the player sprite) to the X and Y coordinate of the desired spawn location object’s X and Y coordinate. or may be not. I prefer use variables instead of other objects. I (and you too) can create a Global srtucture Variable with all the coordinates for all spawn locations in all sceenes. after this, we only need a good expression which is know what child variable we need.