2

i have this code and on the second line it gives me an error that says invalid initialzer this is the code:

-(void)setPlayerPosition:(CGPoint)position {
 CGPoint tileCoord = [self tileCoordForPosition:position];
 int tileGid = [_meta tileGIDAt:tileCoord];
 if (tileGid) {
  NSDictionary *properties = [_tileMap propertiesForGID:tileGid];
  if (properties) {
   NSString *collision = [properties valueForKey:@"Collidable"];
   if (collision && [collision compare:@"True"] == NSOrderedSame) {
    return;
   }
  }
 }
 _player.position = position;
}
zneak
  • 134,922
  • 42
  • 253
  • 328
retsrif
  • 35
  • 1
  • 6

2 Answers2

1

I have the same problem with you. But when I declare function [tileCoordForPosition] in .h file, everything is built success.

Chanyut
  • 11
  • 1
0

I'm going to use my psychic powers and guess that you accidentally declared tileCoordForPosition: as returning a CGPoint* (that is, a pointer to a CGPoint) rather than a CGPoint.

(It would, however, have been helpful if you'd shown the relevant code so I wouldn't have to fire up the ESP.)

Chuck
  • 234,037
  • 30
  • 302
  • 389