News:

Welcome to RetroCoders Community

Main Menu

color walker

Started by ron77, May 28, 2023, 06:43 PM

Previous topic - Next topic

ron77

#lang "qb"
x = 20
y = 20
c = 0

cls

do
    key$ = inkey$
    color c
    locate y,x,0  :' 0 turns cursor off
    print "@";

    if key$ = "w" then y=y-1
    if key$ = "a" then x=x-1
    if key$ = "d" then x=x+1
    if key$ = "s" then y=y+1
    if key$ = "c" then c=c+1
    if c > 16 then c = 0

loop until key$ = chr$(27)

CharlieJV

I find this really intriguing for some strange reason.

I think because I dig the simplicity of it.

ron77

hi aurel

compile and run the code and press key "c" to change color of the "@" then move it by pressing keys "w" "s" "a" "d" you can change the color again and again by pressing key "c"

hopes this helps

ron77

don't know what to say aurel i don't know why it doesn't work on your computer

however, it does work on mine. Here is a screen capture:

You cannot view this attachment.

CharlieJV

Quote from: aurel on May 28, 2023, 09:09 PMno is not
program simply stuck in memory doing nothing

Read the code.  The lowercase "c" alters the color of the "brush".

The color of the brush starts with the color 0, which is black.

You won't see anything until you change the color.


CharlieJV

Quote from: ron77 on May 28, 2023, 06:43 PM
#lang "qb"
x = 20
y = 20
c = 0

cls

do
    key$ = inkey$
    color c
    locate y,x,0  :' 0 turns cursor off
    print "@";

    if key$ = "w" then y=y-1
    if key$ = "a" then x=x-1
    if key$ = "d" then x=x+1
    if key$ = "s" then y=y+1
    if key$ = "c" then c=c+1
    if c > 16 then c = 0

loop until key$ = chr$(27)


fyi, your code works in BAM as is, no fiddling necessary. 

ZXDunny

Very nice!



Lovely little demo :)