-
Walking in 2D game
Hi,
I want to see if my theory is a good one or if there is an easier way to do this. I want to create a 2D scrolling game similar to mario style where you walk, jump, etc. And I want the land that you walk on to change height such as slopes, etc. And also have multi-platforms on one screen where you can jump up on the other and walk.
Here is how I was thinking of doing it.
First I was going to drawn a very wide background full of graphics for the level. Then I was going to create an array for each platform having the X/Y coordinates. Each platform is a different array. For example, if there is one platform to walk on all the way along the bottom, thats one array. then any others above are seperate ones.
When I move my character, it just checks the coordinates of when moving forward and change the height of the character according to the coordinates. This keeps the character level with however the platform changes if it slopes, etc.
Is this a good way of moving the character when walking around?
Thanks!
-
Re: Walking in 2D game
-
Re: Walking in 2D game
Hi, Warren W.
The solution you came up with makes good sense and if you put it together right it should not be a problem. There is one catch though. Writing a simple routine that allows a character to move to the left and right will cover the majority of most side scroller levels. That includes jumping up to a platform and etc. That way there is less calculation during the scrolling. Then you could do exactly what you said and apply it to just the segments that slope. Collision detection will be a little easier to implement this way.