I've been putting more and more stuff in to an update loop, and its got to the point where its hard for the program to pick up a key input.
My update looks like this, in which I'm updating game states in between updating drawing guages and calling kc=peek(197) to look for key input, hoping enough calls to peek(197) will catch an input. i've even put more in some of the BG updates to try and catch the input.
there's probably a better way of doing this but i cant seem to find a call for looking for the "latest" key input instead? any ideas?
Code: Select all
1050 rem update loop
1055 sys(4609):rem draw guages
1058 nb$=n$: rem notification buffer
1060 kb=peek(197): rem buffer current input state
1065 gosub 1125:sys(4609): kc = peek(197): rem buffer vitals = power/water/food/habitat
1070 gosub 2500:sys(4609) : kc = peek(197): rem process changes
1080 kc = peek(197): gosub 2600: kc = peek(197): rem check for input, BG tasks, input check
1081 gosub 1110:kc = peek(197): rem update vital graph if changed
1083 gosub 1090
1084 if n$<>nb$ then gosub 1130
1085 gosub 1090
1086 goto 1050
1090 if kb<>kc then POKE36878,15: POKE36876,230: POKE36876,0: gosub 2260: rem key was pressed, goto input
1100 return