Creating a melee-attack enemy
by kgoodrid · in Torque Game Builder · 09/12/2008 (5:41 pm) · 3 replies
Hey folks,
I'm a novice with TGB. I've successfully completed several tutorials, and am now trying to apply the things I have been learning to a prototype project of my own.
I've been trying to create a zombie-style enemy for a top-down game I am working on.
I had some success creating an enemy that would move towards the player and then collide with the player (based on the Asteroids tutorial) and kill it. There were some problems though; groups of zombies would collide with each other and kill each other. In the end, I felt that my method was just a bit too simplistic.
Now I've been trying to create a new enemy based on the Orc from the Adventure Kit. I'm having trouble figuring out how to swap in all of the zombie art; it seems rather complicated for a novice, and the documentation is lacking. Plus, the Orc only has a ranged attack. I've tried fiddling with the settings to make the Orc only attack at point-blank-range, but this doesn't seem to work very well.
So, what would y'all recommend I do? I just need a simple enemy that will attack the player at close range, and perhaps have some scripting / behaviors to determine how it will move, patrol, and attack.
Thanks!
I'm a novice with TGB. I've successfully completed several tutorials, and am now trying to apply the things I have been learning to a prototype project of my own.
I've been trying to create a zombie-style enemy for a top-down game I am working on.
I had some success creating an enemy that would move towards the player and then collide with the player (based on the Asteroids tutorial) and kill it. There were some problems though; groups of zombies would collide with each other and kill each other. In the end, I felt that my method was just a bit too simplistic.
Now I've been trying to create a new enemy based on the Orc from the Adventure Kit. I'm having trouble figuring out how to swap in all of the zombie art; it seems rather complicated for a novice, and the documentation is lacking. Plus, the Orc only has a ranged attack. I've tried fiddling with the settings to make the Orc only attack at point-blank-range, but this doesn't seem to work very well.
So, what would y'all recommend I do? I just need a simple enemy that will attack the player at close range, and perhaps have some scripting / behaviors to determine how it will move, patrol, and attack.
Thanks!
About the author
#2
you can achieve this with vectors, and TGB comes with some pretty handy functions for that... look in the T2DVector section of the offline reference.
09/21/2008 (8:02 am)
Also, for your point-blank attack, you could calculate the distance between your main char and the Orc, and when that distance is short enough for the orc to attack, then trigger the attack function.you can achieve this with vectors, and TGB comes with some pretty handy functions for that... look in the T2DVector section of the offline reference.
#3
10/07/2008 (1:53 am)
Thanks for the replies. I appreciate it. I'll look into trying that.
Torque 3D Owner Aaron Miller
Have you tried setting collision groups for your enemies? I had a similar problem, and I put my enemies on their own layer separate from the player, then set the player to only receive collisions from their layer and them to only receive collisions from the player's layer. That way allies couldn't hurt each other.