Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: hellninjas on January 17, 2013, 01:42:09 am

Title: Picking back up my 84+SE
Post by: hellninjas on January 17, 2013, 01:42:09 am
I'm playing with Basic again, but want to go a little further into it.
I'm not to smart when it comes to these things, you'll know that from how many questions I ask xD
But i'd like to know how I could do things like tile-mapping, turning a matrix into some sort of inventory, actually USING the graph screen :P
If there's tutorials for all this, or if you don't mind posting some code with an explanation, i'd be grateful ^_^.
I've really only made menu based games, without using Menu(, but I know I could do something better :I
Title: Re: Picking back up my 84+SE
Post by: DJ Omnimaga on January 17, 2013, 02:01:01 am
I hope you return D: (I mean not doing a Comeback post only to leave immediately afterward :P)
Title: Re: Picking back up my 84+SE
Post by: hellninjas on January 17, 2013, 02:07:24 am
I'll be on the chat a lot more (Under the name Charty).
And I really want to get back into it, too. :C
Damn school blocking EVERYTHING D:<
Title: Re: Picking back up my 84+SE
Post by: TIfanx1999 on January 17, 2013, 02:29:46 am
Hey hellninjas. Good to see you around again. ^^ You shold post a project topic once you get going on this a bit.
Title: Re: Picking back up my 84+SE
Post by: DJ Omnimaga on January 17, 2013, 03:12:34 am
I'll be on the chat a lot more (Under the name Charty).
And I really want to get back into it, too. :C
Damn school blocking EVERYTHING D:<
Can't you use the forums at home too under mobile mode? I know your computer is bad but it can't be so bad that it can't even handle text-only pages. :P  http://ourl.ca/18029;imode (there's no image support, though)
Title: Re: Picking back up my 84+SE
Post by: Stefan Bauwens on January 17, 2013, 06:05:01 am
I'm not really too familiar with TI-Basic, but I understand the method you're talking about.
I'm not sure this may help you, but this is how I would read data, and draw them to the screen(general code):
Code: [Select]
[{1111111}
,{1000001}
,{1000001}
,{1000001}
,{1000001}
,{1111111}]->mat
(I write it like this, so that it obous it represents the map. However it may be that in TI-Basic you'll have to write it all on one line to make it work.)

For a,0,7
for b,0,6
If mat(a,b)=1 then
draw wallsprite
elseif mat(a,b)=0 then
draw floorsprite
...
endif
endfor
endfor
(I'm unsure if I mixed a and b up. I constantly switch coordinates.)
But I hope you understand the principle. ;)

Title: Re: Picking back up my 84+SE
Post by: Sorunome on January 17, 2013, 06:09:41 pm
like stefan said, only
matrixes do [A] (the token)
to get it
[A](a,b)
And 84 basic has only End
And only Else

And good to see you around again!
Title: Re: Picking back up my 84+SE
Post by: hellninjas on January 18, 2013, 12:46:38 am
Alright, that's done ^_^
Now, how would I go about checking the value of a space in a matrix that would keep my X and Y position from moving overtop of it?
I.E. if the value of the space is 1, don't move there.
Title: Re: Picking back up my 84+SE
Post by: Sorunome on January 18, 2013, 12:47:24 am
If [A](Y,X)=42
Title: Re: Picking back up my 84+SE
Post by: hellninjas on January 18, 2013, 12:54:46 am
I don't quite understand..

Code: [Select]
If K=24 and [A](Y,X)!=1
X-1->X
???
Also, could you explain the reversal of X and Y?
Title: Re: Picking back up my 84+SE
Post by: Sorunome on January 18, 2013, 12:56:45 am
it is first Y and then X because it is BASIC, in basic you generally say first the row and then the column.
So
[A](Y,X) returns what is in the matrix at (Y,X) and you can just do comparisons at it as if it was a normal variable then, or you can also store stuff in it like that.
Title: Re: Picking back up my 84+SE
Post by: hellninjas on January 18, 2013, 12:31:19 pm
Now, i've gotten changing matrix data all the way to creating and moving around on top of it.
How would I transition onto another matrix/tilemap?
Or does this look easier than it sounds? :P
Title: Re: Picking back up my 84+SE
Post by: DJ Omnimaga on January 18, 2013, 02:37:32 pm
You need to check if the character has reached the side of the map and is trying to move out. Then when you exit the map engine loop you increment/decrement a variable so you move to the next map spot, depending of which direction you go in, then you must re-enter the map loading code. I don't have any code, though, since I rarely used matrices in pure BASIC.

Also a matrix takes a lot of memory, so make sure to pay attention at your RAM if using them (or you can use ASM libs to copy archived programs to RAM)
Title: Re: Picking back up my 84+SE
Post by: hellninjas on January 18, 2013, 02:48:09 pm
What if I just used the same Matrix over and over?
Like depending on the value of M will depend on which map loads and displays.
Then the character placement.
Or just have a value put up in the matrix, where if the tile value 3 is stepped on and M is equal to a certain amount, just change the map value and re-run the map loading..
I might be over-complicating it though :I
Slow program is slow x3
Title: Re: Picking back up my 84+SE
Post by: Sorunome on January 18, 2013, 06:56:41 pm
Yeah, you could use one matrix over and over but i think that it is rather slow.
Title: Re: Picking back up my 84+SE
Post by: DJ Omnimaga on January 19, 2013, 12:26:47 am
What if I just used the same Matrix over and over?
Like depending on the value of M will depend on which map loads and displays.
Then the character placement.
Or just have a value put up in the matrix, where if the tile value 3 is stepped on and M is equal to a certain amount, just change the map value and re-run the map loading..
I might be over-complicating it though :I
Slow program is slow x3
Well a game with only 1 kind of map would be kinda boring I think :P. However if you mean like what I did in Mana Force then you should be fine :P