#1✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!HobbiesHow do i use DATA (and what ever els) to put a SP on screen?
This is what i mean.
DATA "B"
B is the bom sprite.
when i put a B In Those "" i want a bomb to show up on screen. and the X,Y is according to where in the "" its at.
Posted
#2✎ 188412Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourselfput a label before your DATAs, like this:
@LABELNAME
DATA "B",10000,"etc."
DATA ...
...
then use RESTORE @labelName to start reading the DATA at that label:
use READ variableName to read a single value from the DATA (you'll probably put it in some kind of loop)
you can also READ multiple values at once, like: READ firstVariable, secondVariable, ...
Posted
#3✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!HobbiesCould you possibly make a quick Program based on what i sed earlyer? Please?
Posted
#4✎ 188412Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfCan you give an example of what your DATA would look like?
Posted
#5✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!HobbiesWell I dont realy know...im new to working with DATA.
all i wont you to do is make a small program that places a sprite As may Bs i have in the "". like what the system Game Gunner uses.
Posted
#6✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!Hobbies12ME21?
Posted
Edited
by zagg2000
#7✎ 131raimondzFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthNight PersonI like the quiet night and sleep late.Express YourselfYou can set the definition number and the position on the data and the load it on other part of your code.
Example:
'Array that hold the sprites instances.
VAR sprites[0]
sprites=loadSprites()
'If you want to reload the sprites, then do the following
clearSprites sprites
sprites=loadSprites()
'================================================
DEF loadSprites()
VAR sprites[0]
VAR SP,DN,X,Y
RESTORE @SPRITES
WHILE 1
READ DN,X,Y
IF DN==-1 THEN BREAK
SP=SPSET(DN)
SPOFS SP,X,Y
PUSH sprites,SP
WEND
RETURN sprites
END
DEF clearSprites ARR[]
VAR SP
WHILE LEN(ARR)>0
SP=POP(ARR)
SPCLEAR SP
WEND
END
@SPRITES
DATA 0,200,100
DATA 1,80,80
DATA -1,0,0
Posted
#8✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!HobbiesDEF without END
Posted
#9✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!Hobbiesalso, where do i put the DATA "B" for the sprite?
Posted
#10✎ 131raimondzFirst WeekJoined in the very first week of SmileBASIC SourceWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthNight PersonI like the quiet night and sleep late.Express Yourself
DEF without END
I can't see your code but that means that you didn't close a DEF with an "END" sentence.
also, where do i put the DATA "B" for the sprite?
I didn't. You can't set a sprite with a string. (However, you can make a static map data structure to store sprite definition number(value) asosiated with strings(key).)
? spriteMap("B")
DEF spriteMap(S$)
IF !CHKLABEL("@"+S$) THEN RETURN -1 'NO RESULT
GOTO "@"+S$
@A
RETURN 0
@B
RETURN 1
END
Posted
#11✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!HobbiesWhat if i dont wanna print the RESULT?
Posted
#13✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!Hobbiesi did. it errored.
Posted
#14✎ 136zagg2000Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthThird YearMy account is over 3 years oldWebsiteVideo GamesI like to play video games!HobbiesNSEXX3KJ Please download this and look at the code.
Posted
#15✎ 254answerGreat PageHiddenAchievementsThird YearMy account is over 3 years oldWebsiteDeep SleepHiddenWebsite
Remove the question mark
i did. it errored.
You can't have a function with a return value and give it to nothing, something has to eat it
DEF EAT V:END
DEF myDEF()
RETURN 0
END
EAT myDEF()
Posted
Edited
by answer