Uhmm I'm not sure what you were trying to tell me but I figured it out a different way.
Code:
if (CGRectIntersectsRect(block.frame, ground.frame))
{
{
if (block.center.y < ground.center.y)
{
if (velocity.y > 0)
{
velocity.y = 0;
gravity.y = 0;
}
}
}
}
but now I have a new problem. I have an IBAction/button called jump,
Code:
- (IBAction)pressJump
{
velocity.y = -2;
}
when I press it after the block hits the ground it floats up and gravity will never bring it down, when I press it before the block hits the ground gravity will pull it down until it hits the ground, and then gravity stops working.