Just ported this to the TI-83! Took me an hour to transplant code XD
qazz42 wrote:
Just ported this to the TI-83! Took me an hour to transplant code XD
The TI-83 non-plus? What did you do that for? - tifreak8x
- Guru (Posts: 11009)
- 26 Aug 2010 02:27:21 pm
- Last edited by tifreak8x on 27 Aug 2010 03:50:00 pm; edited 1 time in total
Yes, I highly recommend you list out variables, A-/theta/
I like to keep things simple though, so I use the same variables over and over for a lot of things.
K- getKey
W- While loops
F- For( loops
/theta/ or Z- variable used when going to a sub-program to tell the subprogram what you want done
A- Cursor location
And I have a list of temporary variables that does not store any important data at all, the data itself is expected to be obliterated after something else is run.
As to your code, you could have a simple 2 element list defining sprite size. Using the spaces will just eliminate the map segments that it takes over. You would need to then have a list of If:Output( to a certain extent to show which parts you want. Like how I did with the map in pokemon, sort of.
Say we have one Output that is the 'middle' of the sprite when a sprite height is odd, or the 'top-ish' if the height is even. It is in A
5->A
The sprite looks like this:
O
|
^
This is stored in Str1
We would have a list, L1 for the moment, that is {1,3-L1
Then the list of outputs. For the time being, let's limit the total height to 5.
If L1(2)=5:Output(A-2,X,sub(Str1,1,L1(1)
If L1(2)>=3:Output(A-1,X,sub(Str1,1+2(L1(1)(L1(2)>3))-(L1(1)(L1(2)>3)),L1(1
If L1(2)>=1:Output(A,X,sub(Str1,1+3(L1(1)(L1(2)>1))-(L1(1)(L1(2)>1)),L1(1
If L1(2)>=2:Output(A+1,X,sub(Str1,1+4(L1(1)(L1(2)>2))-(L1(1)(L1(2)>2)),L1(1
If L1(2)>=4:Output(A+2,X,sub(Str1,1+5(L1(1)(L1(2)>4))-(L1(1)(L1(2)>4)),L1(1
(Please note, this code is not tested, just what I was able to come up with off top of my head. It works on paper, just not tested on calc. I am sure it could be optimized into something a bit better, but for the sake of explaining how it could be done in it's simplest form, this should work.)
This of course needs to be in a loop and getKey implementation and all that.
I might get curious enough later to test out this theory. Of course you will need some more stringent limits inside the getKey code for displaying near the borders and such.
Any of the other BASIC coders have any thoughts?
Edit:
I just tried out the code above, it does not work for anything less than 5 rows at this point. Not really sure why, but it seems to handle the columns dynamically.
I like to keep things simple though, so I use the same variables over and over for a lot of things.
K- getKey
W- While loops
F- For( loops
/theta/ or Z- variable used when going to a sub-program to tell the subprogram what you want done
A- Cursor location
And I have a list of temporary variables that does not store any important data at all, the data itself is expected to be obliterated after something else is run.
As to your code, you could have a simple 2 element list defining sprite size. Using the spaces will just eliminate the map segments that it takes over. You would need to then have a list of If:Output( to a certain extent to show which parts you want. Like how I did with the map in pokemon, sort of.
Say we have one Output that is the 'middle' of the sprite when a sprite height is odd, or the 'top-ish' if the height is even. It is in A
5->A
The sprite looks like this:
O
|
^
This is stored in Str1
We would have a list, L1 for the moment, that is {1,3-L1
Then the list of outputs. For the time being, let's limit the total height to 5.
If L1(2)=5:Output(A-2,X,sub(Str1,1,L1(1)
If L1(2)>=3:Output(A-1,X,sub(Str1,1+2(L1(1)(L1(2)>3))-(L1(1)(L1(2)>3)),L1(1
If L1(2)>=1:Output(A,X,sub(Str1,1+3(L1(1)(L1(2)>1))-(L1(1)(L1(2)>1)),L1(1
If L1(2)>=2:Output(A+1,X,sub(Str1,1+4(L1(1)(L1(2)>2))-(L1(1)(L1(2)>2)),L1(1
If L1(2)>=4:Output(A+2,X,sub(Str1,1+5(L1(1)(L1(2)>4))-(L1(1)(L1(2)>4)),L1(1
(Please note, this code is not tested, just what I was able to come up with off top of my head. It works on paper, just not tested on calc. I am sure it could be optimized into something a bit better, but for the sake of explaining how it could be done in it's simplest form, this should work.)
This of course needs to be in a loop and getKey implementation and all that.
I might get curious enough later to test out this theory. Of course you will need some more stringent limits inside the getKey code for displaying near the borders and such.
Any of the other BASIC coders have any thoughts?
Edit:
I just tried out the code above, it does not work for anything less than 5 rows at this point. Not really sure why, but it seems to handle the columns dynamically.
tifreak, sadly, I have not used the sub command ever, I plan to learn more TI-BASIC once the contest is over....
sub( is easy enough to understand, though can get confusing sometimes.
sub(Str,start point,include how many characters
example:
sub("OH HI, I'M A DRAGON",4,6
Would post
"HI, I'"
The 6 tells the parser, how many characters to the right it should go. And it includes the starting point.
That help?
sub(Str,start point,include how many characters
example:
sub("OH HI, I'M A DRAGON",4,6
Would post
"HI, I'"
The 6 tells the parser, how many characters to the right it should go. And it includes the starting point.
That help?
qazz42 wrote:
o_O yes, I have been wondering a while what sub() did, thanks tifreak
Do you know about the related command inString() ? qazz42 wrote:
No... ;.;
No need to tell me though, I have tibasicdev
For everyone else, it's for finding if and where a string is in a same-sized or larger string. You can look for letters in a long string (for example, to convert letters to numbers without a massive string of If... statements), or you can search for substrings. No need to tell me though, I have tibasicdev
yeah, Ik now it is useful for maps
anywho, released it on ticalc
It is called "sprite demo"
posting link later
anywho, released it on ticalc
It is called "sprite demo"
posting link later
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
» Go to Registration page
» Goto page Previous 1, 2
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 2 of 2
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement