Thanks Man! :D I will get to it soon I'm learning "To Loves End" On the piano <3
How Do You Use Arrays?
Root / Programming Questions / [.]
AlicekittyCreated:
Here's the sprite collision sprite stuff explanation thing: N3KX14MD
i actually have a platform engine i made today. its a basic engine using DATA to draw My BG platforms. it has a sprite that you move using The joystick. has full animation sprites. also a jump function. your pleased to use it in any platform game you want! interested?That's pretty cool! Maybe you could teach me how to use DATA, haha. If you don't think you're good at it I'd still like an example or something so I can try it out for myself. And yes, I'd like to try it out! :)
ok, since your new at DATA i'll explain what its good for. DATA Is mainly used for Dialogue, and holding sting arrays. but its also used for drawing maps!
so this is how you'd use it for a string/array.
RESTORE @SPDAT READ SP,SPD,SPX,SPY 'SP Is the management number 'of the sprite. SPD Is the sprite definition number. 'SPX Is the sprites X position. SPY Is the sprites Y 'position. SPSET SP,SPD SPOFS SP,SPX,SPY @SPDAT DATA 0,500,165,140SP is the 0. SPD is the 500. SPX is the 165. SPY is the 140. Try righting this down in smileBASIC And experiment with it. all so you can use DATA to hold Text STRINGS. This is how.
RESTORE @STR READ X,Y,STRI$ LOCATE X,Y:PRINT STRI$ @STR DATA 18,15,"Dialogue"Now lets explain how restore works. Restore Basically tells smileBASIC wich Data to read 1st. this is useful for when your using lots of DATA in your program. When using restore it'll read whatever DATA is closest to the @ label. NOTE. the @ label on restore must be the same as the @ label to the DATA. You can also put DATA into an array. let us see how.
DIM ARRAY[4] RESTORE @LAB COPY ARRAY,"@LAB" SPSET ARRAY[0],ARRAY[1] SPOFS ARRAY[0],ARRAY[2],ARRAY[3] @LAB DATA 2,6,25,102This code COPYS The DATA and puts it into all 4 arrays. Try experimenting with all of this. Hopefully it all works. this is all done off by memory, so tell me if anything doesn't work.
Hey zagg2000, Can you tell me how I can save string Arrays using DATA? I want to know how I can save (Name,address, and country in the same file without having to save three different text files :)
You don't save string arrays to a file with DATA. You save string arrays with SAVE. The built-in help for SAVE should be enough to get you started.
Sorry. Is there a way I can save data to a file using the DATA command because I have seen some programs that save files with DATA commands in them :D
Sorry. Is there a way I can save data to a file using the DATA command because I have seen some programs that save files with DATA commands in them :DIf you mean, DATA commands in the programs, then yes, there are programs which have both DATA commands in them and SAVE commands in them. The DATA commands are for embedding constant values within the program, the SAVE commands are for saving values in another file. If you mean, DATA commands in the save files, that is possible, but usually not the best way to do things. Every program file is essentially a text file, and it is possible to save a text file which looks like another program. That other program can have whatever commands you want, including DATA commands. Either way, SAVE and DATA function differently. You cannot use one to do the work of the other.
Thanks for the info man! :D
Awesome Thank you Nathaniel :D
Awesome Thank you Nathaniel :Dsorry i didn't get to you sooner. there are many ways as to saving DATA and reloading it later on in other programs. this is just 1 way. rite any DATA you want. then save the program as DATA. Go to Direct mode and put NEW run and go back to EDIT mode. And do this.
use 1 LOAD"PRG1:DATA",0 READ X,Y,SP,SPD,SoOnthis code should load your saved DATA into slot 1. and read it from slot 1 as well.
Wow Thank you very much, this information will be very useful for the future of my programs in terms of not having a gazillion files lol :D
this is just 1 way. rite any DATA you want. then save the program as DATA. Go to Direct mode and put NEW run and go back to EDIT mode. And do this.Nope, that will not work. You also need a label, before the DATA, say @D. And then before the first READ, you need RESTORE "1:@D".use 1 LOAD"PRG1:DATA",0 READ X,Y,SP,SPD,SoOnthis code should load your saved DATA into slot 1. and read it from slot 1 as well.
didn't add that because it would be to confusing to explain. but yes. thats true.this is just 1 way. rite any DATA you want. then save the program as DATA. Go to Direct mode and put NEW run and go back to EDIT mode. And do this.Nope, that will not work. You also need a label, before the DATA, say @D. And then before the first READ, you need RESTORE "1:@D".use 1 LOAD"PRG1:DATA",0 READ X,Y,SP,SPD,SoOnthis code should load your saved DATA into slot 1. and read it from slot 1 as well.
Less confusing than explaining how doing "do this" gives errors, or otherwise doesn't work?didn't add that because it would be to confusing to explain.... do this.... You also need ......
would be alot easyer to just make a samll program doing so and uploading it, SquareFingers.No, it would have been easier to post code that I hadn't even tested would work.