Right now I have this:
for (int i = 0; i < level.contentSize.width/level.tileSize.width; i ++){
tile = [levelLayer tileAt:ccp(i,17)];
if (CGRectIntersectsRect(ball.boundingBox, tile.boundingBox)) {
NSLog(@"hit");
}
}
What I need to have is two variables (right now I have one- i) so that I can check all tiles in all x and y values. So the tile = [levelLayer tileAt:ccp(i,j)]; <—would look like that.
You can try using inner for-loop with another loop variable j iterating through all possible values. Something like: