Project Outlands: movement

Decided the best place to start was creating the player movement and background scroller. I cheated a bit here, cause I copied a large part of code from my INC game (since I think this game will be an extension on that universe)  but I wanted better movement so added fixed-point math to make the player move a lot smoother around the screen.

For now I’m going with a single 480×160 pixel bitmap as background, no tiles or anything, just a collision map defining the solids (floors, walls, etc).  Added advantage: very fast rendering, and possible to add better variation and detail to the background. 480×160 in this retro mode means about two screens wide and one screen high on mobile phones.  Very small, but since I want this to be a chaotic shooter, it should work perfectly

The scroller comes with a little delay, so you can run away from the camera, but since the game area is so small you will never be able to really outrun it. Even cooler, all it takes to make this scroller is this line:

worldOffset+=  ((myPlayer.x-128)-worldOffset)>>2;

And substracting the worldOffset variable from all your rendering makes things appear at the right spot with the player centered!

 

Bookmark the permalink.