Hello, everyone. I'm having a few issues with my current platforming engine.
In my contactlistener I have the following:
And when the up key is pressed and canjump is true, I just apply an impulse of (0, -5). The problem is, when I jump up while climbing up a diagonal slope, or while running into a wall, I skyrocket into the air. Is there any way of fixing this? Thanks in advance!
In my contactlistener I have the following:
Code:
override public function Persist(point:b2ContactPoint):void
{
if (point.shape1.GetUserData() == "groundsensor" || point.shape2.GetUserData() == "groundsensor") {
canjump = true;
}
}
override public function Remove(point:b2ContactPoint):void {
if (point.shape1.GetUserData()=="groundsensor"||point.shape2.GetUserData()=="groundsensor") {
canjump=false;
}
}
{
if (point.shape1.GetUserData() == "groundsensor" || point.shape2.GetUserData() == "groundsensor") {
canjump = true;
}
}
override public function Remove(point:b2ContactPoint):void {
if (point.shape1.GetUserData()=="groundsensor"||point.shape2.GetUserData()=="groundsensor") {
canjump=false;
}
}
And when the up key is pressed and canjump is true, I just apply an impulse of (0, -5). The problem is, when I jump up while climbing up a diagonal slope, or while running into a wall, I skyrocket into the air. Is there any way of fixing this? Thanks in advance!