I want to add some key functionality to my program, it works fine for arrow keys but not for other keys
if(keyPressed && keyCode ==37){
flyingx += 0.1;
}
if(keyPressed && keyCode ==39){
flyingx -= 0.1;
}
if(keyPressed && keyCode == 87){
ztoggle ++;
ztoggle2 = 0;
if(ztoggle==2){
ztoggle = 0;
}}
it works if I remove keyPressed, but then the toggle function stops working.