Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - kgilbert2

Pages: [1]
1
Support / What is the correct way to keep camera within tilemap bounds?
« on: February 16, 2015, 02:59:22 pm »
Hi,

I am new to Unity and 2D Toolkit, with a lot of experience with C#.  I am working on a top down 2D game, using tile maps and sprites.  I have setup the following:

Camera: 16 pixels per meter,  zoom factor of 1.
Tile Sprite / Collection:  16 pixels per meter, tiles are 128x128 pixel.
Tile Map:  15 columns, 15 rows.

Using GuiLabel, I have the following info on screen:

Tile Size X: 6.4, Y: 6.4 -  This is calculated using  tile map data.  I'm not sure if 6.4 is in units/meters.  If I multiply it by 16, is that my tile map bounds?
Cam Max X: 38.4 Y:54.4  -  If I remember correctly this is from the Camera instance's screen extents. 

I am having some trouble getting the camera to stay within the tile map bounds.  Can someone please point me in the right direction? 

2
Support / How do I get a reference to my tile map?
« on: February 05, 2015, 04:51:07 am »
Hi everyone.

I am new to 2D Toolkit.  My goal is to make a top down 2D game.   To start learning it, I have made a simple script, attached to my camera, to show me the tk2dCamera position using GUILabel, and to get the position for a user's touch on iOS.  I am running into trouble when getting a reference to my "Tilemap" object, cast as a tk2dTileMap. I  attempted to cast by finding it on GameObject, but it is an invalid cast. 

My questions:

What is the correct way to get a tk2dTilemap reference for the Tilemap game object from code?
Would TileMap.GetTileAt() be the correct way to get 0,0 positioned tile if I click in the bottom left corner?

I appreciate any help you are able to offer.

Pages: [1]