Nomad wrote: ↑Sat Mar 31, 2018 8:38 amEinar - just a quick question about Skier
Code: Select all
LET i=(INKEY$="7" AND c<30)-(INKEY$="6" AND c>1):
So I think that the value i is checking inkey$ is between 7 or 6 within the range 1-30 columns.
Not exactly.
In Sinclair BASIC, a condition evaluates to 1 if true, 0 if false.
Variable i is sideways increment. If key 7 (right) is pressed and player is before column 30, then (INKEY$="7" AND c<30) will evaluate to 1, therefore variable i will be 1. It will make column position increase by 1, moving to the right.
If key 6 (left) is pressed and player is after column 1, then (INKEY$="6" AND c>1) will evaluate to 1, therefore variable i will be -1. It will make column position decrease by 1, moving to the left.
Nomad wrote: ↑Sat Mar 31, 2018 8:38 amIf you needed to do up and down could extra inkey$ values be used or would a different section be needed?
You would need another variable for up/down increment, to update row instead of column.