USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 2 pages long. [ 1 | 2 ]
[ Profile | Posts | Contact ]
Posted at: 2/6/09 02:28 PM
Sign-Up: 05/14/06
Posts: 72
if (Key.isDown(68) and Key.isDown(65)) { this._x +=0; }else if (Key.isDown(68)){ this._x+=(walkspeed); }else if (Key.isDown(65)){ this._x-=(walkspeed); } is the sort of code you want
the power pad (my site)
Posted at: 2/6/09 05:10 PM
Sign-Up: 07/28/07
Posts: 3,778
At 2/6/09 02:08 PM, TheSongSalad wrote: you could just say if(key.IsDown(00) { if(key.IsDown(00){ } } just put two conditions in, and just put what you want to happen after the second one. just be sure to end both of them
Like what people said earlier, there is no need to put two if conditions.
The Fallout 3 Fan Club. Join Today! Voice Acting TUTORIAL! Click My Sig Below If You Need A Voice Actor! Oh And I Love Pancakes. ROOOOOOOOOAAAAAAAAARRRRRRRRRRR!!!
Posted at: 2/6/09 05:12 PM
At 2/6/09 02:28 PM, Powergames wrote: if (Key.isDown(68) and Key.isDown(65)) { this._x +=0; }else if (Key.isDown(68)){ this._x+=(walkspeed); }else if (Key.isDown(65)){ this._x-=(walkspeed); } is the sort of code you want
I actually tried that out at first... it didnt end up working due to the fact I have other coding that tells everything to move. I will just need to mess around with my engine becaus eI think thats what is changing my other movement code. Although, I am able to use it to make my charecter stop when he is frozen. *attacked by a snowman*
Posted at: 2/6/09 06:28 PM
Hmm... after tons of tests, I realized that for some VERY strange reason... the coding is canceled when BOTH keys are pressed when using this coding.
onClipEvent(enterFrame) { if (Key.isDown(65)) { this._x += 3; } if (Key.isDown(68)) { this._x -= 3; } }
What the hell? well whatever this DOES work. I am going to apply some coding that fixes a quick glitch then all the glitches will be finished! YAAAYYY
Posted at: 2/6/09 06:30 PM
Oh I know why!!! Its because when pressing A it goes to the left by 3... and to the right by 3 when pressing D. If you press them both, the movie clip doesnt know where to go and just sets there.
BRILLIANT...
But this doesn't actually make something only happen when two keys are pressed.. it just stops something from moving when two keys are pressed.
All times are Eastern Standard Time (GMT -5) | Current Time: 10:25 AM
<< Back