# Qbasicnews.com

Full Version: New Challenge for hardcore QBers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
You must make a Qbasic game. Here are the rules:

- No libraries
- Qbasic 4.5 only!
- 64 lines long MAX

Have fun!
impossible.
Or is it?

Code:
```SCREEN 7, , 0, 1 LINE (0, 0)-(319, 199), 1, B LINE (1, 1)-(318, 198), 9, B LINE (2, 2)-(317, 197), 1, B x% = 160 y% = 100 ex% = 10 ey% = 10 et% = 0 DO         et% = et% + 1         oldx% = x%         oldy% = y%         oldex% = ex%         oldey% = ey%         key\$ = INKEY\$         SELECT CASE key\$         CASE CHR\$(0) + CHR\$(72):                 IF POINT(x%, y% - 5) = 0 THEN y% = y% - 3         CASE CHR\$(0) + CHR\$(80):                 IF POINT(x%, y% + 4) = 0 THEN y% = y% + 3         CASE CHR\$(0) + CHR\$(75)                 IF POINT(x% - 5, y%) = 0 THEN x% = x% - 3         CASE CHR\$(0) + CHR\$(77)                 IF POINT(x% + 4, y%) = 0 THEN x% = x% + 3         END SELECT         IF et% = 6 THEN                 IF INT(RND * 4) MOD 3 AND ex% > x% AND POINT(ex% - 5, ey%) = 0 THEN ex% = ex% - 3                 IF INT(RND * 4) MOD 3 AND ex% < x% AND POINT(ex% + 4, ey%) = 0 THEN ex% = ex% + 3                 IF INT(RND * 4) MOD 3 AND ey% > y% AND POINT(ex%, ey% - 5) = 0 THEN ey% = ey% - 3                 IF INT(RND * 4) MOD 3 AND ey% < y% AND POINT(ex%, ey% + 4) = 0 THEN ey% = ey% + 3                 et% = 0         END IF         IF ABS(ex% - x%) <= 3 AND ABS(ey% - y%) <= 3 THEN                 'CLS                 LOCATE 13, 6                 PRINT "You lost, loser! Mwahahahaha!"                 PCOPY 0, 1                 SLEEP                 CLS                 END         END IF         LINE (oldx% - 2, oldy% - 2)-(oldx% + 2, oldy% + 2), 0, BF         CIRCLE (x%, y%), INT(TIMER MOD 1.5) + 1, 10         PAINT (x%, y%), 2, 10         LINE (oldex% - 2, oldey% - 2)-(oldex% + 2, oldey% + 2), 0, BF         CIRCLE (ex%, ey%), INT(TIMER MOD 1.5) + 1, 12         PAINT (ex%, ey%), 4, 12         PCOPY 0, 1 LOOP UNTIL key\$ = CHR\$(27)```
Dude.... that's so cool, but would be better if there was a score.
it's not impossible (i've seen a 13 line snake and a 9 line pong), but i dont really feel like it, my "hardcore" qb days are long gone alls i want to do nowadays is just make sprites and enter littler, happy contests.
I'm planning on implimenting randomly placed "coins" that you have to collent in order to get a score... But meh...
Here's something I threw together. There's plenty of lines to spare, and lots of ways to crunch down on the size of this and get even more lines. But I've been sittin' at the computer all day and need a break. So here ya go:

Keep the hero alive. Red pellets slow the enemy. Purple pellets speed you up. Brown pellets clear the screen (very useful)

Have fun!

Code:
```RANDOMIZE TIMER DEF SEG = 0 SCREEN 13 LINE (0, 0)-(319, 199), 1, B x! = 160 y! = 100 s! = .001 bs! = .0006 t# = TIMER PSET (160, 100), 15 DO      DO           IF INT(RND * 100000) = 1 AND bs! < s! THEN bs! = bs! + .00001           IF INT(RND * 9000) = 1 THEN                dx% = INT(RND * 320)                dy% = INT(RND * 200)                IF ABS(x! - dx%) > 5 AND ABS(y! - dy%) > 5 THEN PSET (INT(RND * 320), INT(RND * 200)), 1           END IF           b% = POINT(bx! + bxc!, by! + byc!)                'get next color           bx! = bx! + bxc!                                  'move baddy           by! = by! + byc!                                  'move baddy           IF b% <> 1 THEN PSET (bx!, by!), 1                'draw baddy           bxc! = SGN(x! - bx!) * bs! * COS(ATN(ABS(y! - by!) / ABS(x! - bx!)))           byc! = SGN(y! - by!) * bs! * SIN(ATN(ABS(y! - by!) / ABS(x! - bx!)))           n% = POINT(x! + xc!, y! + yc!)                    'get next color           IF n% <> 15 THEN PSET (x!, y!), 1                 'make trail           x! = x! + xc!                                     'move hero           y! = y! + yc!                                     'move hero           IF n% = 4 OR n% = 5 OR n% = 6 OR b% = 4 OR b% = 5 OR b% = 6 OR INT(RND * 100000) = 1 THEN                IF cx% OR cy% THEN CIRCLE (cx%, cy%), 1, 0                cx% = INT(RND * 316) + 2                cy% = INT(RND * 196) + 2                CIRCLE (cx%, cy%), 1, INT(RND * 3) + 4           END IF           IF n% = 4 THEN bs! = .0005           IF n% = 5 THEN s! = s! + .0001           IF n% = 6 THEN                CLS                LINE (0, 0)-(319, 199), 1, B                PSET (x!, y!), 15                CIRCLE (cx%, cy%), 1, INT(RND * 3) + 4           END IF           IF n% <> 1 THEN PSET (x!, y!), 15                 'draw hero           POKE &H41A, PEEK(&H41C)                           'clear kb buffer           k% = INP(&H60)                                    'get keystroke      LOOP UNTIL k% = 72 OR k% = 75 OR k% = 80 OR k% = 77 OR k% = 1 OR n% = 1      xc! = 0      yc! = 0      IF k% = 72 THEN yc! = -s!      IF k% = 75 THEN xc! = -s!      IF k% = 80 THEN yc! = s!      IF k% = 77 THEN xc! = s! LOOP UNTIL k% = 1 OR n% = 1 PRINT "You scored"; INT(TIMER - t# + .5); "points!"```

*peace*

Meg.
Very nice! I love snake clones
PacMan!!! Anyone????
Pac man? I just finished helping a dude with that, but it's well over 64 lines..... still wanna see it?
Pages: 1 2 3