Game Development Community

Shooter Tutorial

by Mario N. Bonassin · in Torque Game Builder · 06/23/2006 (10:25 pm) · 1 replies

I seem to be having a small issue that I can't figure out what I'm doing wrong. Some time when the player shoots his missile and it hit and enemy missile the players missile goes away but the enemy's missile just sits there. I can hit it again and it just moves a little bit.

do i need to create another onCollision for the missiles?

#1
06/24/2006 (8:21 pm)
You need to make sure that in your player's OnCollision function has the following command (assuming your player is handling the collision responses):

%dstObj.safeDelete();

This should delete the missile (and depending on your code, everything else) that the player comes into contact with. If you have specialized collision commands for different objects that hit you (i.e - enemy ships and missiles) then you may need to specify in your onCollision the class of object you are colliding with:

if(%dstObj.class $= "enemyMissile")
   %dstObj.safeDelete();

if(%dstObj.class $= "enemyShip")
   %dstObj.explode();

or something of the sort, depending on what you want to have happen.

Hope that helps!