Best way to track position on a large map?

0 favourites
  • 11 posts
From the Asset Store
Two types of minimap: "full map" and "player is the center" (square map and radial map)
  • Lets say we have a map that is -10,000 x -10,000 to 10,000 x 10,0000 (pixels... or units?)

    I'm loading the "map" (level) by sections around the user.. So say the user is standing at 0 x 0, I would load 1000 pixels (units?) in all directions. Then load / remove zones as the user moves.

    This being a 2.5 D game, the user can walk up, down, left, and right.

    How should I handle the position of the map (level)? Should the user be "moving" and I just track there pixel location? Or should I move the background (and all objects on the background) and just lock the user to the center of the screen? Does it even matter?

    I'm very mew to construct, and when you create a new project, you have that white area to present all your stuff (don't know the proper term - maybe stage?). Do I need to make the stage match my map size? or does the stage just need to match what the user can see, and everything else moves?

    Just a little lost here...

  • track the player by pixel that is probobaly the best way

    ps.

    we'll if your mew to construct your going to need a lot of help

  • sosensible If I'm tacking the user by Pixel, and the user leaves, and comes back (refreshes page)... do I just move the player to x / y in the viewport then load the map around them?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that sounds like it thould work unless your generating it randomly

    ps.

    if you did not notice it you said you were """mew""" to construct might want to edit your post

  • sosensible lol, I did not even notice that..

    So that white box when load Construct 2 is called the "view port" right? does that need to be the same size as my map/level?

  • i'm not quite sure what you mean but if your going to be making games in construct for mobile your going to want to set your view size to scale in the full screen in browser option

  • Is there an article about the whole scale thing?

  • You tend to centre the camera on the player and scroll the play area to suit, but there are no rules, if you can think of a different approach, then go for it,adding scroll to behavior to the player will keep him central to the screen.

    That white box in the editor is your layout, levels tend to be inside these, but you could have a level larger than that, see unbounded scrolling, Your view port is the visible play area at runtime

  • pixel perfick

    So do you suggest I add "scroll" to the player? and then will that allow the player to walk "forever" in any direction? I will add walls on the edges, so i don't have to worry about the user walking outside of the level. I just want to know the "best" way... My first project will allow the user to log off and on so I need to be able to put them back at the last know position.

  • Okay, so I added the scroll and set the layout to allow unbound scrolling. That seems to give me unlimited space :-)

  • You have done it the "standard way", which is reckoned best...

    To return your player back to where it was, create two global variables, position x and position y, then if player dies or leaves the layout, set these values to the player x and y before destroying it, then on return, create the player at these variables...

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