Ok, so I’m building a space game. Image the stage is 500 by 500, however the actual map is a lot bigger i.e. 4000 by 4000. as you move your spaceship (which is centered) you move around the (4000by 4000 px) map.
I am using both flash IDE and flash develop.
what is the best way to achieve this. Tutorial links would be appreciated.
thanks,
daniel
Position the container as per this formula:
x = -player.x + stage.stageWidth / 2;y = -player.y + stage.stageHeight / 2;You’ll notice that the player is always centred on screen regardless of the position of the player.
Overview:
Assume your player is at position:
x:120y:100. The above will move the container to be positioned as per these steps:x:120and negativey:100. This causes the player to appear in the top left of the stage.I’ve done a quick example that can be found here: http://junk.projectavian.com/env.zip