Allegro.cc Forums » Off-Topic Ordeals » Fun with QBASIC!

 This thread is locked; no one can reply to it. 1   2
 Fun with QBASIC!
Thomas Fjellstrom
Member #476
June 2000

0xd00ds and 0xd00dets!

I invite you all to a grand Occasion!

The Unvailing of my Very First QBASIC program!

 1 ESC\$ = CHR\$(27) 2 DIM SC AS STRING * 2 3 K1\$ = INKEY\$ 4 5 SCREEN 12 6 PRINT "Press ESC to exit!" 7 8 x = 320 9 y = 240 10 xinc = 1 11 yinc = 2 12 DO WHILE K1\$ <> ESC\$ 13 'PRINT "CHR: ", K1\$ 14 'CLS 15 PSET (ox, oy), 0 16 PSET (x, y), 25 17 ox = x 18 oy = y 19 x = x + xinc 20 y = y + yinc 21 IF K1\$ = CHR\$(65) THEN 22 xinc = xinc + 1 23 END IF 24 IF K1\$ = CHR\$(66) THEN 25 yinc = yinc + 1 26 END IF 27 IF x <= 0 OR x >= 640 THEN 28 xinc = 0 - xinc 29 END IF 30 IF y <= 0 OR y >= 480 THEN 31 yinc = 0 - yinc 32 END IF 33 FOR delay = 0 TO 2000: NEXT delay 34 K1\$ = INKEY\$ 35 LOOP

I did this in class (while waiting for the teacher to get me my next course) on the DOS 6.22 system I installed

I wanted to do a pong clone but I didn't have enough time after figuring out the little bit of the language shown above

I'm sure You all say it's lame.. then show me your first QBASIC programs!

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

 Goalie Ca Member #2,579 July 2002 run this I've written two really good Qbasic games (tetris and breakout) that are actually "smooth".There is source code and "compiled" files on my site (see sig)This was some of my "early work" back when i was totally n00b. I don't have my earliest work because that all dissapeared with a format. but this is a recreation of my first program, with a twist. it became zelda instead of changing color padles. I submited it into the "lame game contest" at Justin's site. You can download it here http://diversedev.com/community/lamegames/files/zeldapong.zipIf you want a real laugh you should download this. It was written by BILL Gates to showcase the power of the original IBM pc and GW-Basic. I also submited this game on behalf of BG http://diversedev.com/community/lamegames/files/donkey.zip ------------- Bah weep granah weep nini bong!
 Matthew Leverton Supreme Loser January 1999 For some reason I'm having difficulties uploading, or else I'd link to it...The first program I wrote was almost 10 years ago. (Time flies!!!) I was 12-13 years old, somewhere in that range. Anyway, it was a monopoly game written in QBASIC. I didn't have any programming resources, just the QBASIC help file. No internet. Didn't know anyone who could program. It was frustrating. I actually started it in GW-BASIC, so there are a bunch of line numbers. Then I realised QBASIC came with the PC, and I was ecstatic. Especially once I figured out what SUBs and FUNCTIONs were. I can remember figuring out what an array was for the first time. Too bad I had already gone too far with:IF player\$ = a\$ THEN dola = dola + 100IF player\$ = b\$ THEN dolb = dolb + 100Which looking back, I suppose if you give both players the same name that bad things (TM) would happen, heh.
 DanTheKat Member #1,990 March 2002 PRINT "Hello World!" ---"Even the best spellcaster can't transmute bread into bread." - spellcaster
 Dark Member #749 November 2000 I wrote my first 320x200x256 rpg in qbasic.. had a world editor and everything done... then i saw djgpp/allegro and erased it I'm dumb! __________________________________Posting from outside Spellcaster's window...
 Thomas Fjellstrom Member #476 June 2000 heh. If you hold down one of the keys, the dot bounces on the side of the screen -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 Trumgottist Member #95 April 2000 I wrote the first version of Rocket Duel with QBasic. (Do you think the current RD is hard to play? This is twice as hard. A long game is one that lasts more than a couple of seconds, but we still had a lot of fun with it, my sister and I.) If anyone is interested: http://trumgottist.com/tmp/raket.bas Adjust the "FOR Delay = 1 TO 10000" things in Spela and Spela2 to fit your computer's speed. But at the very first encounter, I didn't know what QBasic was, nor had I any idea what programming was. I found Nibbles on my parent's computers hard drive and messed with it until I understood what it was doing.The first attempt I did was to add a third player. I searched for every occurence of "Sammy" and "Jake" (the names for the snakes) and where I found them together, I added a third name. I didn't work, of course. But eventually I understood what sammy(i) meant... The QBasic help file was very good! --"I always prefer to believe the best of everybody - it saves so much time." - Rudyard KiplingPlay my game: Frasse and the Peas of Kejick
 Thomas Fjellstrom Member #476 June 2000 Id test it.. But I don't have a QBASIC compiler or interereter for Linux.. Only on my School's Dos 6.22 drive.. (heh, we all get a removeable drive to play with, kinda neat) -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 Dark Member #749 November 2000 Add a defint A-Z. (Usually makes code run faster.) And if you add the interger symbol after all your ints, it will run even faster. To check keypressed you can use Select Case. I forget how to type it though.. I think```SELECT CASE (K1\$) CASE IS CHR\$(65) xinc = xinc + 1 CASE IS CHR\$(66) yinc = yinc + 1 END SELECT ``` __________________________________Posting from outside Spellcaster's window...
 Thomas Fjellstrom Member #476 June 2000 hmm. cool. thanks. would you belive that program took me 2 hours? heh. I had to reboot a few times.. Considering I got into a few endless loops that I couldn't figure out how to get out of. ja. the code I posted, is about the limits of my QBASIC knowlege -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 Dark Member #749 November 2000 I'm not sure why it goes faster. I think it has to do with checking a table of what type your variables are, and if you have the sign, it doesn't need to.An endless loop can be broken with CTRL-C or CTRL-BREAK.if you wanted to access a variable in a sub that was decalred in the main program, useSUB Something()shared var1,var2 __________________________________Posting from outside Spellcaster's window...
 Thomas Fjellstrom Member #476 June 2000 hmm.. I tried CTRL-C.. that never worked.. Coo. I'll make sure I try CTRL-BREAK next time. -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 Dark Member #749 November 2000 Does the PC speaker beep if you keep a key held down? __________________________________Posting from outside Spellcaster's window...
 Thomas Fjellstrom Member #476 June 2000 ja. but a really dull one like the buffer is full. -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 Dark Member #749 November 2000 use k1\$ = inkey\$ at the top before you check it's value, then after those lines, set it to k1\$ = "" will keep it empty and stop the beeps. (IIRC) __________________________________Posting from outside Spellcaster's window...
 Thomas Fjellstrom Member #476 June 2000 doh. I meant when in an endless loop, in that code, no it doesn't beep. -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 wolfman8k Member #508 July 2000 Check out my sweet QBASIC game:[url http://benny.kramekweb.com/quandary]It's not pure qbasic though. It uses the directqb(the allegro of qbasic) library which is written in assembly ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Machine Ball - Futuristic 3D Sport ]
 Wetimer Member #1,622 November 2001 I wrote a program in which you were the government. However, you could have no taxes and be spending lots of money while making a profitBecause of all the parking and speeding tickets! if(Windows.State = Crash) Computer.halt();
 Thomas Fjellstrom Member #476 June 2000 So what was the mortality rate in your prog? -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 23yrold3yrold Member #1,134 March 2001 I tried QBASIC once and sucked at it. Considering my luck there, it's a wonder I ever took on C++.My crowning acheivement was displaying a sprite of Darkwing Duck (which I was big on at the time ). But I couldn't move it or switch frames or anything. I think I was supposed to re-draw it using XOR to erase it, then draw the next sprite or something. I also remember trying to allocate space for the sprite using DIM or something and it kept telling me "not enough memory" or something, so I gave up (or something ).I wonder if I still have QBASIC on here; might be interesting trying to do something with it now that I'm a C++ badass .... --Software Development == Church DevelopmentStep 1. Build it.Step 2. Pray.
 nonnus29 Member #2,606 August 2002 I made a happy face move across the screen one time on a friends computer in 1997 or something. It would be to hard to do anything interesting without using some additional libs like wolfman pointed out.
 aybabtu Member #2,891 November 2002 My first QBASIC program is this:PRINT "You stink."ENDThat was when I was 11.Neat, huh.
 Thomas Fjellstrom Member #476 June 2000 My very first BASIC (of some sort) program was similar to that, and written on our Atari 2000 ```10 PRINT "You Suck" 20 GOTO 10 ``` -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 Matthew Leverton Supreme Loser January 1999 Ok, here's mine:It's compiled with QuickBASIC 4.5 for DOS. Runs fine in Windows though.
 Thomas Fjellstrom Member #476 June 2000 heh. coo. You gotta admit though, that for my first 2 hours EVER using/learning QBASIC, that that wasn't too bad -- Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]"If you can't think of a better solution, don't try to make a better solution." -- weapon_S"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730
 1   2  Go to: Allegro Development Installation, Setup & Configuration Allegro.cc Comments Off-Topic Ordeals The Depot Game Design & Concepts Programming Questions Recent Threads