Game Development Community

OnFire confusion

by Andy Hawkins · in Torque Game Engine · 05/28/2006 (3:59 am) · 5 replies

I want to control the animation of a character when the player clicks the mouse.

I understand the weapon and the player have ::onFire functions which I can override with my own, but which one should I use to animate the player?

Should I detect it when the weapon gets an ::onfire call or when the player gets an ::onfire call?

If its the player, should it be PlayerImage or Armour or PlayerBody?

You can see my confusion...

#1
05/28/2006 (5:21 am)
Create a recoil animation. This is what's played when the onFire is called in script from your Fire weapon state. The player has nothing to do with the onFire function in the context of what you wrote above.
#2
05/28/2006 (5:44 am)
I have a light_recoil animation for exactly that reason - but I don't want the character to hold a gun, so i didn't give it a mount0 null/dummy object. This seems to have the affect that when the character picks up a gun it doesn't fire. When it has no gun it and I click the mouse the light_recoil anim doesn't work. i just want it to strike out with a fist. I gave it values in the inventory for the crossbow to double check it could hold a crossbow and fire.
#3
05/28/2006 (8:21 am)
Actually I have a solution that works. Haven't figure out the collision for a fist yet but here what I did to get the punch to work.

1. Created a cube.
2. Textured it with a full transparent PNG
3. Copied the crossbow.cs file and modded it so it was called invisibleNode.cs and changed the word crossbow to invisiblenode for all the functions. The crossbow image is now the transparent cube.
4. added the invisibleNode weapon to the players inventory with some ammo.
5. removed projectile and particles for the crossbow bolt.
6. now the player thrusts a fist forward with projectiles when I click the mouse.
#4
05/28/2006 (8:30 am)
If you want other players to be damaged by the fist create a projectile which is invisible and fires only a very short distance. This will give you damage, very quick and hacky though.
#5
05/28/2006 (8:44 am)
Thanks. I did find another solution as well - casting a ray as posted here...

Sword collision

...this should do the trick for what I want - I guess i could do either...thanks :)