Page 1 of 2

QBASIC

Posted: Sat Jul 19, 2003 10:06 pm
by Dreadwing
I have been working with this and all, but im having a little problem with the graphics section.. can someone show me a GOOD tutorial on how to do this? thanks in advance

Re:QBASIC

Posted: Sun Jul 20, 2003 8:11 am
by Robin_Gravel
If you're new to qbasic programming, try this:

screen 1 ' select CGA 320x200 4 colors.
line (1,1)-(319,199),1
k$=input$(1)
end

if you wish, you can replace screen 1 by
screen 13 'MCGA/VGA 320x200 256 color

if you're talking about sprite, let me know.


Robin Gravel

Re:QBASIC

Posted: Mon Jul 21, 2003 10:37 am
by Dreadwing
well, the line was nice, and I was kinda looking foward to sprites. so yah, sprites. ;)

Re:QBASIC

Posted: Fri Aug 01, 2003 3:40 am
by Pype.Clicker
sprites can be programmed using GET (x1,y1)-(x2,y2), array and displayed using PUT(x,y),array [,mode]

i suggest you to read the qbasic doc for those "functions" to get more info about it. one of my favourite technique is to have 2 arrays for one sprite: one made of the sprite using 0 as transparent color, and one mask that has 255 for transparent and 0 for solid pixels. Once you have them, you can use full 255 color sprites on full 256 colors background.

Just apply

Code: Select all

PUT (x,y), background, PSET
x=newx
y=newy

GET (x,y)-(x+w,y+h), spr_background
PUT (x,y), spr_mask, AND
PUT (x,y), spr, OR

Re:QBASIC

Posted: Wed Aug 06, 2003 12:02 pm
by Dreadwing
it says I need an end-of-statement command at the spots where there are underscores


??? help?

Re:QBASIC

Posted: Tue Aug 12, 2003 9:59 am
by yan
i think you you made the .bas file using copy-paste so the basic source code seems like this:
[
GET (x,y)-(x+w,y+h), spr_backgroundPUT (x,y),spr_mask,ANDPUT (x,y), spr, OR
]

but not

[
GET (x,y)-(x+w,y+h), spr_background
PUT (x,y), spr_mask, AND
PUT (x,y), spr, OR
]

if so,try to chage it...

Re:QBASIC

Posted: Tue Aug 12, 2003 12:22 pm
by Dreadwing X
??? uh, I copied it down like it is.. therfore, im looking for a working code.. ):

Re:QBASIC

Posted: Tue Aug 12, 2003 2:04 pm
by Eero Ränik
This code isn't the full program you know... ::) It won't work when just pasted into program.

Re:QBASIC

Posted: Wed Aug 13, 2003 7:46 pm
by Dreadwing X
I didnt paste it.. I wrote the code into QBASIC and it still doesnt work

Re:QBASIC

Posted: Fri Aug 15, 2003 7:57 pm
by Robin_Gravel
Here an example how to make sprites in qbasic:

Program 1: make a sprite and save it.
DIM Cube(1 TO 675)
SCREEN 1
LINE (140, 25)-(140 + 100, 125), 3, B
DRAW "C2 BM140,50 M+50,-25 M+50,25 M-50,25"
DRAW "M-50,-25 M+0,50 M+50,25 M+50,-25 M+0,-50 BM190,75 M+0,50"
GET (140, 25)-(240, 125), Cube
DEF SEG = VARSEG(Cube(1))
BSAVE "CUBEVIO.GRH", VARPTR(Cube(1)), 2700
DEF SEG
END

Program 2: loading a sprite from a file
DIM Cube(1 TO 675)
SCREEN 1
DEF SEG = VARSEG(Cube(1))
BLOAD "CUBEVIO.GRH", VARPTR(Cube(1))
DEF SEG ' Restituer le segment BASIC par d?faut.
PUT (80, 10), Cube
END
Before i make AGI games, I make Qbasic games.
Even today, I'm still working on Qbasic games.

Robin Gravel

Re:QBASIC

Posted: Mon Aug 18, 2003 8:15 pm
by Dreadwing
it highlights the second "Cube" and says "array already dimensioned"


??? I am really confused

Re:QBASIC

Posted: Mon Aug 18, 2003 10:55 pm
by Eero Ränik
Maybe you could try to run Program 1 before running Program 2... ::)

Re:QBASIC

Posted: Tue Aug 19, 2003 6:17 am
by Robin_Gravel
I guess Dreadwing has put two programs in one file.

My 2 programs work separatly.


Robin Gravel

Re:QBASIC

Posted: Tue Aug 19, 2003 8:53 am
by Eero Ränik
Dreadwing, if you want to make anything in QBASIC, then you should know at least the basic commands, and when someone gives you an example, then go through it step by step, and when you don't understand something, then don't hesitate to ask... I see, that you don't understand absolutely anything from few last examples...

Re:QBASIC

Posted: Sun Aug 24, 2003 10:49 pm
by mr-t
Speaking of Qbasic, where could I get a good compiler?