OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 28, 2024 4:32 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: QBASIC
PostPosted: Sat Jul 19, 2003 10:06 pm 
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


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Sun Jul 20, 2003 8:11 am 
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


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Mon Jul 21, 2003 10:37 am 
well, the line was nice, and I was kinda looking foward to sprites. so yah, sprites. ;)


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Fri Aug 01, 2003 3:40 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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:
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

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:QBASIC
PostPosted: Wed Aug 06, 2003 12:02 pm 
it says I need an end-of-statement command at the spots where there are underscores


??? help?


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Tue Aug 12, 2003 9:59 am 
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...


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Tue Aug 12, 2003 12:22 pm 
??? uh, I copied it down like it is.. therfore, im looking for a working code.. ):


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Tue Aug 12, 2003 2:04 pm 
This code isn't the full program you know... ::) It won't work when just pasted into program.


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Wed Aug 13, 2003 7:46 pm 
I didnt paste it.. I wrote the code into QBASIC and it still doesnt work


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Fri Aug 15, 2003 7:57 pm 
Here an example how to make sprites in qbasic:

Program 1: make a sprite and save it.
Quote:
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
Quote:
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


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Mon Aug 18, 2003 8:15 pm 
it highlights the second "Cube" and says "array already dimensioned"


??? I am really confused


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Mon Aug 18, 2003 10:55 pm 
Maybe you could try to run Program 1 before running Program 2... ::)


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Tue Aug 19, 2003 6:17 am 
I guess Dreadwing has put two programs in one file.

My 2 programs work separatly.


Robin Gravel


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Tue Aug 19, 2003 8:53 am 
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...


Top
  
 
 Post subject: Re:QBASIC
PostPosted: Sun Aug 24, 2003 10:49 pm 
Speaking of Qbasic, where could I get a good compiler?


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group