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 Mike

Well, as the title says. Whenever I try and bind a letter key (W,A,S,D) for example, it will not work.

If I change it to arrow keys, I can move just fine. But if I switch it to any letter keys, it won't work. (Same goes for every other action, that isn't moving).

ig.input.bind( ig.KEY.LEFT_ARROW, 'left' );
ig.input.bind( ig.KEY.RIGHT_ARROW, 'right' );

Works

ig.input.bind( ig.KEY.A, 'left' );
g.input.bind( ig.KEY.D, 'right' );

Doesn't Work

if( ig.input.state('left') ) {
                    this.vel.x = -this.speed;
                    this.flip = true;
                }else if( ig.input.state('right') ) {
                    this.vel.x = +this.speed;
                    this.flip = false;
                }else{
                    this.vel.x = 0;
                }

1 decade ago by Mike

Note that the # aren't in there, thought that was how to post in a code format >.>

1 decade ago by MartinGr

You are missing "i" in front of ig at binding key D to right. Should be

ig.input.bind( ig.KEY.A, 'left' );
ig.input.bind( ig.KEY.D, 'right' );

1 decade ago by dominic

Do you use any browser plugins that would prevent the letter keys from working? Does this happen in all browsers?

To post code, the ## ## markers have to be on a separate line. I edited your original post; I hope you don't mind :)
Page 1 of 1
« first « previous next › last »