Thanks you guys! I got it working!

I added the && Key.isDown(Key.ENTER) like you said, but it still didn't work. So I also added:

if (air == false && Key.isDown(Key.ENTER)){
state = 5;}

if (air == false && !Key.isDown(Key.ENTER)){
state = 1;}

And that got it all working! So thanks for all your help!

>___> but I have another question if you don't mind.

Now that his attack works, I wanna make it able to actually hurt enemies. However, I can only seem to find tutorials for attacks with guns and lasers. Is the code generally the same for Melee attacking? If not, could you point me to a good tutorial for it?

I appreciate it.