Here is a cute one from Ron77 I fixed up a little:
It's like a color Etch-A-Sketch:
BTW unlike Ron's if you try to go out of bounds of the screen, you are going to hear about it. Beep can be loud enough to make you jump out of your seat if you have volume up, so now consider yourself warned
Code: (Select All)
_Title "Mod Ron77 Color Walker, arrows to move, c to cycle color change" 'b+ 2023-05-28
' kinda cute! nice one Ron77
' Notice I put the instructions to the app in the _Title
' We will be using the default Screen 0, Shout out to Pete! :)
' This uses 16 colors 0 to 15
' We will be using _KeyHit for user input because it's real easy to get
' the arrow key numbers in IDE. Just put cursor where you need the number
' Select Tools > Insert Quick Keycode (or shortcut Ctrl+K)
' then press the direction arrow key, BAM! there's your number!
' Notice at Locate under update screen comment, its y, x.
' That's because Locate does Row, Column not x, y like all graphics commands
' eg Pset (x,y), Color
' Row Column are how Print Locations work with Row (Vertical) listed first
' followed by the Column (Horizontal) position.
' That use to mix the hell up in me back with GW BASIC years ago.
DefLng A-Z ' all variables are long unless otherwise spec'd
x = 20
y = 20
c = 12
Color c ' Ron77 started the color at 0 and ha! Aurel is complaining nothing
' is happening, nice joke on Aurel Ron :)
'
Do
'update screen
Locate y, x: Print "@";
kh = _KeyHit ' see if user hit a key and if so which?
If kh = 18432 Then ' arrow up
If y - 1 > 0 Then y = y - 1 Else Beep
End If
If kh = 19200 Then ' arrow left
If x - 1 > 0 Then x = x - 1 Else Beep
End If
If kh = 19712 Then ' arrow right
If x + 1 <= _Width Then x = x + 1 Else Beep
End If
If kh = 20480 Then ' arrow down
If y + 1 <= _Height Then y = y + 1 Else Beep
End If
'I did color changes different than Ron, I only updated color after color change
'and I never set the color at 0 the black background, so maybe Aurel will enjoy
'my version better ;-))
If kh = 99 Then ' key c is for color change
c = c + 1
If c > 15 Then c = 1 ' if c exceeds 15 the last color at top range set it to 1, not 0
Color c
Locate y, x: Print "@"; ' update our @ guy immediately with color change so Aurel knows
End If
Loop Until kh = 27 ' standard escape clause that johnno always insisted on
It's like a color Etch-A-Sketch:
BTW unlike Ron's if you try to go out of bounds of the screen, you are going to hear about it. Beep can be loud enough to make you jump out of your seat if you have volume up, so now consider yourself warned
b = b + ...