Game Development Community

Min. tile code

by Gavin Beard · in Torque Game Builder · 03/05/2005 (6:00 pm) · 9 replies

Whats the minimum code i need to get a tilemap to display, forgetting the scene graph, no matter what i try it always seems to not show, atm i am adding

$tMap = new fxTileMap2D() { scenegraph = $bSceneGraph; };
$tMap.loadTileMap("~/client/maps/l1.map");
%layer = $tMap.getTileLayer( 0 );
%layer.setPosition( "0 4" );
%layer.setSize( "60 60" );
%layer.setTileSize( "4 4" );

into the relevent section of client.cs

the map is saved and the images are loaded as a data block, but still my screen is blank :(

cheers

#1
03/05/2005 (11:23 pm)
Gavin, did you go through the tile section in the basic tutorial? That shows you basically the minimum amount of code needed to display a tile layer (you can leave out the tilesize call in the docs).

If this code isn't working, my guess is either $bSceneGraph is not an appropriately set-up scenegraph, or ~client/maps/l1.map does not resolve to a valid tile map that can be displayed.
#2
03/06/2005 (12:23 am)
Yeah i did, i copied the code straight out there, xcept changing some var. names
the file is Here

i still cant see whats going wrong if n e 1 can look and tell me, its all in the clients.cs as i'm just playing around, but its buggin me coz i know its summin i am doing.

cheers
#3
03/06/2005 (1:09 am)
Any errors coming up in console, look for red text

(note: just incase you don't already know, hit the "~" tilde key to bring up the console)

other than that my two top thoughts were exactly the same as Josh
#4
03/06/2005 (1:17 am)
No red txt, just all black with loading compiled script..... etc

:'(
#5
03/06/2005 (1:22 am)
Ok, i got it now :D
it was coz i had deleted an image from my datablock that was there when i saved the map
#6
03/06/2005 (1:25 am)
Glad you got it working, lol always little things, but then again better something small than something large
#7
03/06/2005 (4:16 am)
Tis true, now i got to get my head around these coord systems, seem illogical, but once i read up i'm sure it'll be all good
#8
03/06/2005 (5:57 pm)
The akward thing is the coord system is "logical" :) It uses a logical system rather than screen pixels which gives you soooo much more power
#9
03/07/2005 (12:57 am)
... the man speaks the truth.

The good thing about going down the logical-coord route is that you can still make the coords equate to pixels if you want.

Choice = Good. :)

- Melv.