Moving player to new spot in a scene after entering secret room

meems

  • Posts: 12
Hi there,

I'm relatively new to Stencyl, so I'd be happy for tips on the correct search terms to use if I have missed the answer to this question.

I am trying to get my character to go through door #1 (scene 1) into a secret room (scene 2) and then exit through door #2 back into scene 1, but in a different place in the scene.

I have got the  scene transitions working, but the actor always loads at the beginning of scene 1. I feel like this must be elementary and I just don't know what terms I should be using to search for the solution. But if it's not elementary or there is no tutorial for this yet, could someone suggest how it could be done?

Thanks,
Miriam
"I don't know much about Science, but I know what I like"

ipe 369

  • Posts: 1001
There's a block in scene > game flow which says 'create actor in next scene'. Use that. :)

meems

  • Posts: 12
Thanks, I did find that, and now I've got the actor showing up in the right place, but as soon as the scene loads it reloads and the actor is back at the beginning?

Any help would be much appreciated.

m
"I don't know much about Science, but I know what I like"

ipe 369

  • Posts: 1001
I don't understand what you mean. If you reload the scene using a block, make sure straight after it you put create blah blah in next scene. :) Be sure to remove the original player by the way, or you'll have 2 players and the camera could get confused, if you used a camera.

meems

  • Posts: 12
I think that is what is happening but I am not sure how to kill the original player? I know these are all very simple questions.

m
"I don't know much about Science, but I know what I like"

You need to spawn the character into the scene through code. Basically, I am having this issue, also. You can write a scene behavior that will execute upon the scene loading that will load the player at x,y in the game. To go back to a previous level your new code needs to override or turn off the default "load player at x,y position" (the scene behavior).

Hope this helps.

to put it visually:

Scene Behavior: spawn player scene one>>>>Move to end of level and Exit Scene One>>>>>>Then Load player at x+y Scene Two. Check?

<<<<Exit Scene Two from left side<<<<<<(return to scene one)

Load scene One but Override original Spawn actor at x+y and load character at new x+y.

You can make regions at the ends and beginning of the scene (or doors, or whatever) which trigger the scene behavior. If you exit level two from the right you go to scene 3, if you exit it from the left, you go BACK to scene one, but the region at the left overrides the previous level's spawn behavior. That way you don't have two players at the same time. Also, make sure you don't just place the player in the game (except for testing maybe), because the player needs to spawn via code, or you will always have two players running around when the scene loads.