- Code: Select all
punching = 1; // this sets punching equal to 1, because there is only one =
punching==1; // this does not set punching to 1, it checks if it is equal to 1, because there are two =
== is used to compare values, so it doesn't change them, while = is used to change variables.
Which means you aren't actually setting punching to 1 in your keydown z event. You need to change the first line to this instead.
- Code: Select all
punching=1;