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.
Side-Scrolling
-
- Posts: 3
- Joined: Wed Jun 10, 2015 8:22 pm
- Contact:
Re: Side-Scrolling
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.
-
- Posts: 2
- Joined: Thu Dec 03, 2015 1:59 am
- Location: Colorado, USA
- Contact:
Re: Side-Scrolling
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.
Who is online
Users browsing this forum: No registered users and 5 guests