Cool Tip for doing Color Walker from Paul Dunn AKA ZXDunny: https://retrocoders.phatcode.net/index.php?topic=584.0
not exactly Beginner's stuff
In Paul Dunn's Horizontal coding style we get:
Breaking it down:
not exactly Beginner's stuff
In Paul Dunn's Horizontal coding style we get:
Code: (Select All)
_Title "Mod 3 Ron77 Color Walker: a | d left or right, w | s for up or down, c for color change"
x = 10: y = 10: c = 1
1 K$ = InKey$: c = (c - (K$ = "c")) Mod 16: Color c: x = x + (K$ = "a") - (K$ = "d"): y = y + (K$ = "w") - (K$ = "s"): Locate y, x: Print "@";: GoTo 1
Breaking it down:
Code: (Select All)
'_Title "Mod 3 Ron77 Color Walker: a|d left or right, w|s for up or down, c for color change"
'x = 10: y = 10: c = 1
'1 K$ = InKey$: c = (c - (K$ = "c")) Mod 16: Color c: x = x + (K$ = "a") - (K$ = "d"): y = y + (K$ = "w") - (K$ = "s"): Locate y, x: Print "@";: GoTo 1
' b+ 2023-05-30 Breaking the above down:
' the Title contains the instructions for keypresses
_Title "Mod 3 Ron77 Color Walker: a | d left or right, w | s for up or down, c for color change"
x = 10: y = 10: c = 1 'make assignments inside screen for x and y position of future @ printing
1 K$ = InKey$ ' this records keypress into K$
c = (c - (K$ = "c")) Mod 16
' first (K$ = c) evaluates to -1 or 0 depending if c key was pressed
' (c - (K$ = "c")) evaluates to c - 0 or c - -1 equivalent to adding 0 0r 1 to c
' Mod 16 keeps c from exceeding 15 by resetting back to 0 when it hits 16
' The Mod 16 trick is very handy in computer programming, used allot!
Color c ' colors 0 - 15, 0 = black (same as background color so might be invisible)
' having black is handy for fixing mistakes
' As with changing c, likewise x and y are changed
x = x + (K$ = "a") - (K$ = "d")
' if a or d is pressed x gets changed by -1 or +1
y = y + (K$ = "w") - (K$ = "s")
' if w or s is pressed y gets changed by -1 or +1
Locate y, x
' note: since there is no border checking Locate will get mad and bug out should you go beyond
' the screen coodinates. We are going for brevity of code here. Stay away from edges or Error!
Print "@"; ' update our @ characters position (if you can see it)
GoTo 1 ' this loops back to line labeled 1
b = b + ...