#1✎ 75GreedyGoat8Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthAvatar BlockI didn't change my avatar for 30 days.WebsiteDisguisedHiddenWebsiteI’m currently having trouble understanding some areas of the DATA command. I know how title DATA and map DATA works but I don’t know how it works whenever it just a bunch of numbers. I guess it would be easier if I knew the entire definition of DATA(maybe someone could tell me.) Anyway, here’s an example of what I’m not understanding.
SPDEF “@SPDATA”
@SPDATA
DATA 256,80,16,16,8,8,1
DATA 304,80,16,16,8,8,1
DATA 0,256,16,16,8,8,1
DATA ...
DATA ...
It’s something like that.
I was wondering how this worked and was trying to understand it so I could maybe use it in the future. Help is greatly appreciated, thank you.
Posted
#2✎ 256niconiiPower UserVideo GamesI like to play video games!HobbiesExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthDrawingI like to draw!HobbiesDATA itself is very simple, it's just a way to specify number or string data that can be read using a variety of commands (READ, COPY, SPDEF, etc.). DATA doesn't care about the format of the data you give it, what the data actually means depends on whatever happens to be reading the data. In other words, if you want to know how SPDEF uses DATA, you need to look at SPDEF's help info.
Here's an example of using DATA:
RESTORE @MYDATA 'Start reading from @MYDATA
READ X 'Read a number from data and set X to it
PRINT X 'Prints 123
READ X 'Read the next number
PRINT X 'Prints 456
@MYDATA
DATA 123,456,789
Note that DATA doesn't care if it's on separate lines or not. These are equivalent:
DATA 123,456,789
DATA 123
DATA 456
DATA 789
Posted
#3✎ 123kitesinpowerlinesAvatar BlockI didn't change my avatar for 30 days.WebsiteAvatar EmbargoI didn't change my avatar for 90 daysWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsite
I’m currently having trouble understanding some areas of the DATA command. I know how title DATA and map DATA works but I don’t know how it works whenever it just a bunch of numbers. I guess it would be easier if I knew the entire definition of DATA(maybe someone could tell me.) Anyway, here’s an example of what I’m not understanding.
SPDEF “@SPDATA”
@SPDATA
DATA 256,80,16,16,8,8,1
DATA 304,80,16,16,8,8,1
DATA 0,256,16,16,8,8,1
DATA ...
DATA ...
It looks like you have the correct way to call the @SPDATA label for definitions, but the DATA commands themselves looks like they don't hold enough information for the sprite definitions.
SPDEFs need the sprite number, U coordinate, V coordinate, width, height, origin X, origin Y, attribute (optional). You are missing a number.
Try this:
@SPDATA
DATA 0,256,80,16,16,8,8,1
DATA 1,304,80,16,16,8,8,1
DATA 2,0,256,16,16,8,8,1
DATA ...
DATA ...
The code above adds the sprite number at the beginning (starting with 0). Note that this will override the default sprite template so the default sprites for 0, 1, 2, etc will be whatever sprite you've defined it to be.
Posted
Edited
by kitesinpowerlines
#4✎ 75GreedyGoat8Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthAvatar BlockI didn't change my avatar for 30 days.WebsiteDisguisedHiddenWebsite Wow, thanks for the great information you guys! I now have a greater understanding of DATA. I mainly was confused with the “how do you know what to put and where to put it,” but now I pretty much understand. Thanks for the great information.
Posted
#5✎ 188412Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfThe correct way to use DATA for SPDEF is:
SPDEF @SPDATA
@SPDATA
DATA 3 'number of definitions
DATA 256,80,16,16,8,8,1 'definition 0
DATA 304,80,16,16,8,8,1 'definition 1
DATA 0,256,16,16,8,8,1 'definition 2
Also, don't listen to the manual when it says to use "@SPDATA" rather than @SPDATA, because they're exactly the same thing (In early versions of SmileBASIC, this didn't work)
Posted
The correct way to use DATA for SPDEF is:
SPDEF @SPDATA
@SPDATA
DATA 3 'number of definitions
DATA 256,80,16,16,8,8,1 'definition 0
DATA 304,80,16,16,8,8,1 'definition 1
DATA 0,256,16,16,8,8,1 'definition 2
Also, don't listen to the manual when it says to use "@SPDATA" rather than @SPDATA, because they're exactly the same thing (In early versions of SmileBASIC, this didn't work)
So how would I load the spdata on the screen and how do I save it as a sprite?
Posted