I currently have it set up so pressing Z fires a regular shot. Holding down Z makes the charging animation visible. As a subevent, every 1 second if z is still pressed it increases the charge state by 1 and sets the charge animation to its corresponding level.
Both pressing Z and releasing Z resets the charge state to 0 and releasing Z fires off a regular attack if the charge level is not 3 and fires a charge shot if it is 3.
The problem is that just pressing Z shouldn't make the charging animation visible and add to the charge state, but pressing Z keeps making the charge animation visible and sometimes increases the charge state and sometimes brings it back to 0. It seems the code is conflicting. How do I resolve it so pressing Z fires a shot and only holding down Z starts showing the charging animation and increasing the charge state?