game question

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
Blorg
game question

Post by Blorg » Wed Feb 09, 2005 8:54 pm

Hi im super stumped on this problem. How can I upload a picture that I drew in paint to qb. All my classmates recomend doing pset to draw the picture, but since I'm not too crazy about typing for 30min a stupid pset code I'm hoping someone will help me out.

Blorg

game question

Post by Blorg » Wed Feb 09, 2005 9:17 pm

Just wanted to post the code that i did so far. I dont know if its right or if it works for that matter. When i ran it it made no error so im guessing its ok. If it does work i need to know how to get it to the screen, if it dosnt can someone plz show me how to fix it.

CLS
SCREEN 12
OPTION BASE 1

CONST file$ = "c:\pic.bmp"
port = 1

OPEN file$ FOR INPUT AS #port

WHILE NOT EOF(port)
INPUT #port, num
count = count + 1
WEND

DIM pic(1 TO count, 1 TO count)

CLOSE port
OPEN file$ FOR INPUT AS #port

FOR x = 1 TO count
FOR y = 1 TO count
INPUT #port, num
pic(x, y) = num
NEXT y
NEXT x



END

Thx In Advance (oh and srry the indentations didnt work so it might look messy)

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Thu Feb 10, 2005 9:56 pm

Just to let you know that, when posting or replying, there is a list at the top, which inlcudes Code. If you press Code and then enter your code, ending with pressing the *Code button, you will get your code very nicely displayed. Try it, next time you want to show your code.
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Fri Feb 11, 2005 1:25 am

Well, if it's a windows bitmap file that you're loading, that wont work because the .bmp format is a little more complicated. If you wanna get started making games very easily in QB, you should try one of the libraries. Here's a link to Piptol's site. He has the best of the best of QB libraries.

http://piptol.qbasicnews.com/

I would reccomend that you try DirectQB first. It's the easiest to use and extremely well documented. You can do things like instantly load bitmaps, rotate sprites, check for sprite collisions, check for multiple Keys, all pressed at the same time, use offscreen buffers, etc... I can help you set up QB for running it, if you want. Just post here again if you have trouble. ;)
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

Guest

Post by Guest » Sun Mar 20, 2005 10:04 pm

you can also create a sequential file of data with the picture (ie the colours)

lets say its a blue arrow (what i had in my game)

001111100
001111100
001111100
001111100
011111110
001111100
000111000
000010000

after you have that (its easier if you do grid view in paint) and then you just press enter until its all one set and then you can read it as a sequential file, pop it into an array, and use GET/PUT to put it wherever you want...

Post Reply