Skip to main content
added 2 characters in body
Source Link
Kwauhn
  • 102
  • 8

I figured it out myself, here's the code:

public class Input{
    private static boolean escDownOnLast;
    private static boolean escToggled;
    
    public static boolean rainbowOnisToggledOn(){
        if(Keyboard.isKeyDown(Keyboard.KEY_R)){
            escDownOnLast = true;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && !escToggled){
            escDownOnLast = false;
            escToggled = true;
            return escToggled;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && escToggled){
            escDownOnLast = false;
            escToggled = false;
            return escToggled;
        }
        return escToggled;
    }
}

I figured it out myself, here's the code:

public class Input{
    private static boolean escDownOnLast;
    private static boolean escToggled;
    
    public static boolean rainbowOn(){
        if(Keyboard.isKeyDown(Keyboard.KEY_R)){
            escDownOnLast = true;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && !escToggled){
            escDownOnLast = false;
            escToggled = true;
            return escToggled;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && escToggled){
            escDownOnLast = false;
            escToggled = false;
            return escToggled;
        }
        return escToggled;
    }
}

I figured it out myself, here's the code:

public class Input{
    private static boolean escDownOnLast;
    private static boolean escToggled;
    
    public static boolean isToggledOn(){
        if(Keyboard.isKeyDown(Keyboard.KEY_R)){
            escDownOnLast = true;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && !escToggled){
            escDownOnLast = false;
            escToggled = true;
            return escToggled;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && escToggled){
            escDownOnLast = false;
            escToggled = false;
            return escToggled;
        }
        return escToggled;
    }
}
Source Link
Kwauhn
  • 102
  • 8

I figured it out myself, here's the code:

public class Input{
    private static boolean escDownOnLast;
    private static boolean escToggled;
    
    public static boolean rainbowOn(){
        if(Keyboard.isKeyDown(Keyboard.KEY_R)){
            escDownOnLast = true;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && !escToggled){
            escDownOnLast = false;
            escToggled = true;
            return escToggled;
        }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && escToggled){
            escDownOnLast = false;
            escToggled = false;
            return escToggled;
        }
        return escToggled;
    }
}