Author Topic: Holy shit, QBASIC for the 13-year-old-boy-in-me win.  (Read 980 times)

0 Members and 1 Guest are viewing this topic.

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« on: November 02, 2008, 10:07:11 PM »
OK, so I *just* found out about FreeBasic today, and I've been using it to compile some of my really old QBASIC programs.

I'm now going to post a few EXEs as welll as their source. I guarantee you WILL shudder at the spaghetti code and vague variable names i came up with as a 13 year old boy.

Blast from the past incoming!
8=D

Greatness Gone

  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #1 on: November 02, 2008, 10:08:54 PM »
I got a little too excited reading the title for the thread. I expected you to have captured a 13 year old boy or something.

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #2 on: November 02, 2008, 10:09:25 PM »
I'm pretty sure this was my first full-fledged program. It was a really simple turn-based battle simulator. You're able to set your own HP and then choose your enemy. From there, the battle begins!

RPG.BAS:
Code: [Select]
ospllft = 2
omaglft = 3
maglft = 3
spllft = 2

startprog:
CLS
INPUT "Enter your HP: ", hp

IF hp > 999 THEN
CLS : PRINT "Please Enter a HP between 1 and 999"
DO UNTIL INKEY$ <> ""
LOOP
GOTO startprog
ELSEIF hp < 1 THEN
CLS : PRINT "Please Enter a HP between 1 and 999"
DO UNTIL INKEY$ <> ""
LOOP
GOTO startprog
END IF

CLS
oc:  PRINT "Select your opponent"
PRINT "   Name:       HP:"
PRINT "1) Julian      250"
PRINT "2) Belger      400"
PRINT "3) Faust       725"
PRINT "4) Septimis    999"
PRINT "5) Random Select"
PRINT
PRINT "Type the number of the opponent you wish to fight."
INPUT "what have you chosen? ", z

SELECT CASE z

CASE 1
c1: INPUT "are you sure [y/n]? ", yn$
IF yn$ = "y" THEN
op1$ = "Julian"
hp2 = 250
GOTO fight
ELSEIF yn$ = "n" THEN
CLS
GOTO oc
ELSE
PRINT "please choose again"
GOTO c1
END IF

CASE 2
c2: INPUT "are you sure [y/n]? ", yn$
IF yn$ = "y" THEN
op1$ = "Belgar"
hp2 = 400
GOTO fight
ELSEIF yn$ = "n" THEN
CLS
GOTO oc
ELSE
PRINT "please choose again"
GOTO c2
END IF

CASE 3
c3: INPUT "are you sure [y/n]? ", yn$
IF yn$ = "y" THEN
op1$ = "Faust"
hp2 = 725
GOTO fight
ELSEIF yn$ = "n" THEN
CLS
GOTO oc
ELSE
PRINT "please choose again"
GOTO c3
END IF

CASE 4
c4: INPUT "are you sure [y/n]? ", yn$
IF yn$ = "y" THEN
op1$ = "Septimis"
hp2 = 999
GOTO fight
ELSEIF yn$ = "n" THEN
CLS
GOTO oc
ELSE
PRINT "please choose again"
GOTO c4
END IF

CASE 5
c5: INPUT "are you sure you want to Randomly choose [y/n]? ", yn$
IF yn$ = "y" THEN
GOTO Rop
ELSEIF yn$ = "Y" THEN
GOTO Rop
ELSEIF yn$ = "n" THEN
CLS
GOTO oc
ELSEIF yn$ = "N" THEN
CLS
GOTO oc
ELSE
PRINT "please choose again"
GOTO c5
END IF

CASE ELSE
CLS
PRINT "Please choose a valid name."
GOTO oc
END SELECT







Rop:
RANDOMIZE TIMER
q% = INT(RND * 4) + 1
e% = INT(RND * 10)
IF q% = 1 THEN
op1$ = "Julian"
hp2 = 200
PRINT
PRINT "Your opponent is "; op1$
GOTO fight
ELSEIF q% = 2 THEN
op1$ = "Belgar"
hp2 = 350
PRINT
PRINT "Your opponent is "; op1$
GOTO fight
ELSEIF q% = 3 THEN
op1$ = "Faust"
hp2 = 675
PRINT
PRINT "Your opponent is "; op1$
GOTO fight
ELSEIF q% = 4 THEN
op1$ = "Septimis"
hp2 = 900
PRINT
PRINT "Your opponent is "; op1$
GOTO fight
END IF





fight:

INPUT "Now pick either 1 or 2 to see who goes first: ", n1



number: IF n1 = 1 THEN
GOTO dr
ELSEIF n1 = 2 THEN
GOTO dr
ELSE
PRINT "Please select either 1 or 2."
INPUT n1
GOTO number
END IF



dr: RANDOMIZE TIMER
f% = INT(RND * 2) + 1
e% = INT(RND * 2) + 1

IF f% = n1 THEN
CLS
PRINT "you win! you go get to go first."
DO UNTIL INKEY$ <> ""
LOOP
GOTO mm
ELSE
CLS
PRINT "you lost. The opponent goes first."
DO UNTIL INKEY$ <> ""
LOOP
GOTO om
END IF

mm:
CLS
PRINT
PRINT "Your attack choices:"
PRINT "1) Normal Attack"
PRINT "2) Magic Attack"
PRINT "3) Special Attack"
PRINT "4) Final Attack"
INPUT "Please only enter the number of the attack: ", a$

SELECT CASE a$
CASE "1"
RANDOMIZE TIMER
a% = INT(RND * 50)
e% = INT(RND * 1)
hp2 = hp2 - a%
IF hp2 > 0 THEN
CLS
PRINT
PRINT "You did a normal attack! You took "
PRINT a%; "HP off of "; op1$; "'s total HP. "
PRINT op1$; "'s total HP is now"; hp2; "."
DO UNTIL INKEY$ <> ""
LOOP
ELSE
CLS
LOCATE 1, 1
CLS
PRINT "You defeated "; op1$
END
END IF

CASE "2"
RANDOMIZE TIMER
a% = INT(RND * 75)
e% = INT(RND * 1)
maglft = maglft - 1
IF maglft < 0 THEN
GOTO nomoreatk
ELSE
END IF
hp2 = hp2 - a%
IF hp2 > 0 THEN
CLS
PRINT
PRINT "You did a magic attack! You took "
PRINT a%; "HP off of "; op1$; "'s total HP. "
PRINT op1$; "'s total HP is now"; hp2; "."
DO UNTIL INKEY$ <> ""
LOOP
ELSE
CLS
LOCATE 1, 1
CLS
PRINT "You defeated "; op1$
END
END IF

CASE "3"
RANDOMIZE TIMER
a% = INT(RND * 100)
e% = INT(RND * 1)
spllft = spllft - 1
IF spllft < 0 THEN
GOTO nomoreatk
ELSE
END IF
hp2 = hp2 - a%
IF hp2 > 0 THEN
CLS
PRINT
PRINT "You did a special attack! You took "
PRINT a%; "HP off of "; op1$; "'s total HP. "
PRINT op1$; "'s total HP is now"; hp2; "."
DO UNTIL INKEY$ <> ""
LOOP
ELSE
CLS
LOCATE 1, 1
CLS
PRINT "You defeated "; op1$
END
END IF

CASE "4"
RANDOMIZE TIMER
a% = INT(RND * 400) + 50
e% = INT(RND * 1)
hp2 = hp2 - a%
IF hp2 > 0 THEN
CLS
PRINT
PRINT "You did your final attack! You took "
PRINT a%; "HP off of "; op1$; "'s total HP. "
PRINT op1$; "'s total HP is now"; hp2; "."
PRINT
COLOR 4
PRINT "You were not powerful enough to defeat your opponent."
PRINT "You have lost."
END
ELSE
CLS
LOCATE 1, 1
CLS
PRINT "You defeated "; op1$
END
END IF

CASE ELSE
CLS
GOTO mm
END SELECT

om:
RANDOMIZE TIMER
z% = INT(RND * 3) + 1
e% = INT(RND * 1)

IF z% = 1 THEN
GOTO omn
ELSEIF z% = 2 THEN
GOTO omm
ELSE
GOTO oms
END IF


omn:
RANDOMIZE TIMER
x% = INT(RND * 50)
e% = INT(RND * 1)
hp = hp - x%

IF hp > 0 THEN
CLS
PRINT
PRINT op1$; " did a normal attack. He reduced your HP by"; x%; "."
PRINT "Your total HP is"; hp; "."
DO UNTIL INKEY$ <> ""
LOOP
ELSEIF hp < 1 THEN
CLS
COLOR 4
PRINT "You have died."
END
END IF
WHILE hp > 0
GOTO mm
WEND

omm:
RANDOMIZE TIMER
x% = INT(RND * 75)
e% = INT(RND * 1)
hp = hp - x%
omaglft = omaglft - 1
IF omaglft < 0 THEN
GOTO om
ELSE
END IF

IF hp > 0 THEN
CLS
PRINT
PRINT op1$; " did a magic attack. He reduced your HP by"; x%; "."
PRINT "Your total HP is"; hp; "."
DO UNTIL INKEY$ <> ""
LOOP
ELSEIF hp < 1 THEN
CLS
COLOR 4
PRINT "You have died."
END
END IF
WHILE hp > 0
GOTO mm
WEND

oms:
RANDOMIZE TIMER
x% = INT(RND * 100)
e% = INT(RND * 1)
ospllft = ospllft - 1
IF ospllft < 0 THEN
GOTO om
ELSE
END IF
hp = hp - x%
IF hp > 0 THEN
CLS
PRINT
PRINT op1$; " did a special attack. He reduced your HP by"; x%; "."
PRINT "Your total HP is"; hp; "."
DO UNTIL INKEY$ <> ""
LOOP
ELSEIF hp < 1 THEN
CLS
COLOR 4
PRINT "You have died."
END
END IF
WHILE hp > 0
GOTO mm
WEND

nomoreatk:
CLS
PRINT "You have used the maximum number of this attack."
DO UNTIL INKEY$ <> ""
LOOP
GOTO mm

Here it is, compiled to EXE:
http://www.mediafire.com/?sharekey=7114d29ba17f48e5d2db6fb9a8902bda
8=D

Madrun Badrun

  • twin-anused mascot
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #3 on: November 02, 2008, 10:12:13 PM »
 :lol

Amazing game.  I typed 700, 1, y, and got the reply that I lost.   :lol

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #4 on: November 02, 2008, 10:17:44 PM »
I think it probably just told you that you lost and the opponent would attack first
8=D

Madrun Badrun

  • twin-anused mascot
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #5 on: November 02, 2008, 10:21:58 PM »
pawned by 13 yearold Ecro


though now when I tried to do my final attack it just killed command prompt. 

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #6 on: November 02, 2008, 10:23:25 PM »
Here's one from a bit further into my QBASIC programming.

It's a BREAKOUT clone. Not incredibly good, but it certainly works!
BREAKOUT.BAS:
Code: [Select]
DIM Row1x(10), Row1y(10), Row2x(10), Row2y(10), Row3x(10), Row3y(10), Row4x(10), Row4y(10)
DIM Row1hit(10), Row2hit(10), Row3hit(10), Row4hit(10)
SCREEN 12

LINE (0, 0)-(640, 480), 0, BF ' Clears the background

RANDOMIZE TIMER             '
Ballx = INT(RND * 600) + 10  ' Randomizes the X location and angle
xAng = INT(RND * 2)           '

BallyAng = 1 ' Sets the Y angle
Bally = 165 'Sets ball location on Y axis
Padx = 280 'Sets Pad Location on X axis
Pady = 420 ' Sets Pad location on Y axis

IF xAng = 0 THEN '
BallxAng = -1    'This decides if the ball will move left or
ELSE             'right based on the randomized xAng value.
BallxAng = 1     '
END IF           '

x = 10 'Sets the initial X value for the blocks


FOR i = 1 TO 10  'Begis a FOR loop for the X and Y values of the blocks

 Row1x(i) = x 'Sets the X value of the blocks.
 Row2x(i) = x 'this changes with each block, so
 Row3x(i) = x 'it goes by a changing X value
 Row4x(i) = x '

  Row1y(i) = 80  ' Sets the Y value for the blocks.
  Row2y(i) = 97  ' Since it will be the same each time,
  Row3y(i) = 114 ' it equals a constant number.
  Row4y(i) = 131 '

   Row1hit(i) = 0
   Row2hit(i) = 0
   Row3hit(i) = 0
   Row4hit(i) = 0

    x = x + 62 ' Adds 62 to the X value

NEXT i ' Continues the loop


LINE (Ballx, Bally)-(Ballx + 15, Bally + 15), 1, BF 'Initally draws the ball
LINE (Padx, Pady)-(Padx + 60, Pady + 15), 4, BF 'Initally draws the paddle


FOR i = 1 TO 10 'Begin the FOR loop to draw the blocks

 LINE (Row1x(i), Row1y(i))-(Row1x(i) + 60, Row1y(i) + 15), 10, BF ' This
 LINE (Row2x(i), Row2y(i))-(Row2x(i) + 60, Row2y(i) + 15), 1, BF  ' draws
 LINE (Row3x(i), Row3y(i))-(Row3x(i) + 60, Row3y(i) + 15), 4, BF  ' the
 LINE (Row4x(i), Row4y(i))-(Row4x(i) + 60, Row4y(i) + 15), 8, BF  ' boxes

NEXT i 'Continues the loop



DO  'Begins the DO LOOP for the heart of the program.

press$ = INKEY$ 'This sets the key pressed to INKEY$. It's Faster than INKEY$

LINE (Ballx, Bally)-(Ballx + 15, Bally + 15), 1, BF 'Draws the Ball

WAIT &H3DA, 8 'Suspends the program a bit.

LINE (Ballx, Bally)-(Ballx + 15, Bally + 15), 0, BF ' Draws a black area where the ball used to be

Ballx = Ballx + BallxAng 'Sets the new values for the
Bally = Bally + BallyAng 'X and Y location of the ball.

LINE (Ballx, Bally)-(Ballx + 15, Bally + 15), 1, BF 'Draws the ball at the new location


IF press$ = CHR$(0) + CHR$(75) AND Padx > 0 THEN '  Moves the paddle left if
 LINE (Padx, Pady)-(Padx + 60, Pady + 15), 0, BF  ' the left arrow is pressed
  Padx = Padx - 10                                 ' and stops the movement
   LINE (Padx, Pady)-(Padx + 60, Pady + 15), 4, BF  'at the screen border.

ELSEIF press$ = CHR$(0) + CHR$(77) AND Padx < 580 THEN 'Moves the paddle
 LINE (Padx, Pady)-(Padx + 60, Pady + 15), 0, BF       'right if right arrow
  Padx = Padx + 10                                     'is pressed, and stops
   LINE (Padx, Pady)-(Padx + 60, Pady + 15), 4, BF     'movement at the border

ELSEIF press$ = CHR$(13) THEN
 END

END IF ' Ends the IF block


IF Ballx >= Padx - 15 AND Ballx <= Padx + 60 AND Bally = Pady - 16 THEN
 BallyAng = -1
ELSEIF Ballx = 625 THEN
 BallxAng = BallxAng - 1
ELSEIF Ballx = 0 THEN
 BallxAng = BallxAng + 1
END IF

FOR i = 1 TO 10
IF Ballx >= Row1x(i) - 15 AND Ballx < Row1x(i) + 60 AND Bally = Row1y(i) + 15 AND Row1hit(i) < 1 THEN
 Row1hit(i) = Row1hit(i) + 1
  BallyAng = 1

ELSEIF Ballx >= Row2x(i) - 15 AND Ballx < Row2x(i) + 60 AND Bally = Row2y(i) + 15 AND Row2hit(i) < 1 THEN
  Row2hit(i) = 1
   LINE (Row2x(i), Row2y(i))-(Row2x(i) + 60, Row2y(i) + 15), 0, BF
    BallyAng = 1

ELSEIF Ballx >= Row3x(i) - 15 AND Ballx < Row3x(i) + 60 AND Bally = Row3y(i) + 15 AND Row3hit(i) < 1 THEN
  Row3hit(i) = 1
   LINE (Row3x(i), Row3y(i))-(Row3x(i) + 60, Row3y(i) + 15), 0, BF
    BallyAng = 1

ELSEIF Ballx >= Row4x(i) - 15 AND Ballx < Row4x(i) + 60 AND Bally = Row4y(i) + 15 AND Row4hit(i) < 1 THEN
  Row4hit(i) = 1
   LINE (Row4x(i), Row4y(i))-(Row4x(i) + 60, Row4y(i) + 15), 0, BF
    BallyAng = 1

ELSEIF Ballx >= Row1x(i) - 15 AND Ballx < Row1x(i) + 60 AND Bally = Row1y(i) + 15 AND Row1hit(i) = 1 THEN
  Row1hit(i) = 2
   LINE (Row1x(i), Row1y(i))-(Row1x(i) + 60, Row1y(i) + 15), 0, BF
    BallyAng = 1
END IF
NEXT i


LOOP

http://www.mediafire.com/file/znmzmeznkxg/breakout.zip

Note: Apparently you have to press ENTER to quit this program!
« Last Edit: November 02, 2008, 10:25:14 PM by Ecrofirt »
8=D

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #7 on: November 02, 2008, 10:30:06 PM »
Here's a better breakout clone that I made. It differing bounce angles based on where the ball hits the paddle, and it correctly exits the game if you lose.

Unfortunately, it doesn't know to quit or reset when you win.

BRKOUT2.BAS:
Code: [Select]


DECLARE SUB EndGame (score)
DECLARE SUB BeginningMoves (BeginTime#, Padx, Pady)


COMMON SHARED BeginTime#, Padx, Pady, score


DIM Row1x(10), Row1y(10), Row2x(10), Row2y(10), Row3x(10), Row3y(10), Row4x(10), Row4y(10)
DIM Row1hit(10), Row2hit(10), Row3hit(10), Row4hit(10)
SCREEN 7, 0, 1, 0


LINE (0, 0)-(320, 200), 0, BF ' Clears the background
LINE (0, 18)-(319, 199), 5, B


RANDOMIZE TIMER             '
Ballx = INT(RND * 300) + 10  ' Randomizes the X location and angle
xAng = INT(RND * 2)           '


BallyAng = 2 ' Sets the Y angle
Bally = 60 'Sets ball location on Y axis
Padx = 140 'Sets Pad Location on X axis
Pady = 190 ' Sets Pad location on Y axis
BeginTime# = TIMER


IF xAng = 0 THEN '
 BallxAng = -2    'This decides if the ball will move left or

ELSE             'right based on the randomized xAng value.
 BallxAng = 2     '
END IF           '



x = 5 'Sets the initial X value for the blocks


FOR i = 1 TO 10  'Begins a FOR loop for the X and Y values of the blocks

 Row1x(i) = x 'Sets the X value of the blocks.
 Row2x(i) = x 'this changes with each block, so
 Row3x(i) = x 'it goes by a changing X value
 Row4x(i) = x '

  Row1y(i) = 20  ' Sets the Y value for the blocks.
  Row2y(i) = 28  ' Since it will be the same each time,
  Row3y(i) = 36 ' it equals a constant number.
  Row4y(i) = 44 '

   Row1hit(i) = 0
   Row2hit(i) = 0
   Row3hit(i) = 0
   Row4hit(i) = 0

    x = x + 31 ' Adds 32 to the X value

NEXT i ' Continues the loop


LINE (Ballx, Bally)-(Ballx + 8, Bally + 6), 1, BF 'Initally draws the ball
LINE (Padx, Pady)-(Padx + 30, Pady + 6), 4, BF 'Initally draws the paddle


FOR i = 1 TO 10 'Begin the FOR loop to draw the blocks

 LINE (Row1x(i), Row1y(i))-(Row1x(i) + 29, Row1y(i) + 6), 10, BF ' This
 LINE (Row2x(i), Row2y(i))-(Row2x(i) + 29, Row2y(i) + 6), 1, BF  ' draws
 LINE (Row3x(i), Row3y(i))-(Row3x(i) + 29, Row3y(i) + 6), 4, BF  ' the
 LINE (Row4x(i), Row4y(i))-(Row4x(i) + 29, Row4y(i) + 6), 8, BF  ' boxes

NEXT i 'Continues the loop






CALL BeginningMoves(BeginTime#, Padx, Pady)


PCOPY 1, 0


DO  'Begins the DO LOOP for the heart of the program.



 press$ = INKEY$ 'This sets the key pressed to INKEY$. It's Faster than INKEY$


 LINE (Ballx, Bally)-(Ballx + 8, Bally + 6), 1, BF 'Draws the Ball
 LINE (0, 18)-(319, 199), 5, B



WAIT &H3DA, 8



 LINE (Ballx, Bally)-(Ballx + 8, Bally + 6), 0, BF ' Draws a black area where the ball used to be


 Ballx = Ballx + BallxAng    'Sets the new values for the
 Bally = Bally + BallyAng    'X and Y location of the ball.
 

 IF press$ = CHR$(0) + CHR$(75) AND Padx >= 2 THEN      'Moves the paddle left if
     LINE (Padx, Pady)-(Padx + 30, Pady + 6), 0, BF     'the left arrow is pressed
     Padx = Padx - 10                                   'and stops the movement
     IF Padx < 2 THEN Padx = 2                          'at the screen border.

 ELSEIF press$ = CHR$(0) + CHR$(77) AND Padx < 287 THEN 'Moves the paddle
     LINE (Padx, Pady)-(Padx + 30, Pady + 6), 0, BF     'right if right arrow
     Padx = Padx + 10                                   'is pressed, and stops
     IF Padx > 286 THEN Padx = 287                      'movement at the border

 ELSEIF press$ = "q" THEN                               'Quickly quits the program
  END                                                   'if the user presses q

 END IF ' Ends the IF block
 


'This is all for paddle collision

IF Ballx >= Padx - 8 AND Ballx <= Padx + 30 AND Bally >= Pady - 9 THEN
 Bally = Pady - 9

 SELECT CASE Ballx               '
                                 '
  CASE Padx - 8 TO Padx - 2      ' this sets a new rebound angle
     BallxAng = -3               ' based on where the ball hit
     BallyAng = -1               ' the paddle
                                 '
                                 '
                                 '
   CASE Padx - 2 TO Padx + 4     '
     BallxAng = -2               '
     BallyAng = -2               '
                                 '
                                 '
                                 '
   CASE Padx + 4 TO Padx + 11    '
     BallxAng = -1               '
     BallyAng = -2               '
                                 '
                                 '
                                 '
   CASE Padx + 11 TO Padx + 18   '
     BallxAng = 1                '
     BallyAng = -2               '
                                 '
                                 '
                                 '
   CASE Padx + 18 TO Padx + 24   '
     BallxAng = 2                '
     BallyAng = -2               '
                                 '
                                 '
                                 '
   CASE Padx + 24 TO Padx + 30   '
     BallxAng = 3                '
     BallyAng = -1               '
                                 '
 END SELECT                      '



ELSEIF Ballx >= 310 AND BallxAng > 0 THEN         '
 Ballx = 310                                      '
 BallxAng = -BallxAng                             '
  LINE (0, 18)-(319, 199), 5, B                   '
   PCOPY 1, 0                                     '
                                                  '
ELSEIF Ballx <= 2 AND BallxAng < 0 THEN           '
 Ballx = 2                                        'Routine for checking if the
 BallxAng = -BallxAng                             'ball has hit any border.
  LINE (0, 18)-(319, 199), 5, B                   '
   PCOPY 1, 0                                     '
                                                  '
ELSEIF Bally > 200 THEN                           '
 CALL EndGame(score)                              '
                                                  '
ELSEIF Bally <= 20 THEN                           '
 BallyAng = BallyAng + 2                          '
                                                  '
END IF                                            '


 




FOR i = 1 TO 10





'Highest block events



IF Ballx >= Row1x(i) - 8 AND Ballx < Row1x(i) + 31 AND Bally = Row1y(i) + 8 AND Row1hit(i) < 1 THEN 'If the ball hits the bottom of the block
    IF BallxAng > 0 THEN
      BallxAng = 2
     ELSE
      BallxAng = -2
     END IF
 Row1hit(i) = Row1hit(i) + 1
  BallyAng = 2

ELSEIF Ballx + 9 >= Row1x(i) AND Ballx <= Row1x(i) + 31 AND Bally >= Row1y(i) - 7 AND Bally <= Row1y(i) + 8 AND Row1hit(i) < 1 THEN
 Row1hit(i) = Row1hit(i) + 1
  BallyAng = 2
   BallxAng = -BallxAng

ELSEIF Ballx >= Row1x(i) - 8 AND Ballx < Row1x(i) + 31 AND Bally = Row1y(i) + 8 AND Row1hit(i) = 1 THEN
    IF BallxAng > 0 THEN
      BallxAng = 2
     ELSE
      BallxAng = -2
     END IF
  Row1hit(i) = 2
   LINE (Row1x(i), Row1y(i))-(Row1x(i) + 30, Row1y(i) + 6), 0, BF
    BallyAng = 2
     score = score + 8
      LOCATE 1
       PRINT "Score:"; score

ELSEIF Ballx + 9 >= Row1x(i) AND Ballx <= Row1x(i) + 31 AND Bally >= Row1y(i) - 7 AND Bally <= Row1y(i) + 8 AND Row1hit(i) = 1 THEN
  Row1hit(i) = 2
   LINE (Row1x(i), Row1y(i))-(Row1x(i) + 30, Row1y(i) + 6), 0, BF
    BallyAng = 2
     BallxAng = -BallxAng
      score = score + 8
       LOCATE 1
        PRINT "Score:"; score


'Second Highest block events


ELSEIF Ballx >= Row2x(i) - 8 AND Ballx < Row2x(i) + 31 AND Bally = Row2y(i) + 8 AND Row2hit(i) < 1 THEN
    IF BallxAng > 0 THEN
      BallxAng = 2
     ELSE
      BallxAng = -2
     END IF
  Row2hit(i) = 1
   LINE (Row2x(i), Row2y(i))-(Row2x(i) + 30, Row2y(i) + 6), 0, BF
    BallyAng = 2
     score = score + 4
      LOCATE 1
       PRINT "Score:"; score

ELSEIF Ballx + 9 >= Row2x(i) AND Ballx <= Row2x(i) + 31 AND Bally >= Row2y(i) - 7 AND Bally <= Row2y(i) + 8 AND Row2hit(i) < 1 THEN
  Row2hit(i) = 1
   LINE (Row2x(i), Row2y(i))-(Row2x(i) + 30, Row2y(i) + 6), 0, BF
    BallyAng = 2
     BallxAng = -BallxAng
      score = score + 4
       LOCATE 1
        PRINT "Score:"; score

'Second lowest block events


ELSEIF Ballx >= Row3x(i) - 8 AND Ballx < Row3x(i) + 31 AND Bally = Row3y(i) + 8 AND Row3hit(i) < 1 THEN
    IF BallxAng > 0 THEN
      BallxAng = 2
     ELSE
      BallxAng = -2
     END IF
  Row3hit(i) = 1
   LINE (Row3x(i), Row3y(i))-(Row3x(i) + 30, Row3y(i) + 6), 0, BF
    BallyAng = 2
     score = score + 2
      LOCATE 1
       PRINT "Score:"; score

ELSEIF Ballx + 9 >= Row3x(i) AND Ballx <= Row3x(i) + 31 AND Bally >= Row3y(i) - 7 AND Bally <= Row3y(i) + 8 AND Row3hit(i) < 1 THEN
  Row3hit(i) = 1
   LINE (Row3x(i), Row3y(i))-(Row3x(i) + 30, Row3y(i) + 6), 0, BF
    BallyAng = 2
     BallxAng = -BallxAng
      score = score + 2
       LOCATE 1
        PRINT "Score:"; score


' Bottom block events



ELSEIF Ballx >= Row4x(i) - 8 AND Ballx < Row4x(i) + 31 AND Bally = Row4y(i) + 8 AND Row4hit(i) < 1 THEN
    IF BallxAng > 0 THEN
      BallxAng = 2
     ELSE
      BallxAng = -2
     END IF
  Row4hit(i) = 1
   LINE (Row4x(i), Row4y(i))-(Row4x(i) + 30, Row4y(i) + 6), 0, BF
    BallyAng = 2
     score = score + 1
      LOCATE 1
       PRINT "Score:"; score


ELSEIF Ballx + 9 >= Row4x(i) AND Ballx <= Row4x(i) + 31 AND Bally >= Row4y(i) - 7 AND Bally <= Row4y(i) + 8 AND Row4hit(i) < 1 THEN
  Row4hit(i) = 1
   LINE (Row4x(i), Row4y(i))-(Row4x(i) + 30, Row4y(i) + 6), 0, BF
    BallyAng = 2
     BallxAng = -BallxAng
      score = score + 1
       LOCATE 1
        PRINT "Score:"; score



END IF
NEXT i


 LINE (Ballx, Bally)-(Ballx + 8, Bally + 6), 1, BF 'Draws the ball at the new location
 LINE (Padx, Pady)-(Padx + 30, Pady + 6), 4, BF    'Draws the paddle at the new location

WAIT &H3DA, 8

PCOPY 1, 0

LOOP

SUB BeginningMoves (BeginTime#, Padx, Pady)


BeginTime# = TIMER
x = 5
DO
press$ = INKEY$
CurTime# = TIMER


IF CurTime# >= BeginTime + 0 AND CurTime# < BeginTime# + 1 THEN
LOCATE 10, 15
PRINT "Get Ready!"
LOCATE 11, 19
PRINT "0" + "5"
x = 4
ELSEIF CurTime# >= BeginTime + 1 AND CurTime# < BeginTime# + 2 THEN
LOCATE 10, 15
PRINT "Get Ready!"
LOCATE 11, 19
PRINT "0" + "4"
x = 3
ELSEIF CurTime# >= BeginTime + 2 AND CurTime# < BeginTime# + 3 THEN
LOCATE 10, 15
PRINT "Get Ready!"
LOCATE 11, 19
PRINT "0" + "3"
x = 2
ELSEIF CurTime# >= BeginTime + 3 AND CurTime# < BeginTime# + 4 THEN
LOCATE 10, 15
PRINT "Get Ready!"
LOCATE 11, 19
PRINT "0" + "2"
x = 1
ELSEIF CurTime# >= BeginTime + 4 AND CurTime# < BeginTime# + 5 THEN
LOCATE 10, 15
PRINT "Get Ready!"
LOCATE 11, 19
PRINT "0" + "1"
x = 0
ELSEIF CurTime# >= BeginTime + 5 AND CurTime# < BeginTime# + 6 THEN
LOCATE 10, 15
PRINT "Get Ready!"
LOCATE 11, 19
PRINT "0" + "0"
x = -1

ELSEIF CurTime# >= BeginTime + 6 AND CurTime# < BeginTime# + 7 THEN
LINE (100, 70)-(200, 100), 0, BF
x = -2
ELSE
END IF

 IF press$ = CHR$(0) + CHR$(75) AND Padx >= 5 THEN '  Moves the paddle left if
  LINE (Padx, Pady)-(Padx + 30, Pady + 6), 0, BF  ' the left arrow is pressed
   Padx = Padx - 10                                 ' and stops the movement
    LINE (Padx, Pady)-(Padx + 30, Pady + 6), 4, BF  'at the screen border.
     LINE (0, 18)-(319, 199), 5, B

 ELSEIF press$ = CHR$(0) + CHR$(77) AND Padx < 290 THEN 'Moves the paddle
  LINE (Padx, Pady)-(Padx + 30, Pady + 6), 0, BF        'right if right arrow
   Padx = Padx + 10                                     'is pressed, and stops
    LINE (Padx, Pady)-(Padx + 30, Pady + 6), 4, BF      'movement at the border
     LINE (0, 18)-(319, 199), 5, B

 ELSEIF press$ = "q" THEN
  END

 END IF

PCOPY 1, 0
LOOP UNTIL x = -2


END SUB

SUB EndGame (score)
CLS
PRINT "YOU SUCK."
PCOPY 1, 0
DO WHILE INKEY$ = ""
LOOP
END
END SUB

http://www.mediafire.com/file/mjkjkowwoez/brkout2.zip

You can see I'm getting a *little* bit better at this point.
8=D

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #8 on: November 02, 2008, 10:40:32 PM »
Code: [Select]
Here's a cute program I made for Nikki when I was 16 or so.

It's a rather simple approximation of an Etch-a-Sketch. I had a blast with this as a kid.

COLORS.BAS:
[code]

'********************
'IF YOU DECIDE TO PRESS 7, 3, 1, OR 9 TO MOVE
'THE PIXEL DIAGONALLY, YOU MUST HAVE NUMBER LOCK ON!
'********************




start:           '***START OF PROGRAM***

'***SET VARIABLES FOR COLOR, X VALUE, AND Y VALUE

SCREEN 13      'Sets Screen Mode to 13  (320 x 200 pixels)
x = 160          'Pixel location on the X axis
y = 90         'Pixel location on the Y axis
colour = 0       'COLOR value (black).

'***SCREEN LAYOUT

LINE (0, 0)-(320, 200), 4, BF         'Colors the entire screen Red
LINE (20, 20)-(300, 160), 7, BF     'Colors an inside portion of the screen White (appears gray)
LINE (19, 19)-(301, 161), 0, B        'Sets a black line around the White
CIRCLE (60, 180), 16, 0             'Puts a Black circle on the bottom of the screen (left side).
PAINT (60, 180), 15, 0                'Fills the circle with Bright White
CIRCLE (260, 180), 16, 0            'Puts a Black circle on the bottom of the screen (right side).
PAINT (260, 180), 15, 0               'Fills the circle with Bright White



'***KEYPRESS LOOP!



DO    'BEGIN LOOP
z$ = INKEY$      'Sets z$ to equal INKEY$. On a key pass, z$ is picked up easier



'!!!***CLIPPING STOPS THE PIXEL FROM MOVING ANY FURTHER IN A GIVEN DIRECTION
'
' "IF x < 300 THEN" = IF THE X PIXEL LOCATION IS LESS THAN 300 THEN... - CLIPPING
' "IF x > 20 THEN" = IF THE X PIXEL LOCATION IS GREATER THAN 20 THEN... - CLIPPING
' "IF y > 20 THEN" = IF THE Y PIXEL LOCATION IS GREATER THAN 20 THEN... - CLIPPING
' "IF y < 160 THEN" = IF THE Y PIXEL LOCATION IS LESS THAN 160 THEN... - CLIPPING



IF z$ = CHR$(0) + CHR$(77) THEN IF x < 300 THEN x = x + 1    'Do ... if the right arrow key (keypad or number pad) is pressed
IF z$ = CHR$(0) + CHR$(75) THEN IF x > 20 THEN x = x - 1   'Do ... if the left arrow key (keypad or number pad) is pressed
IF z$ = CHR$(0) + CHR$(72) THEN IF y > 20 THEN y = y - 1     ' Do ... if the up arrow key (keypad or number pad) is pressed
IF z$ = CHR$(0) + CHR$(80) THEN IF y < 160 THEN y = y + 1  'Do ... if the down arrow key (keypad or number pad) is pressed


'IF 7,3,1, OR 9 IS TO BE PRESSED, NUMBER LOCK ***MUST*** BE ON!


IF z$ = "9" THEN IF x < 300 THEN IF y > 20 THEN x = x + 1: y = y - 1    'Do ... if 9 (number pad) is pressed
IF z$ = "7" THEN IF x > 20 THEN IF y > 20 THEN x = x - 1: y = y - 1       'Do ... if 7 (number pad) is pressed
IF z$ = "3" THEN IF x < 300 THEN IF y < 160 THEN x = x + 1: y = y + 1   'Do ... if 3 (number pad) is pressed
IF z$ = "1" THEN IF x > 20 THEN IF y < 160 THEN x = x - 1: y = y + 1      'Do ... if 1 (number pad) is pressed
IF z$ = "6" THEN IF x < 300 THEN z = x: z1 = y:  x = x + 1              'Do ... if 6 (number pad) is pressed
IF z$ = "4" THEN IF x > 20 THEN z = x: z1 = y:  x = x - 1                 'Do ... if 4 (number pad) is pressed
IF z$ = "8" THEN IF y > 20 THEN z = x: z1 = y: y = y - 1                'Do ... if 8 (number pad) is pressed
IF z$ = "2" THEN IF y < 160 THEN z = x: z1 = y: y = y + 1                 'Do ... if 2 (number pad) is pressed

PSET (x, y), 0   'Puts a Black pixel on the screen at the x,y location
LOOP UNTIL z$ = CHR$(27) OR z$ = CHR$(13)  'Continue loop until Escape or Enter are pressed




WHILE z$ = CHR$(13) 'If enter is pressed, go back to the start (clears the screen)
GOTO start          '  ^     ^     ^
WEND                ' ^ ^   ^ ^   ^ ^

'IF ESCAPE WAS PRESSED, THE PROGRAM ENDS!

[code
[/code]

http://www.mediafire.com/file/jmtmdkozyze/colors.zip

If you turn NUMLOCK on you can use the keypad to move in 8 directions. Otherwise, use the arrow keys to move up, down, left, and right.
8=D

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #9 on: November 02, 2008, 10:58:30 PM »
These next two programs are some of my favorites.

The first one here is an underwater screensaver thing that I would have loved to set up as an actual screensaver on my PC back in the day.

BUBBLES2.BAS:
Code: [Select]
COMMON SHARED t, WeedRight, WeedPos, xbg(), ybg(), xbgang(), ybgang()  'Here are the
                             'variables to be shared among the SUBs







DECLARE SUB PaintBG () ' This is a SUB program
DECLARE SUB BubsBG (t, xbg(), ybg(), xbgang(), ybgang()) 'This is too.
DECLARE SUB MidBubs (s, xmid(), ymid(), xmidang(), ymidang()) 'This is too.



DIM SHARED x(100), y(100), xang(100), yang(100), xbg(500), ybg(500), xbgang(500), ybgang(500), xmid(50), ymid(50), xmidang(50), ymidang(50)' The Shared arrays

SCREEN 7, 0, 1, 0 'Sets the screen mode:
'(Things are drawn on page 1, but page 0 is visible)



FOR i = 1 TO 100           '  This stores the X, and Y values for the
x(i) = INT(RND * 320) + 1   '  big bubbles. It also stores the angles
y(i) = 200                   '  that bubbles move on the X and Y axis.
xang(i) = INT(RND * -9) + 5   '  (xang and yang)
yang(i) = INT(RND * -200) + 1  '
NEXT                            '


FOR q = 1 TO 500              '  This stores the X and Y values for the
xbg(q) = INT(RND * 320 + 1)    '  smallest bubbles. Is also stores the
ybg(q) = 160                    '  angles that the bubbles move on the X
xbgang(q) = INT(RND * -3) + 2    '  and Y axis. (xbgang and ybgang)
ybgang(q) = INT(RND * -200) + 1   '
NEXT

FOR q = 1 TO 50              '  This stores the X and Y values for the
xmid(q) = INT(RND * 320 + 1)    '  mid-sized bubbles. Is also stores the
ymid(q) = 180                    '  angles that the bubbles move on the X
xmidang(q) = INT(RND * -3) + 2    '  and Y axis. (xmidang and ymidang)
ymidang(q) = INT(RND * -200) + 1   '
NEXT



BigBubbles = 100  'The number of big bubbles
SmallBubbles = 500 'the number of small bubbles
MidBubbles = 50 'the number of mid-sized bubbles
WeedRight = 1


DO             'Starts the Loop for moving the bubbles.
WAIT &H3DA, 8
CALL PaintBG   'Calls the SUB that makes the background look pretty.

FOR z = 1 TO BigBubbles  'Begins the FOR NEXT loop for the Big bubbles


IF x(z) > 320 THEN x(z) = INT(RND * 320) + 1: xang(z) = INT(RND * -3) + 2  ' These move the bubbles
IF x(z) < 0 THEN x(z) = INT(RND * 320) + 1: xang(z) = INT(RND * -3) + 2    ' to the bottom of the screen
IF y(z) > 200 THEN y(z) = 200: yang(z) = INT(RND * -8) + 1                 ' if they reach the top.
IF y(z) < 0 THEN y(z) = 200: yang(z) = INT(RND * -8) + 1                   '


x(z) = x(z) + xang(z) 'This sets the new X and Y values
y(z) = y(z) + yang(z) '

xang(z) = INT(RND * -9) + 5 'Randomizes the angle at which
yang(z) = INT(RND * -8) + 1 'the bubbles will move.


CIRCLE (x(z), y(z)), 7, 15  'Draws the big circle for the bubble
CIRCLE (x(z) - 2, y(z) - 2), 1, 15 'Draws the little graphic for the bubble



NEXT 'Ends the FOR NEXT loop for the big bubbles



FOR t = 1 TO SmallBubbles 'Begins the For Next loop for the Small bubbles

CALL BubsBG(t, xbg(), ybg(), xbgang(), ybgang())  'Calls the SUB with the small bubble content.

NEXT 'Ends the For Next Loop



FOR s = 1 TO MidBubbles' Begins the For Next loop for the Mid-size bubbles

CALL MidBubs(s, xmid(), ymid(), xmidang(), ymidang())

NEXT


PCOPY 1, 0 'Puts everything onscreen.

LOOP UNTIL INKEY$ <> ""  ' Loops the program until a key is pressed



SUB BubsBG (t, xbg(), ybg(), xbgang(), ybgang())


IF xbg(t) > 320 THEN xbg(t) = INT(RND * 320) + 1: xbgang(t) = INT(RND * -3) + 2  ' Puts the bubbles back at
IF xbg(t) < 0 THEN xbg(t) = INT(RND * 320) + 1: xbgang(t) = INT(RND * -3) + 2    ' the bottom of the screen if
'IF ybg(t) > 200 THEN ybg(t) = 200:ybgang(t) = INT(RND * -8) + 1                  ' they reach the top/bottom/
IF ybg(t) < 0 THEN ybg(t) = 160: ybgang(t) = INT(RND * -8) + 1                   ' left/right


xbg(t) = xbg(t) + xbgang(t) ' Sets the new bubble locations
ybg(t) = ybg(t) + ybgang(t) '           "        "

xbgang(t) = INT(RND * -3) + 2 ' Sets the new angles
ybgang(t) = INT(RND * -8) + 1 '   "         "

CIRCLE (xbg(t), ybg(t)), 0, 15  'draws the bubbles



END SUB

SUB MidBubs (s, xmid(), ymid(), xmidang(), ymidang())

IF xmid(s) > 320 THEN xmid(s) = INT(RND * 320) + 1: xmidang(s) = INT(RND * -3) + 2  '  This puts the bubbles
IF xmid(s) < 0 THEN xmid(s) = INT(RND * 320) + 1: xmidang(s) = INT(RND * -3) + 2    '  back at the bottom if
IF ymid(s) < 0 THEN ymid(s) = 180: ymidang(s) = INT(RND * -3) + 1                   '  they reach and side



xmid(s) = xmid(s) + xmidang(s) 'sets the new location of the bubbles
ymid(s) = ymid(s) + ymidang(s) '             "       "

xmidang(s) = INT(RND * -3) + 2 ' Sets the angles at which the bubbles rise
ymidang(s) = INT(RND * -3) + 1 '            "          "

CIRCLE (xmid(s), ymid(s)), 2, 15  ' Draws a mid-size bubble




END SUB

SUB PaintBG

IF WeedRight = 1 THEN
 IF WeedPos > 2 THEN
   WeedRight = 0
   WeedPos = 2
 ELSE
   
   WeedPos = WeedPos + .6
 END IF


ELSEIF WeedRight = 0 THEN
 IF WeedPos < -2 THEN
   WeedRight = 1
   WeedPos = -2
 ELSE
   WeedPos = WeedPos - .6
 END IF


END IF

'This draws the blue BG / Brown land

LINE (0, 0)-(320, 200), 1, BF


'This draws the hills


CIRCLE (5, 185), 30, 6
PAINT (5, 167), 6, 6
CIRCLE (54, 190), 32, 6
PAINT (54, 167), 6, 6
CIRCLE (90, 199), 40, 6
PAINT (90, 167), 6, 6
CIRCLE (132, 199), 40, 6
PAINT (132, 167), 6, 6
CIRCLE (175, 190), 35, 6
PAINT (175, 167), 6, 6
CIRCLE (215, 195), 35, 6
PAINT (215, 167), 6, 6
CIRCLE (255, 190), 35, 6
PAINT (255, 167), 6, 6
CIRCLE (298, 195), 35, 6
PAINT (298, 167), 6, 6


'this draws the seaweed


LINE (35, 175)-(35 + WeedPos, 155), 10
LINE (35, 175)-(30 + WeedPos, 160), 10
LINE (35, 175)-(40 + WeedPos, 158), 10

LINE (85, 175)-(85 + WeedPos, 155), 10
LINE (85, 175)-(80 + WeedPos, 158), 10
LINE (85, 175)-(90 + WeedPos, 156), 10

LINE (145, 175)-(145 + WeedPos, 160), 10
LINE (145, 175)-(140 + WeedPos, 158), 10
LINE (145, 175)-(150 + WeedPos, 162), 10

LINE (205, 175)-(205 + WeedPos, 150), 10
LINE (205, 175)-(200 + WeedPos, 153), 10
LINE (205, 175)-(210 + WeedPos, 155), 10

LINE (265, 175)-(265 + WeedPos, 155), 10
LINE (265, 175)-(260 + WeedPos, 160), 10
LINE (265, 175)-(270 + WeedPos, 157), 10

LINE (310, 175)-(310 + WeedPos, 160), 10
LINE (310, 175)-(305 + WeedPos, 165), 10
LINE (310, 175)-(315 + WeedPos, 168), 10

END SUB

http://www.mediafire.com/file/mtnocmj2zmz/bubbles2.zip
8=D

recursivelyenumerable

  • you might think that; I couldn't possibly comment
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #10 on: November 02, 2008, 11:00:32 PM »
Quote
Here's a cute program I made for Nikki when I was 16 or so.

awww, that's sweet  :heart
QED

Ecrofirt

  • Heavy Metal Jesus
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #11 on: November 02, 2008, 11:04:42 PM »
This was like my biggest accomplishment as a QBASIC coder, I'd wager. It's my own version of the mystify your mind screensaver.

If nothing else, check this out, because it's fucking awesome.

SCRENSV3.BAS:
Code: [Select]
DIM x1(4), x2(4), x3(4), y1(4), y2(4), y3(4), y4(4)
DIM x1b(4), x2b(4), x3b(4), y1b(4), y2b(4), y3b(4), y4b(4)
DIM x1change(4), x2change(4), x3change(4), y1change(4), y2change(4), y3change(4), y4change(4)
DIM x1changeb(4), x2changeb(4), x3changeb(4), y1changeb(4), y2changeb(4), y3changeb(4), y4changeb(4)
SCREEN 7, 0, 1, 0
RANDOMIZE TIMER

'this randomizes the starting points
x1start = INT(RND * 290 + 15)
x2start = INT(RND * 290 + 15)
x3start = INT(RND * 320 + 1)
x1startb = INT(RND * 290 + 15)
x2startb = INT(RND * 290 + 15)
x3startb = INT(RND * 320 + 1)
y1start = INT(RND * 190 + 5)
y2start = INT(RND * 190 + 5)
y1startb = INT(RND * 190 + 5)
y2startb = INT(RND * 190 + 5)
y3start = INT(RND * 160 + 20)
y4start = INT(RND * 160 + 20)
y3startb = INT(RND * 160 + 20)
y4startb = INT(RND * 160 + 20)





'this makes the starting point for all 3 lines
FOR a = 1 TO 4
x1(a) = x1start + b
x2(a) = x2start + b
x3(a) = x3start + b
y1(a) = y1start + b
y2(a) = y2start + b
y3(a) = y3start + b
y4(a) = y4start + b

x1b(a) = x1startb + b
x2b(a) = x2startb + b
x3b(a) = x3startb + b
y1b(a) = y1startb + b
y2b(a) = y2startb + b
y3b(a) = y3startb + b
y4b(a) = y4startb + b

count = count + 1
IF count = 1 THEN b = -2
IF count = 2 THEN b = 2
IF count = 3 THEN b = 4
NEXT a





'this is the number of pixels each line moves in each direction
FOR b = 1 TO 4
x1change(b) = 1
x2change(b) = 1
x3change(b) = 1
y1change(b) = 1
y2change(b) = 1
y3change(b) = 1
y4change(b) = 1

x1changeb(b) = 1
x2changeb(b) = 1
x3changeb(b) = 1
y1changeb(b) = 1
y2changeb(b) = 1
y3changeb(b) = 1
y4changeb(b) = 1
NEXT b


'this is the color
clr = INT(RND * 12 + 4)
clrb = INT(RND * 12 + 4)

count = 0
DO
FOR b = 1 TO 4
'for the first object
IF x1(b) < 15 OR x1(b) > 305 THEN : x1change(b) = -x1change(b)
IF x2(b) < 15 OR x2(b) > 305 THEN : x2change(b) = -x2change(b)
IF y1(b) < 5 OR y1(b) > 195 THEN y1change(b) = -y1change(b)
IF y2(b) < 5 OR y2(b) > 195 THEN y2change(b) = -y2change(b)
IF y3(b) < 20 OR y3(b) > 180 THEN y3change(b) = -y3change(b)
IF y4(b) < 20 OR y4(b) > 180 THEN y4change(b) = -y4change(b)
IF x3(b) < 0 OR x3(b) > 320 THEN x3change(b) = -x3change(b)


'for the second object
IF x1b(b) < 15 OR x1b(b) > 305 THEN : x1changeb(b) = -x1changeb(b)
IF x2b(b) < 15 OR x2b(b) > 305 THEN : x2changeb(b) = -x2changeb(b)
IF y1b(b) < 5 OR y1b(b) > 195 THEN y1changeb(b) = -y1changeb(b)
IF y2b(b) < 5 OR y2b(b) > 195 THEN y2changeb(b) = -y2changeb(b)
IF y3b(b) < 20 OR y3b(b) > 180 THEN y3changeb(b) = -y3changeb(b)
IF y4b(b1) < 20 OR y4b(b) > 180 THEN y4changeb(b) = -y4changeb(b)
IF x3b(b) < 0 OR x3b(b) > 320 THEN x3changeb(b) = -x3changeb(b)
NEXT b

'makes a new color
count = count + 1
IF count = 200 THEN
 count = 0
 clr = INT(RND * 12 + 4)
 clrb = INT(RND * 12 + 4)
  IF clr = 16 THEN clr = 4
  IF clrb = 16 THEN clrb = 4
END IF

WAIT &H3DA, 8
LINE (0, 0)-(320, 200), 0, BF
FOR b = 1 TO 4
'the first object
LINE (x1(b), y3(b))-(x2(b), y4(b)), clr - 3'Upper Left to lower Right
LINE (x2(b), y3(b))-(x1(b), y4(b)), clr - 2'Upper Right to lover Left
LINE (x1(b), y3(b))-(x3(b), y1(b)), clr - 3'top left-to-center line
LINE (x1(b), y4(b))-(x3(b), y2(b)), clr - 2'bottom left-to-center line
LINE (x2(b), y3(b))-(x3(b), y1(b)), clr - 3'top right-to-center line
LINE (x2(b), y4(b))-(x3(b), y2(b)), clr - 2'bottom right-to-center line
LINE (x1(b), y3(b))-(x3(b), y2(b)), clr - 1
LINE (x2(b), y3(b))-(x3(b), y2(b)), clr - 1
LINE (x1(b), y4(b))-(x3(b), y1(b)), clr
LINE (x2(b), y4(b))-(x3(b), y1(b)), clr

'the second object
LINE (x1b(b), y3b(b))-(x2b(b), y4b(b)), clrb - 3'Upper Left to lower Right
LINE (x2b(b), y3b(b))-(x1b(b), y4b(b)), clrb - 2'Upper Right to lover Left
LINE (x1b(b), y3b(b))-(x3b(b), y1b(b)), clrb - 3'top left-to-center line
LINE (x1b(b), y4b(b))-(x3b(b), y2b(b)), clrb - 2'bottom left-to-center line
LINE (x2b(b), y3b(b))-(x3b(b), y1b(b)), clrb - 3'top right-to-center line
LINE (x2b(b), y4b(b))-(x3b(b), y2b(b)), clrb - 2'bottom right-to-center line

LINE (x1b(b), y3b(b))-(x3b(b), y2b(b)), clrb - 1
LINE (x2b(b), y3b(b))-(x3b(b), y2b(b)), clrb - 1
LINE (x1b(b), y4b(b))-(x3b(b), y1b(b)), clrb
LINE (x2b(b), y4b(b))-(x3b(b), y1b(b)), clrb




NEXT b



FOR b = 1 TO 4
'for the first obj
x1(b) = x1(b) + x1change(b)
x2(b) = x2(b) + -x2change(b)
x3(b) = x3(b) + -x3change(b)
y1(b) = y1(b) + y1change(b)
y2(b) = y2(b) + -y2change(b)
y3(b) = y3(b) + y3change(b)
y4(b) = y4(b) + -y4change(b)

'for the second obj
x1b(b) = x1b(b) + x1changeb(b)
x2b(b) = x2b(b) + -x2changeb(b)
x3b(b) = x3b(b) + -x3changeb(b)
y1b(b) = y1b(b) + y1changeb(b)
y2b(b) = y2b(b) + -y2changeb(b)
y3b(b) = y3b(b) + y3changeb(b)
y4b(b) = y4b(b) + -y4changeb(b)

NEXT b

PCOPY 1, 0
LOOP WHILE INKEY$ = ""

http://www.mediafire.com/file/ywzlhbmkhom/scrensv3.zip
8=D

Madrun Badrun

  • twin-anused mascot
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #12 on: November 02, 2008, 11:08:47 PM »
:bow :bow :bow

xnikki118x

  • Hanson Defense Force
  • Senior Member
Re: Holy shit, QBASIC for the 13-year-old-boy-in-me win.
« Reply #13 on: November 02, 2008, 11:21:44 PM »
Aw, I loved that Etch-a-Sketch program! :heartbeat

I also used to play that Breakout game all the time. When you break all the blocks, nothing happens, lol. :)
:-*