How would I?
by Esteban Martinez · in Torque Game Builder · 01/11/2007 (9:27 pm) · 5 replies
How would i go about attacking an enemy and dealing a certain amount of damage?
What i want to do:
Play an animation
Deal damage to enemy
Kill enemy after certain amount of damage
Gain experience
-----------------------
I only have a TGB indie liscence.
I would really like to learn torquescript more, could somebody point me in the right direction on how to start?
I have alot of complicated ideas for my game and i would really like to learn how to do it on my own so that i dont have to constantly bother people on the forum.
What i want to do:
Play an animation
Deal damage to enemy
Kill enemy after certain amount of damage
Gain experience
-----------------------
I only have a TGB indie liscence.
I would really like to learn torquescript more, could somebody point me in the right direction on how to start?
I have alot of complicated ideas for my game and i would really like to learn how to do it on my own so that i dont have to constantly bother people on the forum.
#2
01/12/2007 (10:16 am)
Take a look at the Shooter tutorial. Particularly with in the boss.cs file. The boss takes damage, eventually explodes and finally increments the score.
#3
01/12/2007 (11:03 am)
Do all the tutorials ;)
#4
Right now I am working on getting the strike animation the play correctly when I press enter (It only shows the first sprite in the animation). Then afterthat to properly set the bounding box(?) for the animation so that it will give the appearance of a sword strike.
No matter how hard it looks I will continue to work on my project.
01/12/2007 (3:06 pm)
Thanks for responding, I learned a little today and will continue.Right now I am working on getting the strike animation the play correctly when I press enter (It only shows the first sprite in the animation). Then afterthat to properly set the bounding box(?) for the animation so that it will give the appearance of a sword strike.
No matter how hard it looks I will continue to work on my project.
#5
How would you modify this part of the mini tut code in order to play that animation correctly.
1. Press A
2. Goes through function where attack = true.
3. setCurrent animation
I hope that was clear enough :S
01/20/2007 (11:04 am)
Ok, so i am stuck with animations. I used the mini platformer tutorial and i liked the way it played out, what i want to do though is add an attack animation when i press "a" i have the key bound and the function for it plays through but when i ask to play the actual animation it does nothing.How would you modify this part of the mini tut code in order to play that animation correctly.
1. Press A
2. Goes through function where attack = true.
3. setCurrent animation
function playerClass::setCurrentAnimation(%this)
{
%xVelocity = %this.getLinearVelocityX();
%yVelocity = %this.getLinearVelocityY();
if(%xVelocity > 0)
{
%this.setFlip(false, false);
$pGuy.behind = 0;
}
else if(%xVelocity < 0)
{
%this.setFlip(true, false);
$pGuy.behind = 1;
}
if(%this.airborne)
{
if(%yVelocity < 0)
{
%this.playAnimation(playerJumpUp);
}
else
{
%this.playAnimation(playerJumpDown);
}
}
else
{
if(%xVelocity == 0)
{
%this.playAnimation(playerStand);
}
else
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
}
}I hope that was clear enough :S
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
While it might sound like "only for RTS", it has mouse control in, lots of class based scripting and other usefull things.
For what you want it might be really well suited.