Determining the tiles next to a specific position
by Bryan Zarnett · in Torque Game Builder · 08/14/2009 (8:27 pm) · 1 replies
I'm trying to create an "examine" function that based on the characters position, I want to go through all the tiles at the "next" position and determine: (1) if the examinableObject class is associated to the tile and then run the associated functions.
I can get the direction the player is facing as well as their current location.
What I am having trouble with is determining how to retrieve the tiles (image map tile) in the space.
Is the "pickTile" operation what I should use? $pickedtile = XXX.pickTile(33.750,-26.250);
If so, once I have the tile, I assume I can just call $pickedtile.Class to determine what the class is?
Any thoughts or help on this would be appreciated.
Am I even on the right track?
What should "XXX" be for pickTile if that is what I should use?
Thanks for any help.
I can get the direction the player is facing as well as their current location.
What I am having trouble with is determining how to retrieve the tiles (image map tile) in the space.
Is the "pickTile" operation what I should use? $pickedtile = XXX.pickTile(33.750,-26.250);
If so, once I have the tile, I assume I can just call $pickedtile.Class to determine what the class is?
Any thoughts or help on this would be appreciated.
Am I even on the right track?
What should "XXX" be for pickTile if that is what I should use?
Thanks for any help.
About the author
Torque Owner Bryan Zarnett
Thoughts on why I would see double?
$thescenegraph = sceneWindow2D.getSceneGraph(); %objList = $thescenegraph.pickPoint(%worldPos); %objCount = getWordCount(%objList); %hasBeenExamined = false; for(%i=0;%i<%objCount;%i++) { %obj = getWord(%objList, %i); if(%obj.getClassName() $= "t2dStaticSprite") { // See if the particular object is associated to our viewable class if(%obj.Class $= "examinableObject") { %obj.examine("x"); %hasBeenExamined = true; } } } if(%hasBeenExamined == false) { echo("Nothing to see here"); }