For example i want to have it so that if you opponent is attacking you can attack but after he is done you can attack again (To attack you would hit z)
http://www.flowlab.io/game/play/122389
Are you saying you want it to be turn based?
Use mailboxes and switches probably. And maybe toggles.