silly question
by Anthony Ratcliffe · in Torque Game Builder · 04/20/2009 (5:53 pm) · 5 replies
hey guys ive been working on the 3d engine as of late and i thought it would be nice to go back to 2d. theres a few simple things ive forgoten tho
1: the line to run a data block in 3d its something
like schedule(time,name of datablock);'
2: is there a way to work out a distance between a player and an npc in 3d i used vector and line of sight ect
3:are there any tgb npc tutorials or resources seems the pickings are slim for 2d
1: the line to run a data block in 3d its something
like schedule(time,name of datablock);'
2: is there a way to work out a distance between a player and an npc in 3d i used vector and line of sight ect
3:are there any tgb npc tutorials or resources seems the pickings are slim for 2d
About the author
#2
04/21/2009 (8:00 pm)
one more thing are there any examples of mouse camera movement and attaching a trigger to an enemy so when ur inside the trigger i can change its state?
#3
04/22/2009 (9:18 pm)
bump i suppose, does no one use this forum anymore?
#4
2: You can do it different ways, I like to assign a global $player then you can either use $player.getposition(), or use the more handy $player.getpositionx() and $player.getpositiony(). The NPC part is where you get more variation...depending on your game you can do it different ways. Once you get the position of the player and NPC, just do a little math and you can find the distance.
A side bit of info I'll point out, is that the coordinate system in TGB on an algebraic grid is: Quadrant I (x moves +, y moves -), Quadrant II (x moves -, y moves -), Quadrant III (x moves -, y moves +), Quadrant IV (x moves +, y moves +). I don't know how useful that will be but I thought I'd point it out.
3: Not that I can think of...there is the Adventure Kit. You can tear that apart and learn from it, though. I bought it and I'm not using any of the code, but it helps to get an understanding of what some of the code can do when used in different ways. The problem is that there are so many NPC types, you can't really write an all-in-one tutorial for them.
04/22/2009 (11:36 pm)
1: You have that right, it's schedule(time, datablock);2: You can do it different ways, I like to assign a global $player then you can either use $player.getposition(), or use the more handy $player.getpositionx() and $player.getpositiony(). The NPC part is where you get more variation...depending on your game you can do it different ways. Once you get the position of the player and NPC, just do a little math and you can find the distance.
A side bit of info I'll point out, is that the coordinate system in TGB on an algebraic grid is: Quadrant I (x moves +, y moves -), Quadrant II (x moves -, y moves -), Quadrant III (x moves -, y moves +), Quadrant IV (x moves +, y moves +). I don't know how useful that will be but I thought I'd point it out.
3: Not that I can think of...there is the Adventure Kit. You can tear that apart and learn from it, though. I bought it and I'm not using any of the code, but it helps to get an understanding of what some of the code can do when used in different ways. The problem is that there are so many NPC types, you can't really write an all-in-one tutorial for them.
#5
playerMRWHITE = $player //where playermrwhite is the class name in the builder
$player.getpositionx()
$player.getpositiony()
$NPC.getpositiony()
$NPC.getpositionx()
$distancex = $player.getpositionx() -= $NPC.getpositionx()
$distancey = $player.getpositiony() -= $NPC.getpositiony()
if ( $distancex && $distancey <= 10)
{
//attack code
}
somthing along those lines? long time since i did this
04/23/2009 (12:22 am)
thanks for the response playerMRWHITE = $player //where playermrwhite is the class name in the builder
$player.getpositionx()
$player.getpositiony()
$NPC.getpositiony()
$NPC.getpositionx()
$distancex = $player.getpositionx() -= $NPC.getpositionx()
$distancey = $player.getpositiony() -= $NPC.getpositiony()
if ( $distancex && $distancey <= 10)
{
//attack code
}
somthing along those lines? long time since i did this
Torque Owner Anthony Ratcliffe