Qbasicnews.com

Full Version: I need help with Sprite making
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3

oracle

Umm, I am a newbie at qbasic programming, and I need to know who to make a sprite faster then just putting a pixel on the screen over and over by using PSET. I need to make many characters to my game and it will take forever putting a dot on the screen to make shapes.

thanks
Well, the fastest you could get is using a library, but you probably won't need that for something simple.
What you're probably looking for is GET and PUT.
First you'll need an array the size of your image, in pixels. So let's say we have an image, a 10x10 image. First you draw that image on the screen, then you GET it, then you PUT it.
Code:
SCREEN 13
LINE (10,10)-(20,20),2,BF  '10x10 filled green box
'Now we need an array to hold our image, which is 10x10, which is 100 pixels:
DIM MyPic (100) AS INTEGER
'GET our image. It's located at (10,10), and finishes at (20,20):
GET (10,10)-(20,20),MyPic  'MyPic is our array, remember?
'Now we can PUT it anywhere we want. The coordinates given to PUT indicate the where the 'top-left pixel of the image is to be drawn:
PUT (50,50),MyPic
That's a simplified little tutorial on GET and PUT. Hope you understood it alright.
well welcome to the forum!
anyway, have you tried bitmapping?
like
Code:
SCREEN 13
FOR y = 1 TO 10
FOR x = 1 TO 10
READ a
PSET (x, y), a
NEXT x, y

DATA 1,1,1,1,1,1,1,1,1,1
DATA 1,0,0,0,0,0,0,0,0,1
DATA 1,0,1,1,1,1,1,1,0,1
DATA 1,0,1,0,0,0,0,1,0,1
DATA 1,0,1,0,1,1,0,1,0,1
DATA 1,0,1,0,1,1,0,1,0,1
DATA 1,0,1,0,0,0,0,1,0,1
DATA 1,0,1,1,1,1,1,1,0,1
DATA 1,0,0,0,0,0,0,0,0,1
DATA 1,1,1,1,1,1,1,1,1,1
edit: and getting and putting?
Yup, you could do that, but there is a better option:
If you want to actually get the best from spriting, you might want to get a sprite editor (Like PixelPlus256, available at The Geekery, just click the image in my signature), and then draw your image. After that, go to File-save as, and save the image with a name like mypic.bsv or whatever.
After that, in your program:
Code:
'If we've made a 10x10 image and saved it as MyPic.bsv:
Dim MyPic(100) AS INTEGER
DEF SEG=VARSEG(MyPic(0))
BLOAD "MyPic.bsv",VARPTR(MyPic(0))
'Now we can just PUT our image, the regular way:
PUT (15,15),MyPic
Cool, huh? That's how you achieve advanced spriting with QB.
Quote:Umm, I am a newbie at qbasic programming, and I need to know who to make a sprite faster then just putting a pixel on the screen over and over by using PSET. I need to make many characters to my game and it will take forever putting a dot on the screen to make shapes.

thanks

Send me a dollar and I'll help you Tongue
Trickery isn't very welcome here, Xeko. :evil:
Now I just think what you're doing is a scam - it doesn't make me want to buy your game any more.
Quote:Now I just think what you're doing is a scam - it doesn't make me want to buy your game any more.
Zack, if u buy anything from this guy I will personally fly over to your home and spank you.... :wink: Don't pay any attention to that freak.
Quote:
Quote:Now I just think what you're doing is a scam - it doesn't make me want to buy your game any more.
Zack, if u buy anything from this guy I will personally fly over to your home and spank you.... :wink: Don't pay any attention to that freak.
I wasn't planning on it, anyway. :wink: But if that guy thinks it will encourage people send money...he's just demented. Tongue
Wow, cant believe i didn't catch the same birthdays.... hmm.....
Isn't this in the wrong forum to?... lol

This seems to me like a general or newbi question, not a projects post.

but that's just me...


I usually don't go around throwing crap at people, but is he going to get away with this? He has been doing a lot of errors now, more than you'd expect, even from a total "I've never used the internet nor a forum before" noob.
Pages: 1 2 3