dim3 Forum

Full Version: alternating fists
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

KingAlfonso

hey how would i make it so for the first click one fist punches and for the second click the other fist punches?
Code:
var punchnum;

foo
foo
foo

punchnum=0;

foo
foo
foo

if (punchnum=0) {
punchnum=1;
obj.model.animation.start('punch1')
}
else {
punchnum=0;
obj.model.animation.start('punch2');
foo
foo
foo

Wink.

(you didn't geuss that???)
More like:

Code:
if ( subEvent==DIM3_EVENT_MESSAGE ) {
   if ( id==DIM3_ID_SHOOT_PUNCH_RIGHT ) {
      obj.model.animation.start("Punch1")
   }

   if ( id==DIM3_ID_SHOOT_PUNCH_LEFT ) {
      obj.model.animation.start("Punch2")
   }
}

I think that would be more accurate.


PS: Sry for spaces, they all-the-sudden started being stubborn.
Umm... no, why the hell would u be using messages in the fire function? I would also make punchnum=utility.random.getBoolean() at the beginning to make it start off with a random fist.
Because when you get the input from keys you use messages. For mouseclick just use firemethods. But you'll still want to probably be able to set them as keys...

But on the other hand, you don't necessarily need them. You could use fire methods for keys... yeah... Doesn't really matter.

Code:
var method=weap.fire.method;

switch (method) {

   case 1:

   case 0:

   case 3:
      obj.model.animation.start("Punch1")
      return;

   case 2:
      obj.model.animation.start("Punch2")
      return;

}
Just use a variable to alternate between 0 and 1 with 0 being punch animation right and 1 being punch animation left. Smile
I misread him sorry. I thought he meant (like in marathon) the primary trigger punches right and the secondary punches left. O.o No big deal, still useful code. Smile

PS: Alfonso, I suggest getting a number between 0 and 4, if it's 0, 1, or 2 have it punch right, and if it's 3 or 4 punch left. That way it punches right more. (most people are right-handed) Smile
Ah, but I take martial arts, and I happen to know that if you alternate you can get in 3 times more hits than if you use your right more.
Strange he didn't think of an alternating boolean variable. Smile
Yeah but who needs that when you can knock them out in one all-mighty right-handed punch?
Pages: 1 2
Reference URL's