playMaker

Author Topic: how to move character to the next level & set his position  (Read 1044 times)

yassinko

  • Playmaker Newbie
  • *
  • Posts: 1
how to move character to the next level & set his position
« on: February 07, 2021, 04:07:57 AM »
Hi everyone
When I finished the first Level and moved to the next, I faced the problem of character transform
I Used "dontDestoryOnLoad" Acion in the end level fsm
But I had a problem that I could not set the position or the size of the character "transform" , since the character only appears when reviewing the game
Is there another solution that gives me the ability to modify and set up the character for the now level ?

I tried to cut and paste the character into the new scene
But that caused increase the game Apk size and that's what I don't want

thnx all

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: how to move character to the next level & set his position
« Reply #1 on: February 07, 2021, 11:21:32 PM »
Yes and plenty of them actually

Here are some quick tips to try

1. Prefab your characters and using create/destroy command will do if your char doesnt carry anything from the previous level

2. Activate and deactivate your character. And use set pos in between

3. Create a start point GO on each level and set the character on that start point coordinate

4. Use array to store all the coordinates and retrieve them on each level

Etc

All of those are just idea, unless you have other specific problem and depending the state of your project (prototyping? production level?)

I assume your problem is prototyping scale. Production level probably gonna takes more sophiscated solution

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: how to move character to the next level & set his position
« Reply #2 on: February 09, 2021, 03:58:32 PM »
Hi.
In our game we have our character in a separate scene (but don't destroy on load will work also, if on the character)

When the character is loaded, it is set into a global variable.

then on change scenes we disable player movement and use a canvas to cover the screen (loading screen)
then on new scene we have a 'Scene Manager' fsm which will position the player to where he should start and then turn off the loading screen and enable player movement.