#31540 - identitycrisisuk - Sun Dec 12, 2004 1:14 am
I've been holding off posting this until I was sure I'd given this some serious thought but I still don't think I can think up a nice solution. I think I'm okay with the actual collisions for 45 degree angle tiles, just using the offset of a position from the corner of a tile along the x and y axes can return a true or false result. I'm also pretty sure I can also reposition a point correctly when it's coming up the slope of a diagonal tile or when it would result in the point being inside the tile.
The only thing I can't really get my head around is getting a character to walk down a tile smoothly (this is a side scrolling platformer btw) and this is perhaps partially due to the way I've tried to program my character movement physically. When you're asking to go right it simply increases the x velocity and if there is no collision then it adds the velocity to the current position. Problem is, when starting to go down a slope there isn't necessarily a collision. For Example:
So currently my character goes down slopes in individual drops rather than walking all the way down. I'm unsure of how to detect this though, as in the above example the end pos is in a completely blank tile. Should I be doing some kind of test like:
IF the player was on the ground last frame AND hasn't just tried to jump AND end point is in the free part of a diagonal tile OR end point is above a diagonal tile THEN correct position to on the diagonal
That just looks horrible though, I have got states to make the testing for being on the ground and jumping easy but the on diagonal tile OR above diagonal test just seems a bit wrong. Haven't even considered slowing down and speeding up the character when going across these tiles so I'm sure that'll be a whole other fun task...
_________________
The only thing I can't really get my head around is getting a character to walk down a tile smoothly (this is a side scrolling platformer btw) and this is perhaps partially due to the way I've tried to program my character movement physically. When you're asking to go right it simply increases the x velocity and if there is no collision then it adds the velocity to the current position. Problem is, when starting to go down a slope there isn't necessarily a collision. For Example:
Code: |
Start pos ->*--------*<- End pos
---------------\ \ \ \ \ \*<- Where I'd like to be after this move \ \ |
So currently my character goes down slopes in individual drops rather than walking all the way down. I'm unsure of how to detect this though, as in the above example the end pos is in a completely blank tile. Should I be doing some kind of test like:
IF the player was on the ground last frame AND hasn't just tried to jump AND end point is in the free part of a diagonal tile OR end point is above a diagonal tile THEN correct position to on the diagonal
That just looks horrible though, I have got states to make the testing for being on the ground and jumping easy but the on diagonal tile OR above diagonal test just seems a bit wrong. Haven't even considered slowing down and speeding up the character when going across these tiles so I'm sure that'll be a whole other fun task...
_________________
Code: |
CanIKickIt(YES_YOU_CAN); |