QBASIC

Programming, for all ages and all languages.
Dreadwing

QBASIC

Post 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
Robin_Gravel

Re:QBASIC

Post 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
Dreadwing

Re:QBASIC

Post by Dreadwing »

well, the line was nice, and I was kinda looking foward to sprites. so yah, sprites. ;)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:QBASIC

Post 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
Dreadwing

Re:QBASIC

Post by Dreadwing »

it says I need an end-of-statement command at the spots where there are underscores


??? help?
yan

Re:QBASIC

Post 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...
Dreadwing X

Re:QBASIC

Post by Dreadwing X »

??? uh, I copied it down like it is.. therfore, im looking for a working code.. ):
Eero Ränik

Re:QBASIC

Post by Eero Ränik »

This code isn't the full program you know... ::) It won't work when just pasted into program.
Dreadwing X

Re:QBASIC

Post by Dreadwing X »

I didnt paste it.. I wrote the code into QBASIC and it still doesnt work
Robin_Gravel

Re:QBASIC

Post 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
Dreadwing

Re:QBASIC

Post by Dreadwing »

it highlights the second "Cube" and says "array already dimensioned"


??? I am really confused
Eero Ränik

Re:QBASIC

Post by Eero Ränik »

Maybe you could try to run Program 1 before running Program 2... ::)
Robin_Gravel

Re:QBASIC

Post by Robin_Gravel »

I guess Dreadwing has put two programs in one file.

My 2 programs work separatly.


Robin Gravel
Eero Ränik

Re:QBASIC

Post 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...
mr-t

Re:QBASIC

Post by mr-t »

Speaking of Qbasic, where could I get a good compiler?
Post Reply