I am making a game where it scrolls and you have to jump on these platforms, and if you don't, you fall and die. This is my code for detecting if on a platform:
CCTMXLayer *layer = [tilemap layerNamed:@"Layer 0"];
int posX, posY;
posX = sprite.position.x;
posY = sprite.position.y - 25;
unsigned int tile = [layer tileGIDAt:ccp(posX,posY)];
if(tile == 0){
// standable
}
else {
// not standable
}
When I do that code, the sprite is always standable. What is wrong?