The Dragon has landed
by Zilla · in Torque X Platformer Kit · 08/25/2008 (1:18 pm) · 6 replies
I created several enemies with the same behaviour as the drill but with different animations and unique names in TXB.
How can I detect, on which enemy my dragon has landed?
How can I detect, on which enemy my dragon has landed?
#2
Thank you very much for your ideas.
Where exactly in the "custom collision" should I implement it?
Because everywhere I tried to put it in, I get a "false" return value.
08/26/2008 (4:12 am)
Hi, VictorThank you very much for your ideas.
Where exactly in the "custom collision" should I implement it?
Because everywhere I tried to put it in, I get a "false" return value.
#3
I want to "split" my actions when the drill and the other enemies die:
e.g.
- drill died? -> play an animation
- enemy1 died? -> do not play an animation
- enemy2 died? -> create another object
etc.
My problem still exists: I cannot find out, which enemy or drill died.
What could be wrong?
08/26/2008 (7:39 am)
I think I have to go into some details with my question:I want to "split" my actions when the drill and the other enemies die:
e.g.
- drill died? -> play an animation
- enemy1 died? -> do not play an animation
- enemy2 died? -> create another object
etc.
My problem still exists: I cannot find out, which enemy or drill died.
What could be wrong?
#4
Hope you can figure it out, Viktor
08/26/2008 (7:42 pm)
This is in the _onEnter method of the DrillHeadKillComponent, I'm assuming this is what your using for all of your enemies. Mine only contains the code for handling collisions with a drill but you should be able to use if and else if statements as previously described to handle other enemies. // check the angle against our angle threshold
if ((angle <= _maxHeadKillAngle || angle >= 360 - _maxHeadKillAngle) && theirObject.Physics.VelocityY >= ourVelY)
{
// add code here
_drillActor.TakeDamage(_takeDamageOnLand, dragon.Actor);
dragon.Bounce(100);
SceneObject.CollisionsEnabled = false;
}If your problem is just that your not able to get the correct object type than you may be able to find out more by setting a breakpoint in the problem area and stepping through(F11), you can check values of local variables by using the Locals menu while debugging. But because I've never had a real problem with TestObjectType I'm not of much help other than that. Hope you can figure it out, Viktor
#5
Thank you very much for your detailed help, I really appreciate it :-)
Though it doesn't work for me because I think that whenever I give my enemies a different object type, the OnRegister method of the DrillHeadKillComponent.cs sets it back to _enemyObjectType :
I solved my problem: I created additional properties in my DrillActorComponent class that I can check.
for example:
08/27/2008 (5:49 am)
Hey ViktorThank you very much for your detailed help, I really appreciate it :-)
Though it doesn't work for me because I think that whenever I give my enemies a different object type, the OnRegister method of the DrillHeadKillComponent.cs sets it back to _enemyObjectType :
// set the object type so that the player can collide with this trigger SceneObject.SetObjectType(PlatformerData.EnemyObjectType, true);
I solved my problem: I created additional properties in my DrillActorComponent class that I can check.
for example:
DrillActorComponent isZombieComponent = _actor.Components.FindComponent<DrillActorComponent>();
if (isZombieComponent.IsZombie)
{
// action
}
#6
08/27/2008 (4:00 pm)
Glad you got it working. Seems like you found a fairly painless workaround. I'm happy to be of any help, and I learned some new things too.
Torque Owner Viktor Rumanuk
if (ourObject.TestObjectType(_objectType) == true) { // Do your action or call your method here }Good Luck, Viktor