I'm trying to create a map of touchable hexagons and the playing area would be like in Catan game. I would like to use Sprite Kit to do the job but is it cabable of doing that?

Process goes like this:

  • user touches one of the hexagons and if it is not disabled game show some actions

Example of clickable area

This is turn-based game so I'm using game center to handle that side.

I have already found very good article about hexagonal grids. In my game the playing area is fixed (19 hexagons) so is there easy solution to do that with Sprite Kit?


I would make a sub-class of SKSpriteNode. Each instance could hold its own texture(image) and possibly the numbers, playerImages, etc as children.

Include -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event to handle the touch events. Make sure that the sub-class includes: self.userInteractionEnabled = YES;

Each sprite includes a userData dictionary. You can use it for custom info for each sprite: playerOwnership? landType? etc.

There are many options here. I'd suggest creating your own custom init Method. Here's one I wrote:

    -(id)initForPlayer:(NSInteger)forPlayerNumber inScene:(id)theScene xMax:(NSInteger)xMMax  xMin:(NSInteger)xMMin yMax:(NSInteger)yMMax  yMin:(NSInteger)yMMin
    self = [super init];

    - your code here -

    return self;

as long as your first word of the method is lower case "init", you can add as many Parameters as you need. Your return type could be SKSprite*.

You can give each instance some Properties that can be changed from the parent, like background image.

I'd create / store these in an array in the parent to be able to access them individually.in the parent

  • \$\begingroup\$ I created Hexagon class. What is the best way to initialize all those 19 hexagons in main class (GameScene)? How to create an array of SKSpriteNodes? \$\endgroup\$ – anttir Jan 28 '15 at 12:09
  • \$\begingroup\$ I added more info above. let me know if you need anything else. \$\endgroup\$ – Scott Feb 16 '15 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.