VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



etch-a-sketch

by Ben Pearson (1 Submission)
Category: Games
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Tue 4th March 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)

etch-a-sketch

Rate etch-a-sketch



LET x = 10
LET y = 10
CALL menu
!***********************
SUB menu
    PRINT "1. play"
    PRINT "2. quit"
    INPUT menu
    IF menu = 2 then
       PRINT "thanks for stopping by"
       STOP
    ELSE IF menu = 1 then
       CALL game
    END IF
    CLEAR
END SUB
!**********************
SUB game
    CLEAR
    PRINT "would you like to"
    PRINT "1. view instructions"
    PRINT "2. sketch stuff"
    INPUT choice
    IF choice = 1 then
       CALL instructions
       CLEAR

    ELSE IF choice = 2 then
       CLEAR
       CALL draw
       CLEAR
    END IF
    CLEAR
END SUB
!***************************
CALL draw
SUB draw
    DO

       GET KEY a
       SELECT CASE a
       CASE 304
            PLOT x,y;x-10,y
            LET x = x-10
       CASE 303

            PLOT x,y;x+10,y
            LET x = x+10
       CASE 301

            PLOT x,y;x,y+10
            LET y = y+10
       CASE 302

            PLOT x,y;x,y-10
            LET y = y-10

       CASE 114
            SET COLOR 4
       CASE 98
            SET COLOR 1
       CASE 103
            SET COLOR 2
       CASE 32
            SET COLOR 0
       CASE 8
            SET COLOR 15
       CASE 27
            CLEAR
       CASE 115
            LET s = int(rnd*14)+1
            SET COLOR s
       CASE 102
            FLOOD x+1,y
       CASE 109
            CLEAR
            CALL menu
       CASE 113
            CALL mouse
       CASE else
            STOP
       END SELECT
    LOOP

END SUB
!********************
SUB instructions
    PRINT "left button=left"
    PRINT "right button=right"
    PRINT "up button= up"
    PRINT "down button=down"
    PRINT ""
    PRINT ""

    PRINT "r= red"
    PRINT "b=blue"
    PRINT "g=green"
    PRINT "space = black"
    PRINT "f=flood to the right of the line"
    PRINT "q puts into flood mode- click to flood and press t to go back to drawing"
    PRINT "m=menu"
    PRINT ""
    PRINT "escape = clear all"
    PRINT ""
    PRINT "to erase a line hit back space then backspace,"
    PRINT "backspace makes the color white."
    PRINT ""
    PRINT ""
    CALL menu
END SUB
!********************
SUB mouse
    DO
       GET MOUSE u,i,s
       IF s = 2 then
          FLOOD u,i
          CALL draw
       END IF
    LOOP
END SUB
!****************
END



Download this snippet    Add to My Saved Code

etch-a-sketch Comments

No comments have been posted about etch-a-sketch. Why not be the first to post a comment about etch-a-sketch.

Post your comment

Subject:
Message:
0/1000 characters