I used Adobe Illustrator to draw the ground. Save it as XML file.
Parse this XML to my code.
I created my main character as rectangle.
I don't know whether my charactor is "in the air" or "on ground".
I used to check GetLinearVelocity().y == 0, but still have some trouble when the "collision point with ground" is on the hill. If the player keep go/down hill after touching ground,


mainCharBody->GetLinearVelocity().y != 0
I thought about the contactlistener. But it will makes error when the mainCharacter touch the wall.
Anybody can help me?
Parse this XML to my code.
I created my main character as rectangle.
I don't know whether my charactor is "in the air" or "on ground".
I used to check GetLinearVelocity().y == 0, but still have some trouble when the "collision point with ground" is on the hill. If the player keep go/down hill after touching ground,


mainCharBody->GetLinearVelocity().y != 0
Code:
if (mainCharBody->GetLinearVelocity().y == 0 && onAir == YES) {
[mainChar setDisplayFrame:frame];
onAir = NO;
}
[mainChar setDisplayFrame:frame];
onAir = NO;
}
I thought about the contactlistener. But it will makes error when the mainCharacter touch the wall.
Anybody can help me?