Crosshairs Question
Posted: Tue Sep 18, 2007 9:32 pm
Hey guys, novice programer here. I'm trying to make a set of crosshairs that will be able to moved around the screen. You know, like for targeting. I wrote the code, and it works, but it is jumpy. Please help me streamline it in whatever way possible.
Code: Select all
SCREEN 13
CLS
x = 40
y = 40
LINE (0, y)-(320, y), 2
LINE (x, 0)-(x, 200), 2
1
DO
IF INKEY$ = "s" THEN
10
LINE (0, y)-(320, y), 0
LINE (x, y)-(x, y + 1), 2
y = y + 1
LINE (0, y)-(320, y), 2
GOTO 1
END IF
IF INKEY$ = "w" THEN
20
LINE (0, y)-(320, y), 0
LINE (x, y)-(x, y - 1), 2
y = y - 1
LINE (0, y)-(320, y), 2
GOTO 1
END IF
IF INKEY$ = "d" THEN
30
LINE (x, 0)-(x, 200), 0
LINE (x, y)-(x + 1, y), 2
x = x + 1
LINE (x, 0)-(x, 200), 2
GOTO 1
END IF
4
IF INKEY$ = "a" THEN
LINE (x, 0)-(x, 200), 0
LINE (x, y)-(x - 1, y), 2
x = x - 1
LINE (x, 0)-(x, 200), 2
GOTO 1
END IF
q
LOOP UNTIL INKEY$ = "q"
END