Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
poke and pset
#1
is there any way to use poke or pset without using 4 for loops(one for x,y of sprite and map theres too much lag)

using data.get put this can be done with two for loops and theres no lag but i want to store tiles in a dat file and this cant use data statements i dont think.

im using vics tutorials as a base for graphics
Reply
#2
Is this a FB question? There is a section for that stuff.

PSET only needs X and Y loops. Color would need some kind of data read because you generally cannot define it in a loop.  I don't know what you mean by Data files. You can make data files using WRITE # to hold comma separated variables just like DATA statements.

What has a map got to do with the tiles? You can GET and BSAVE tile data in an array. Creating each tile at program start or during a program will definately slow things down. Try making the tiles first and saving them in BSAVE. Then you can BLOAD them at program start into a graphics array. You can store several tiles in one Array by indexing them.

Ted
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply
#3
i figured out the bsave way but i got a dos memory error and it crashes. how do i stop this?

i couldnt find any examples of how to use writeto make a sprite/tile using the pset read get thing that makes sprites. how do i?
Reply
#4
Memory use depends on the size of the program and the size of any Arrays. I usually use a graphics array of up to 27K. It can be reused for a number of BLOADs and PUTs.

If the module code is large, try breaking some of it up into real SUB procedures.
QB4.5 has a better track record than Qbasic for memory problems. You can also break the program into several modules and use CHAIN or LINK them together.

How large is the BAS file?

Ted
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply
#5
no just using sample in help and changed it to one sprite only
Reply
#6
Post your code and explain more please.
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply
#7
Waddaya mean? Just SAVE the BAS file AS Text readable by other programs. Open it  Notepad by right clicking it and EDIT in the mouse menu! I don't want to download files.

Ted
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip
Reply
#8
This is what i did for the bsave,bload thing and it causes the dos memory error sometimes 2nd or third load.


BSAVE

DIM sprite1(1 TO 675)
SCREEN 13

FOR y = 1 TO 13
FOR x = 1 TO 15
READ clr
PSET (x, y), clr
NEXT: NEXT
GET (1, 1)-(15, 13), sprite1

DEF SEG = VARSEG(sprite1(1))
BSAVE "sprite1.GRH", VARPTR(sprite1(1)), 2700
DEF SEG


'grass
DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
DATA 10,10,10,10,10,10,10,10,10,10,10,02,10,10,10
DATA 10,10,10,10,10,10,10,10,10,10,02,10,10,10,10
DATA 10,10,10,02,10,10,10,02,10,10,02,10,10,10,10
DATA 10,10,10,10,02,10,02,10,10,10,10,10,10,10,10
DATA 02,10,10,10,02,10,02,10,10,10,02,10,10,10,10
DATA 10,02,10,10,02,10,02,10,10,02,10,10,02,10,10
DATA 10,10,02,02,10,02,10,10,10,02,10,02,10,10,10
DATA 10,10,10,10,10,10,10,10,10,02,10,02,10,10,10
DATA 02,02,10,10,02,10,10,10,02,02,02,10,10,10,10
DATA 10,10,02,02,10,10,10,10,10,10,10,10,10,10,10
DATA 10,10,10,10,10,10,02,02,10,10,10,10,10,10,10
DATA 10,10,10,10,10,10,02,10,10,10,10,10,10,10,10

BLOAD

DIM sprite1(1 TO 60)
SCREEN 13
DEF SEG = VARSEG(sprite1(1))
BLOAD "sprite1.GRH", VARPTR(sprite1(1))
DEF SEG             
PUT (100, 10), sprite1


Reply
#9
tox_von :

I ran your program, exactly as you posted it.  The BLOAD program ran fine the first time, than it gave me an error, and I had to close QB down and start anew.

Now, I changed your first line from
DIM sprite1(1 TO 60)
to
DIM sprite1(1 TO 675)
and it ran fine eight times in a row!


Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#10
thanks i tried this and it worked

is this the best/stablist  way to do tiles or is there some other way more common people use?


i still dont know this question.
i couldnt find any examples of how to use write to make a sprite/tile using the pset read get thing that makes sprites. how do i?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)