Page 1 of 1

Side-Scrolling

Posted: Thu May 28, 2015 1:27 pm
by kansha
Hello,

I am very new to game development. I'm working on my first game and decided on a side-scroller. I know I can add segments to cpSpace and then just adjust their x-axis position so that slopes and gaps match up; moving the tile graphics as well.

My problem is, my player polygon is moving with inertia and will eventually leave the screen. I can't figure out a way so the player moves normally with they physics engine, but stays static while just the map moves.

I think the answer is the polygon does go "off screen" but the graphic sprite is drawn with some sort of X-axis offset. I am just not sure how to go about doing this.

Any points or tips would be much appreciated.

Re: Side-Scrolling

Posted: Thu Jun 11, 2015 12:04 am
by tekk
Your drawing is completely separate from the Chipmunk coordinates, in theory. What you need to think of it as is this: your camera is a box view of the chipmunk space that you created, and that box moves with the player. It has nothing to do with chipmunk, except maybe pulling the player position and checking how close to the edge of the camera's box is.

Re: Side-Scrolling

Posted: Thu Dec 10, 2015 9:41 pm
by s_ridenour
Yeah, just move your "camera" with the player. Maybe have it a bit loose so that it doesn't follow the player 1:1 per pixel.