Forum Topic: key pressing problems...

(245 views • 5 replies)

This topic is 1 page long.

<< < > >>
None

ProphetofHAM

Reply To Post Reply & Quote

Posted at: 11/6/05 10:15 PM

ProphetofHAM NEUTRAL LEVEL 12

Sign-Up: 04/10/01

Posts: 70

I'm having some problems with a game i'm working on detecting key strokes.

this is my code so far

if(Key.isDown(Key.SPACE) and this.del<=0 and this.stat==1) {pickup()};
if(Key.isDown(Key.SPACE) and this.del<=0 and this.stat==2) {throwdot()};
if(Key.isDown(Key.LEFT)) {this.xmove-=this.speed};
if(Key.isDown(Key.RIGHT)) {this.xmove+=this.speed};
if(Key.isDown(Key.UP)) {this.ymove-=this.speed};
if(Key.isDown(Key.DOWN)) {this.ymove+=this.speed};

Arrow keys move the character around, and space picks stuff up, if you are already carrying something space will throw it.

everything works fine, unless you try to press three keys at once.

if you are carying something and moving diagonally it won't respond to pressing space, unless you are moving up and right, then it works fine.

anyone know how i can fix this? maybe there is a better command than isDown? i'm using Flash 5.


None

ProphetofHAM

Reply To Post Reply & Quote

Posted at: 11/7/05 12:09 AM

ProphetofHAM NEUTRAL LEVEL 12

Sign-Up: 04/10/01

Posts: 70

no one has any suggestions?

I'm baffled as to why it works fine when pressing up and right then hitting space, but it won't work when going any other two directions...


None

<deleted>

Reply To Post Reply & Quote

Posted at: 11/7/05 11:14 AM

I'm not sure but maybe it's because your codes refere to AS 2.0 while Flash 5 only supports AS 1.0


None

ProphetofHAM

Reply To Post Reply & Quote

Posted at: 11/7/05 08:47 PM

ProphetofHAM NEUTRAL LEVEL 12

Sign-Up: 04/10/01

Posts: 70

Everything there is supported by flash 5. it works exactly like it should if you are moving up and right and press space, but if you are moving any other diagonal direction pressing space does nothing.


None

ProphetofHAM

Reply To Post Reply & Quote

Posted at: 11/7/05 10:00 PM

ProphetofHAM NEUTRAL LEVEL 12

Sign-Up: 04/10/01

Posts: 70

ok, it turns out the code is fine. ied it on another computer and it works like it should. so what's wrong with my computer? is there some setting that is causing this problem, or do i just have a shitty keyboard?


None

gorman2001

Reply To Post Reply & Quote

Posted at: 11/7/05 10:08 PM

gorman2001 NEUTRAL LEVEL 14

Sign-Up: 08/18/02

Posts: 1,879

i think u mean this:

if(Key.isDown(Key.SPACE) && this.del<=0) {
if(this.stat==1){
pickup()
}else if(this.stat==2){;
throwdot()
}
};
if(Key.isDown(Key.LEFT)) {
this._x-=this.speed
};
if(Key.isDown(Key.RIGHT)) {
this._x+=this.speed
};
if(Key.isDown(Key.UP)) {
this._y-=this.speed
};
if(Key.isDown(Key.DOWN)) {
this._+=this.speed
};


All times are Eastern Standard Time (GMT -5) | Current Time: 11:54 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!