Ah right, I get it. I thought you originally meant to include all but the if(onTop) variable outside the for() statements, but I now see that this would not have worked. Setting the speed of the character to the speed of the block does not seem to work, however, so I am going to post my jumping code and ask whether you would kindly take a look and see how to make my character fall at the same speed of the block:
Code:
-(void)gameLoop {
if(character.center.y < 450)
{
ySpeed += 1;
}
if (firstSwipe == true) {
if(character.center.y < 450)
{
ySpeed += 0;
}
}
else if(character.center.y > 450)
{
jumpCounter = 0;
ySpeed = 0;
character.center = CGPointMake(character.center.x, 450);
}
character.center = CGPointMake(character.center.x, character.center.y + ySpeed); }
-(void)characterJump {
if(gameState == kGameStateRunning) {
int setter = jumpCounter;
if(jumpCounter < 2)
{
setter += 1;
ySpeed -= kJumpStrength;
}
jumpCounter = setter;
} }
Thanks for all your help
Cam