Sonic style platforms

BlitzMax Forums/BlitzMax Beginners Area/Sonic style platforms

QuickSilva(Posted 2007) [#1]
I`m trying to create a platformer with similar style slopes as in Sonic The Hedgehog (the older Megadrive 2D titles) that make the player rotate slightly as he\she goes up and down the slopes (they are curved). This is proving quite difficult and I thought that I`d ask to see how others would tackle the same problem without mentioning how I plan to do it to see if anyone has any different ideas that could work.

Any help would be great,

Jason.


Derron(Posted 2007) [#2]
Set the Handle of the "Sonic" Sprites to the point he/she would rotate around, measure distance from this point to the bottom of the sprite and use this distance to place the sprite into the slope (lowest point when the slope wouldnt be rotated).
Or to save this time, use a really circular slope and there will be no need to calculate the lowest part of the slope-sprite the figure is walking on.

To make it also work on "hills" or other things you just calculate the angle of the point the figure is standing on (angle to horizontal line) and apply the angle to the figure the same way (handle of sprite image has to be set to the center of rotation) ... Distancecalculation is the same (handle to bottom).

If the angle is over a certain value (70° for example) you set the figure to "fall" instead to "walk"... or if its 160° you would say "block" (has to jump) ... depending on the walking direction.


bye
MB


Beaker(Posted 2007) [#3]
May I suggest using spline paths?


MGE(Posted 2007) [#4]
Yah the way to go now days is to avoid all that math and simply create a table for every tile the sprite is on. In that tile you can create a 2D array for every pixel in the tile where you can pre-calculate angle, height, etc, based on the x,y position of the sprite on the tile. Very easy, works beatifully. ;)


QuickSilva(Posted 2007) [#5]
Thanks for the suggestions. I`ll give some of them a try and see how things pan out.

Jason.