Qbasicnews.com
April 21, 2018, 02:43:00 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Poll
Question: What challenge should the first one be about.  (Voting closed: September 07, 2002, 11:59:54 AM)
A game - 4 (57.1%)
Size based program - 2 (28.6%)
Other(please post below) - 1 (14.3%)
Total Voters: 7

Pages: 1 2 [3]
  Print  
Author Topic: New Challenge Forum  (Read 24882 times)
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #30 on: September 08, 2002, 06:20:05 PM »

Quote from: "wildcard"
Pseduo bad entry ;-)

Code:

SCREEN 13

time! = TIMER
DO: del = del + 1: LOOP UNTIL TIMER - time! > .05
time2 = TIMER

FOR i = 0 TO 360
DRAW "M160,100TA" + STR$(i) + "C0L5C0C15U10R10D10L10"
FOR dell = 0 TO del: NEXT dell
WAIT 986, 8
CLS
NEXT i


lol. that works, I guess. I read it as 'cube', not 'box', though... started digging up my trig rotations. sin and cos...
Logged

Hard Rock
I hold this place together
*****
Posts: 775


WWW
« Reply #31 on: September 08, 2002, 07:10:59 PM »

Wow..... someone actually knows how to use the DRAW command......

[edit] oh hey, 100 posts..... do i get money or anything?[/edit]
Logged

b]Hard Rock[/b]
[The Stars Dev Company] [Metal Qb flopped] [The Terror]
Stop Double Posts!
Whats better? HTML or Variables?
wildcard
*.*
Administrator
__/--\__
*****
Posts: 2365



« Reply #32 on: September 08, 2002, 07:29:03 PM »

Yeah, I prefer to take the easiest/simplest apporach ;-) 2D rotating.. 3d would probably have gone down well.

Quote
Wow..... someone actually knows how to use the DRAW command......


Back in my day... before we had libraries.. hehe nah I think I've just used qb for ages and have messed around a lot(hence no projects/products of mine available). The DRAW command can be very useful albeit annoying ;-)
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #33 on: September 08, 2002, 09:17:30 PM »

hahaha can you believe it? I first used the DRAW command instead of PUT for sprites HAHAHAHAHHAA I'll look for the code to show it to you.

ANd I only had a 486DX2/66Mhz running uncompiled QBasic 1.1... Imagine the speed Cheesy

heh, I mean BITMAP SPRITES!!
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #34 on: September 08, 2002, 10:06:48 PM »

Hey... I first used GW-basic on my dad's Business Depot fodder 486-33. And I tried to make it display some sprites with Draw, too. They were a six cell monochromatic animation of a man running that I found in a (really, really) old book.
Logged

BlueKeyboard
Wandering Guru
***
Posts: 337



WWW
« Reply #35 on: September 09, 2002, 09:10:06 AM »

Actually, a qb book I read, didn't even cover the put statement..., it seemed to focus more on using lines and circles :rotfl:...
Logged

na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #36 on: September 09, 2002, 09:56:54 AM »

Heh it is really weird. I had an editor which placed the cursor in the middle of the screen and opened a file for output. You could be in drawing mode or moving mode. You could move in 8 directions using the keys Q W E D C X Z A. When you pressed the numbers or shift+number you could choose a colour.

It worked this way: If you pressed "A" (LEFT), a "L1" was added to the file. If you pressed "E" (UP RIGHT), a "E1" was added to your file. If you pressed "SHIFT+6" (LIGHT YELLOW), a "C14" was added to your file. If you were in drawing mode, the strings were written without alter, but if you were in moving mode a "B" was put before the commands.

Then, in your game, you opened the file and loaded its contents to a variable, say o$. Everytime you wanted to draw a sprite, you PRESET to the position and called a DRAW o$.

It is the weirdest way to draw a sprite that I've seen... Still looking for the code.

Anyhow, now that we are on this topic: Let's write the weirdest PUT (bitmaps) replacement! I'll post mine (explained above) when I find it, or maybe when I recode it.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #37 on: September 09, 2002, 10:44:05 AM »

Oh - I should be editing... I forgot that there are people who hate double posts Cheesy Cheesy just kidding. Well, I found something. And I consider that it is cleaner to post it separately. It is sumthing like this:

The Editor

Code:

x% = 0
y% = 0
SCREEN 7
PRINT "Your drawing will be saved to a file."
PRINT "You may press 'S' to close the file and"
PRINT "EXIT."
INPUT "File Name"; n$
CLS
PAINT (0, 0), 15
OPEN n$ FOR OUTPUT AS #1
LINE (128, 0)-(128, 128), 0
LINE (0, 128)-(128, 128), 0
mode% = 0   ' Not Drawing
c% = 0
oc% = POINT(8 * x%, 8 * y%)
COLOR 7
LOCATE 19, 1: PRINT " MOVE:QWEDCXZA         "
LOCATE 20, 1: PRINT " COL:[SHIFT]+12345670  "
LOCATE 21, 1: PRINT " ENTER:DRAW|SPACE:MOVE "
DO
 
   IF NOT mode% THEN
      LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), oc%, BF
   ELSE
      LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), c%, BF
   END IF
 
   k$ = UCASE$(INKEY$)
   SELECT CASE k$
      CASE "W":
         IF y% > 0 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "U1";
            y% = y% - 1
         END IF
      CASE "E":
         IF y% > 0 AND x% < 15 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "E1";
            y% = y% - 1
            x% = x% + 1
         END IF
      CASE "D":
         IF x% < 15 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "R1";
            x% = x% + 1
         END IF
      CASE "C":
         IF x% < 15 AND y% < 15 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "F1";
            x% = x% + 1
            y% = y% + 1
         END IF
      CASE "X":
         IF y% < 15 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "D1";
            y% = y% + 1
         END IF
      CASE "Z":
         IF y% < 15 AND x% > 0 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "G1";
            x% = x% - 1
            y% = y% + 1
         END IF
      CASE "A":
         IF x% > 0 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "L1";
            x% = x% - 1
         END IF
      CASE "Q":
         IF x% > 0 AND y% > 0 THEN
            IF NOT mode% THEN PRINT #1, "B";
            PRINT #1, "H1";
            x% = x% - 1
            y% = y% - 1
         END IF
      CASE CHR$(13):
         mode% = -1
      CASE " ":
         mode% = 0
      CASE "1" TO "7", "0": c% = VAL(k$): PRINT #1, "C" + k$;
      ' This is mapped for Spanish keyboard.
      ' These are the symbols which can be gotten pressing the
      ' keys 1-7 and 0 with Shift.
      ' Change for your keyboard layout.
      CASE "!": c% = 9: PRINT #1, "C9";
      CASE CHR$(34): c% = 10: PRINT #1, "C10";' ["] character = 34.
      CASE "": c% = 11: PRINT #1, "C11";
      CASE "$": c% = 12: PRINT #1, "C12";
      CASE "%": c% = 13: PRINT #1, "C13";
      CASE "&": c% = 14: PRINT #1, "C14";
      CASE "/": c% = 15: PRINT #1, "C15";
      CASE "=": c% = 8: PRINT #1, "C8";
      CASE "S": EXIT DO       ' GOTO Fin, originally

   END SELECT

   oc% = POINT(8 * x%, 8 * y%)
   IF mode% THEN
      LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), c%, BF
      LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), 15 - c%, B
   ELSE
      LINE (8 * x%, 8 * y%)-(7 + 8 * x%, 7 + 8 * y%), 15 - oc%, B
   END IF

LOOP
Fin:
CLOSE #1
SYSTEM


The SUB which draws it

Code:

DECLARE SUB SCRPUT (x%, y%, o$)
' SPRPUT.BAS
SCREEN 7
INPUT "Sprite filename"; sp$
OPEN sp$ FOR INPUT AS #1
LINE INPUT #1, o$
PRINT "DRAW COMMAND:"
PRINT o$
PRINT : PRINT "PRESS A KEY"
SLEEP: k$ = INKEY$: CLS : PAINT (0, 0), 15
CLOSE #1
WHILE INKEY$ = ""
x% = INT(RND * 320)
y% = INT(RND * 200)
SCRPUT x%, y%, o$
WEND

SUB SCRPUT (x%, y%, o$)
   PRESET (x%, y%)
   DRAW o$
END SUB


Sample sprite
(Cut and paste to notepad, REMOVE THE LINE BREAKS [it should be in ONE SINGLE LINE!!] then save it as sprite.spr, and load it from the previous code) (I've broken the lines 'cause the whole thing screwed the forum layout)

Code:

BF1BF1BF1BF1BR1BR1BR1BU1BL1R1R1R1D1L1C12L1L1D1L1R1R1
R1D1L1L1U1U1C7R1C10C12R1C7F1C8D1D1C4F1F1R1L1H1H1L1
L1L1G1L1H1H1F1F1R1E1R1D1D1D1R1U1U1R1D1D1D1C2L1L1G1
G1D1D1C6L1L1R1U1R1C2U1E1E1R1R1D1D1F1R1C6R1D1U1U1


Weird, isn't it?
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
BlueKeyboard
Wandering Guru
***
Posts: 337



WWW
« Reply #38 on: September 09, 2002, 01:39:18 PM »

Yeah...
Logged

BlueKeyboard
Wandering Guru
***
Posts: 337



WWW
« Reply #39 on: September 09, 2002, 03:20:04 PM »

I made a weird kind of put routine once, it used "compressed" sprites...
It wasn't working very good, though :lol:.
I can't find the code for it...
Logged

BlueKeyboard
Wandering Guru
***
Posts: 337



WWW
« Reply #40 on: September 09, 2002, 03:20:40 PM »

wow!!!!!, I'm a Guru!!!!  Cheesy  Cheesy  Cheesy  Cheesy
Logged

wildcard
*.*
Administrator
__/--\__
*****
Posts: 2365



« Reply #41 on: September 09, 2002, 04:44:00 PM »

Quote from: "BlueKeyboard"
wow!!!!!, I'm a Guru!!!!  Cheesy  Cheesy  Cheesy  Cheesy

Not for much longer ;-) heh
Logged
BlueKeyboard
Wandering Guru
***
Posts: 337



WWW
« Reply #42 on: September 09, 2002, 06:33:02 PM »

Cooooool, "Surfing Keyboard" Cheesy
Logged

LooseCaboose
I hold this place together
*****
Posts: 981



« Reply #43 on: September 09, 2002, 07:23:03 PM »

Heres a challenge for your skills at programming. Hopefully this isnt too easy and yes I do have a solution for this already:

You are to write a program that has a produces a textmode triangle for any given number i. The output should look like the following:

i = 3
#
##
###
##
#

The trick is you are only allowed one loop(for, while, etc) and one if statement, you cannot use anything else (such as switch, else, etc). You also cannot use hardware calls such as peek and poke.
BTW, I think the peek/poke challenges are a bit boring because they test hardware knowledge rather than programming skill. *Ducks and covers*
 :roll:
Logged

esus saves.... Passes to Moses, shoots, he scores!
wildcard
*.*
Administrator
__/--\__
*****
Posts: 2365



« Reply #44 on: September 09, 2002, 07:41:04 PM »

I've locked this topic and started a new thread for the current challenge. Otherwise this thread would become enourmous. I'll make another thread for you to post your challenges in and I'll post them one by one.
Logged
Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!