How do i have one action delay another

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?

Yes, I think so @grazer

Use mailboxes and switches probably. And maybe toggles.