These are all quite simple. Just make one routine ("getPlayerInput"), recording all input and putting them to vars. Then you can use player input anywhere in your program. For example, the input of 2nd, apha and 2 other keys are stored in one byte variable. The higher 4 bits are the pushed keys in this frame. And the lower 4 bits are the pushed keys in the previous frame. So, if key "2nd" is the 0th (prev frame) and 4th (this frame) bit, you check secondPressed (AND %00010000), secondHold (AND %00010001) and second Released (AND %00000001) very simply, and use them anywhere you like. Also in enemy AI routines of course.Kozak wrote:For my UOH (uniform object handler) I thought of a way to handle characters on screen. I had a general update loop which checked what input the character got:
- player input character, check for keypresses (so I could have 10+ character controlled chars)
- inverse player movement (same as player movement only inverse, also seen in zelda)
- follow player (move in direction of player)
By the way, some people make AI sound much more mysteriously then it actually is. Its just about making a piece of code for which determines for each monster the next action (for example xspeed, yspeed, particle throwing) by checking some input variables (player closeness or somethin') and you'll have very delicate AI for a ti83 game. You dont need any education to be able to write such a thing.