GetTileCustomData
by Ohio University (#0018) · in Torque Game Builder · 11/20/2007 (10:48 pm) · 2 replies
I'm very new to Torque and programming in general and I'm pretty sure this is an amazingly stupid question. I want to call the function "getTileCustomData" for a given position so that I can have my player check to see if a wall is next to him on my Tile Map. I filled in the custom data "Wall" for that particular tile. My first question is where does the tile map start from. Is the bottom left tile 1, 1 or is that some other tile. My next question is what object should be calling the "getTileCustomData" function. In the tutorial it says this "t2dTileLayer::getTileCustomData(%tileX, %tileY);". That doesn't look like something you can call from within a function. does "t2dTileLayer" refer to the file name of my tile layer or something else. If it's the file name my file name is Background.lyr. would I need to include the .lyr extension there? If not do I need to give my tilemap a class? Anyway, I'm rambling. My basic question is: can I have an example of how you would use the getTileCustomData in a function. Be very specific, if you need any more info about my game to achieve a level of specificity necessary to teach a n00b like me how to do this then feel free to ask for more. Thanks in advance, sorry I'm stupid.
Associate James Ford
Sickhead Games
I believe the top left tile is 0,0.
>>what object should be calling the "getTileCustomData" function
This can work:
Or, give your tilelayer a name in the editor like you would any other object and do:
t2dTileLayer is the classname... gettilecustomdata is a method of the t2dtilelayer class, but you must call that method on a particular object/instance of that class. By giving your tilelayer a name you will have that ability.
The file name of a tilelayer doesn't matter, what matters is that you have a named tilelayer object in a loaded level.