Game Development Community

Sword Combat

by Rich Wilson · in Torque X 2D · 10/12/2007 (2:26 pm) · 2 replies

I've searched the forums to the best of my ability, but haven't seen an answer to this problem.

Let's say I want to do a top down zelda-like game with a sword swinging character. I can figure the animations and whatnot out, but how do I make the sword do damage? I understand the projectile stuff just fine, but doing a melee weapon that's based on the state of an animation seems different.

If I were to mount some invisible collision to the character, I'd have to make sure it was always on the side the character was facing, plus if he was hitting a guy with a shield from the front, I'd have to register that collision with direction to know that the enemy can't be hit. It's becoming apparent why so many people do spaceships.

#1
10/12/2007 (3:40 pm)
One way to do it in TGB would be the pickRect or pickCirc functions. I do believe these functions have TorqueX counterparts. They let you pick a rectangle or circle anywhere and tell you what objects are within that area.
#2
10/12/2007 (3:51 pm)
Is there some kind of ray casting functionality in TX? Some way I can cast from a point and get a list of objects that intersect with that line.