Weird title, I know.
Here's my dilemma:
Building a fighting game prototype, trying to streamline the handling of inputs. I'm translating device commands so that it'll be easier to handle multiple types of input (Keyboard, Gamepad, Touch if I so will it.)
The problem I've run into is that I'm forced to use a lot of nesting to get it to work as it should. I've included the CAPX , so you can see my work so far. The eventsheet with the offending events is in the Control sheet, under Layer 1: Raw Input Keyboard.
The logic behind what I'm doing is that if you press a key, as long as you aren't pressing an opposing key, it will alter the value to it's correct state. If you're familiar with the Number notation used in the fighting game community, it's like that. (Explanation: Look at your number pad. 2, 4, 6, and 8 correspond to a cardinal direction and 1, 3, 7, and 9 are diagonals. 5 is neutral.)
The way I wanted to do it is if you're pressing left or right, the value is set to 4 or 6. Then if you press up or down, it will either add 3 or subtract 3 from the value, while it's held. Thus, if you're holding right (6) and holding up ( X +3 ) you'll get 9, which is up-right. And if you're just holding up, it should be Neutral (5) + Up (X+3) and equal 8, which is just Up. If you let go of Up, it should return to it's value pre-Up, which would be 4, 5, or 6 respectively.
Needless to say, that didn't quite work out right. So I ended up making complicated nesting to get it just as it's supposed to work, and just set values instead.
It looks ugly as sin to me, and I'm asking if there's a cleaner way of doing it. Trying to keep the number of events to a minimum. I teach a class of 11 year olds development with Construct2 for my summer job, and I want to keep it under 100 events so that they can take it home and mess with it in the free version.