Group Group Group Group Group Group Group Group Group

Additional SKTileMapNode questions

Hey everyone! Over the last few months I’ve been grinding my way through the apple game by tutorial book. I was particularly looking forward to the SKTileMapNode section, but unfortunately I found that not all the topics I would like to see covered where covered.

I’ve always been looking forward to making a game like King Rabbbit:
But after reading through the SKTileMapNode section, I still have no idea how I would go about making a game like this. The book go’s into great detail on how to detach bugs and walls from the SKTileMapNode and give them PhysicsBodies, it also go’s into great detail on collision, picking up bug sprays. However, it does not cover how you would go about making a game where the player can only move from tile to tile, pushing “boxes” onto the next tile.

I’m aware a “player” can be on a tile, when moving to the right, we could set the current tile to nil, setting the tile in the next column to “player”. But how do you animate this?

Also, when wanting to move to the right, how do we check if there is a “block” that can be moved? or if it cant be moved, how do we keep the player from moving without using the physicsBody?

It would be very much appreciated if anyone could provide me some tips, tricks, sampelcodes, or places I could go to learn more about this.

I’m not sure where the difficulty lies.

The book describes how to set bug spray in the tile map, so you could set boxes in the same way.

Instead of picking up the boxes as you do with the bug spray, as the player moves onto the tile, you could move the box one square in the same direction of the player. You’d set the old box tile to nil, and set the new tile as the box.

You don’t even need to do physics for that.

Alternatively, if you did want to use physics, then on collision, instead of removing a bug, you move the box in the same direction as the player.

This topic was automatically closed after 166 days. New replies are no longer allowed.