At 5/16/08 12:04 PM, Matt-Porter wrote:
As for your code, care to elaborate on it?
as far as I can analyze,
you wanted to make allowedToToggle=true whenever:
1. the arrow keys are not down
2. voidDeath is false
3. movespeed is 0
right?
areKeysUp=true;
this is a boolean to tell if the keys are up (not down)
for(i=37; i<41; i++){ if(Key.isDown(i)){ areKeysUp=false; } }
this loops and checks if the arrow keys are down,
if any one of them is down, make areKeysUp=false
note that I looped from 37 to 40 which are the key codes for arrow keys
allowedToToggle = (!voidDeath) && (moveSpeed==0) && areKeysUp;
then we know that logical operators generate a boolean result
so just && them all and if any one is false, allowedToToggle=false
if all is true, allowedToToggle=true