Game Development Community

Tile maps

by J Sears · in Torque Game Builder · 11/22/2006 (12:44 pm) · 4 replies

I had a question on working with tile maps. I can see how to get a tile by a mouse click. What I was wondering is how without any player interaction can you work with specific tiles just with script. For other objects I'd do a search through scene objects to get the one I wanted, but I don't know how to do that for tiles in a tilemap.

Basically I'm trying to deal out cards to players, and each round will be more cards dealt. In my freecell game I just used mount points then mounted to the cards since the amount of cards would always be the same. But with this deal I'm trying to use a tile map so that each round I can easily move the starting card over to keep the cards centered for the player.

#1
11/22/2006 (3:17 pm)
There are a whole host of tile layer manipulating functions listed in the TDN reference. Usually you just pass in the logical x and y coords of the tile you want to work with. Is there something specific you want to do to the tile that we could help you with?
#2
11/22/2006 (6:04 pm)
I wanted to set up 6 different tile spots for the different players cards, and wanted to be able to do a search in script while the game was running for the different tiles so I could place the cards in them. Would be a pain to have to get the x y from the game builder and then hardcode in everyone.
I want to be able to change which tile the first card gets delt to for each player each time to keep the cards centered. I have started to figure out how to do it with a bunch of blank scene objects as mount points, if there's no easy way to get a list of tiles in script I will just do it that way
All the references I found in the TDN talk about tilelayers creating new ones all that.
#3
11/23/2006 (9:08 pm)
What do you mean by getting a "list of tiles" in script? If you had a 2x2 tile map your list of tiles is:

0 0
0 1
1 0
1 1

Check out this reference. What you're trying to do is largely still a mystery to me. I don't understand what you mean by needing to get the x y and hardcoding it. You can change which tile to put cards in by keeping some var somewhere contains the vector to the next tile to access.
#4
12/04/2006 (10:14 am)
Well I guess that pretty much answers what I was trying to figure out, if the tiles are always numbered the same for every tile map it would be easy I think. I was just trying to make 6 1x20 tile maps to deal the cards to and then when the player clicked on a card if it was a valid card to play take that card from the tile and move it to the center and move all the cards over to fill the spot.
My original question that I guess was misleading was saying I needed to be able to know what the tiles were so each new card that got dealt out I could move 1 tile to the left for first card delt just to keep the cards centered in the screen.
I still haven't decided if this task is easiest with tilemaps or with mounts for a couple reasons but thank you for that help I really didn't think that it was as easy as 00 01 02 etc