Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Alex

Hello,

Trying to make this work:

if( ig.input.pressed('up') && ig.input.pressed('shoot') ) { ... }

so that player would shoot up. It doesn't, suggestions?

1 decade ago by Hareesun

I'd have something like this... Might need some tweaking, but that's the idea.
if( ig.input.pressed('up') && !this.upPressed ) {
  this.upPressed = true;
}

if( ig.input.pressed('shoot') && this.upPressed ) {
  // SHOOT UPWARDS
}

OR (because it's checking UP is being held and SHOOT is pressed)
if( ig.input.state('up') && ig.input.pressed('shoot') ) { 
  // SHOOT UPWARDS
}

1 decade ago by Alex

Both of them work, thanks a lot!

p.s. - u'r missing "ig.input." before state in your 2nd example. just saying for people who'll have an error and don't know why :) cheers!

1 decade ago by Hareesun

:P Fixed.
Page 1 of 1
« first « previous next › last »