Wait after pressing button

how can i make it like mega man 2 ?
i mean run & shoot and wait 0.5sec and back to run
i cant explain well so the summureise is i want to fix this code