Why does this fail to work?
Blitz3D Forums/Blitz3D Programming/Why does this fail to work?
| ||
hit the up arrow.Global foo:Int Repeat key(KEY_UP,foo,5) Print foo Until KeyDown(KEY_ESCAPE) Function key(keyconst,variable,amount) If KeyDown(keyconst) = 1 variable = variable + amount EndIf End Function |
| ||
where are you getting KEY_UP and KEY_ESCAPE from? if you aren't defining them, they will be set to 0. I put something in the code archives a while ago to help with this |
| ||
It's BlitzMax code, and he posted in the wrong forum... |
| ||
ahhh... so it is. in that case: Global foo:Int Graphics 640,480,0,0 Repeat Cls key(KEY_UP,foo,5) DrawText foo, 10,10 Flip Until KeyDown(KEY_ESCAPE) Function key(keyconst,variable Var,amount) If KeyDown(keyconst) = 1 variable = variable + amount EndIf End Function |