Forum rules - please read before posting.

2D Have player walk off/on screen when changing scenes

I ran into a few walls while trying to make scene changes a bit more fluid.

1. Is there a way to run an action for a specific player start? In this case I would like to on scene load to have the player start off screen and then have the player walk on to screen. Currently I just assumed I would need to check in an OnStart cutscene my player's location to determine the player start and move the player to the appropriate on screen marker.

2. Walking off screen. I have an exit right hotspot where once you reach the edge of the screen it checks if you have a specific item. If not you walk backwards and talk, if so you walk off screen and load the new scene. However in between moving to the on screen hotspot marker and then moving to the off screen marker the player returns to idle briefly and it looks weird for a frame. Small issue but an issue nonetheless. So in between two move to marker actions the player will change to idle. Is there anyway to make these two actions transition and not interrupt the walk animation? If I had a cutscene of running in a circle the player would appear to move, stop, move, stop, etc.

Thanks all. I am sure I am not the only one here who wants the player to walk off/on screen for new scenes.

Comments

  • I think you might be over-thinking this one.

    What I would do (and do for some exits) is have the scene much wider than the screen space/camera edge allows. This way you can simply activate an exit cut-scene to your liking and, instead of following the character fully, you simply have them walk to a spot far off-screen while the camera stays put.m Same for your entering a scene. Just begin the scene where they walk to a point on-screen. 

    This method will most likely require a simple variable to use.

    In mine I have 'transport tubes' of a sort and so I need the character to come out of the tubes. It's much more complex than simply entering the 'stage'.
  • Xidore, thanks for the response.

    I currently have it setup as you said but when I load the scene how do I know which player start the player started at and thus use the appropriate marker to walk to on the scene start?
  • Ah that's straight forward. You need to know from which scene your player has just come (It's set in the order they are in your build settings) This is a variable in your player start.

    Look in the inspector for the Player Start (Script) and you will see a variable called "previous scene". Scene 0 is the first one in the list.  It's awkward if you change the order of scenes in the build settings but so long as you keep track of what you change you can make it work.

    I haven't looked in the very latest AC but I seem to recall from the update log that this might have been changed to let you use Scene Name instead of Number.
  • edited December 2014
    Xidore,

    Yes in the latest version you can set it by name. So lets say that I have that setup correctly and the player starts at PlayerStartB. I then need the player to move to marker B. Thus this sounds like an OnStart cutscene job. The issue is how do I check what scene the player came from inside the cutscene? I can't just always send him to marker B if in fact he entered from a completely different scene and thus is standing at PlayerStartA. In that case I would want the player to walk to marker A instead.

    It would be ideal if a player start could run a list of actions, but then that is right at the same time the OnStart cutscene runs. Thus I believe the answer here is to find out which scene the player came from inside the OnStart cutscene action list.
  • edited December 2014
    If the playerstart variable for 'previous scene' isn't enough. Surely you can just store your own global variable and check that using the onstart/onload cutscene? You can then ensure that your player starts in the right spot and walks to the correct point in the scene.

    Chris will be able to say, when he gets back, whether we could perhaps access the variable which is being fed into the 'previous scene'. A simple way would be to let us set a global variable to be equal to the previous scene, this would hopefully make it easy for the 'check variable' function to work as it already does in the ActionList set.
  • Okay so we can check the previous scene in Engine: Check Scene. I would still like to know if there is a way to prevent the character from returning to idle for a frame inbetween marker moves.
  • Try using a Trigger to detect the player walking off-screen instead.  If you keep the Marker / Hotspot, check "Cancels interactions" in the Trigger inspector.  Using a Trigger may remove the one-frame idle animation.
  • edited January 2015
    If I use a trigger and have it send me to walk off screen to the right then what about when I enter the scene from the right and I walk into the scene? I can't have the trigger check the previous scene as its perfectly acceptable to allow the person to walk back to the previous scene.

    I suppose I would have to on OnStart check the previous scene and if its from the right, disable the trigger, have the player move to a marker in scene but outside the trigger, then re-enable the trigger. I also now need to make sure my character can't walk into these triggers via normal navmesh movement. Perhaps I am missing another way to handle this?

    Btw the trigger does remove the one frame idle though.
  • That sounds about right to me.  If it works, go with it, I'd say.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.