Tweaking the CollisionFree approach: how does yvelocity work
Posted: Wed May 02, 2012 9:08 am
Hey fellas!
So I am now working using the approach suggested by Game A Gogo here:
viewtopic.php?f=6&t=9992
However, I have now faced a problem. This concerns the speed of jump. The higher it gets, the more chance that at certain distances your character will get stuck in the platform above.
I have attached a pic and a ged file for you to look at. Jump with the 'z' button.
Those platforms, which have a C-like block above them, are platforms in which you will get stuck. As I change the distance slightly, the CollisionFree engine implemented in this exact game does not allow any more sticking in.
So the question is this: how does yvelocity work? In this code yvelocity is +=.16 So it is increasing by that amount. Obviously, there comes a point in which at a certain distance it becomes more than what is specified in the code, in this case y + yvelocity - 8 and so the game does not stop the actor in time before it is stuck in the platform above.
The reason I want to understand how yvelocity works is that it would then be probably possible to come up with a generic formula which will allow to eliminate any sticking into the platforms or other objects on top. So far this is the only immediate downside of this CollisionFree approach.
So I am now working using the approach suggested by Game A Gogo here:
viewtopic.php?f=6&t=9992
However, I have now faced a problem. This concerns the speed of jump. The higher it gets, the more chance that at certain distances your character will get stuck in the platform above.
I have attached a pic and a ged file for you to look at. Jump with the 'z' button.
Those platforms, which have a C-like block above them, are platforms in which you will get stuck. As I change the distance slightly, the CollisionFree engine implemented in this exact game does not allow any more sticking in.
So the question is this: how does yvelocity work? In this code yvelocity is +=.16 So it is increasing by that amount. Obviously, there comes a point in which at a certain distance it becomes more than what is specified in the code, in this case y + yvelocity - 8 and so the game does not stop the actor in time before it is stuck in the platform above.
The reason I want to understand how yvelocity works is that it would then be probably possible to come up with a generic formula which will allow to eliminate any sticking into the platforms or other objects on top. So far this is the only immediate downside of this CollisionFree approach.