Weekly Qbasic and Qb64 Lesson Topics
March 28, 2024, 06:09:09 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Labeling Data Bit maps

Pages: [1]
  Print  
Author Topic: Labeling Data Bit maps  (Read 552 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« on: February 04, 2011, 10:10:51 pm »

One thing I do not completely understand:
Quote
'Create the Hawk and rabbit sprites from data.
CreateSpriteFromData Hawk&, 23, 23
CreateSpriteFromData Bunny&, 16, 16
   
It appears to me, the Data Bit maps get identified by size, then they are named,... So what if one was useing 2 data bit maps, that were the same size, How would one go about "labeling" them ?
 Ok well thats my question,..
from Garry
Report Spam   Logged

Share on Facebook Share on Twitter

OlDosLover
Guest
« Reply #1 on: February 12, 2011, 02:44:26 am »

Hi all,
    In QBasic DATA is read from the first position that it finds in the BAS file. To read multiple DATA statements into different variables at different times one has to use the RESTORE command in conjunction with a label. Here's an example

Code:
REM
DEFINT A_Z

OPTION BASE 1
DIM FirstDim(4)
DIM SecondDim(6)

for t= 1 to 4
  read z
  FirstDim(t) =z
next t
'place this data onscreen
for t= 1 to 4
  Print   FirstDim(t)
next t
'read the second part of the data into the 2nd dim
'we must "RESTORE" to correct place
RESTORE Twice
For t= 1 to 6
 read z
  SecondDim(t) =z
next t
'place this data onscreen
or t= 1 to 6
  Print   SecondDim(t)
next t

SLEEP
SYSTEM

'----------- DATA STATEMENTS -----
DATA 1,2,3,4

Twice:
DATA 5,6,7,8,9,0

OlDosLover.
Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #2 on: February 17, 2011, 12:10:26 am »

Thanks Oldoslover, on this, also I looked at the wiki, under RESTORE, and got more details,..been wanting to do a small, "homework" project with 3 data files,...bit maps, and useing what I hopefully have learned so far,
the project, would be to load a background, the sprite 1, moveable with keys
sprite 2, the bunny ( or something) sprite 3,(same as sprite2,almost),results being 2 target sprites,...or maybe just one, is the one that can be caught, the other, is sort of a decoy, and can not be cught. So this was why I needed to find out more on labeling the data bit maps, of course, as in your demo, this can be applied to other types of data.
from Garry
Report Spam   Logged


Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy