Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: pimathbrainiac on December 18, 2012, 02:34:52 pm
-
(http://img.removedfromgame.com/imgs/TEST.gif)
Well, I have the basics down: here's my code (copied from graph link, so there are still weird chars):
.TILEMAP
ExprOn
[020202020202020202020202]üGDB1
[020000000000000000000002]
[020000000000000000000002]
[020000000000000000000002]
[020000000000000000000002]
[020000000000000000000002]
[020000000000000000000002]
[020202020202020202020202]
[7E7E427EFF7E7E42]üPic1
[FFFFFFFFFFFFFFFF]
[55AA55AA55AA55AA]
0ü{L+0}
0ü{L+1}
Repeat (getKey(15))
sub(Á)
If (0)
Lbl Á
If ((getKey(1)) and (pxl-Test(48,40)õ=0))
{L+1}-1ü{L+1}
Pause 250
End
If ((getKey(4)) and (pxl-Test(48,31)õ=0))
{L+1}+1ü{L+1}
Pause 250
End
If ((getKey(2)) and (pxl-Test(47,32)õ=0))
{L+0)+1ü{L+0}
Pause 250
End
If ((getKey(3)) and (pxl-Test(56,32)õ=0))
{L+0}-1ü{L+0}
Pause 250
End
Return
End
ClrDraw
ClrDrawõ
For(X,0,11)
For(Y,0,7)
If {(Y*12)+X+GDB1}
Pt-On((X*8)+({L+0}*8),(Y*8)+({L+1}*8),({(Y*12)+X+GDB1}*8)+Pic1)
Pt-On((X*8)+({L+0}*8),(Y*8)+({L+1}*8),8+Pic1)õ
End
End
End
Pt-On(48,32,Pic1)
DispGraphClrDraw
End
My problem (the tutorials aren't really helping):
How do I do this type of tilemap WITHOUT rendering the ENTIRE map every step taken?
Example (hypothetical): I have a 96x144 tilemap and want to only render the 8x12 in the tilemap that should be visible.
-
I think it's ok as it is now
The
For(X,0,11)
For(Y,0,7)
If {(Y*12)+X+GDB1}
Pt-On((X*8)+({L+0}*8),(Y*8)+({L+1}*8),({(Y*12)+X+GDB1}*8)+Pic1)
Pt-On((X*8)+({L+0}*8),(Y*8)+({L+1}*8),8+Pic1)õ
End
End
End
makes it so that it starts at X and Y, and then maps 8 tiles down and 12tiles right...
So it's always 8*12
Tho the IF statement isn't nescecarry... if you change your pt-on statement a bit, you've got it without the extra (memmory taking...) if-statement
EDIT: also, if you'dd drew the sprite 1 time... then storepic L3
and then every loop, before the map routine, do recalpic L3 ... then you don't need the ClrDraw and you don't have to loop through the draw command anymore... which will save a little speed (only a tiny bit)
-
but when I add a 13th column and change the (Y*12)s to (Y*13)s and nothing else, It only renders the initial screen, and not the 13th column when I move.
-
That's because in the For loop you'll have to change the X range from 1 to 12.
-
but when I change it to For(X,{L+0},{L+0}+11) It get weird when I move
-
Use something like:
for(X,0,11)
For(Y,0,7)
pt-on(X*8,Y*8,{<number of rows> * C + D + GDB0}*8+Pic0)
End
End
GDB0 = mapdata
Pic1= all the tiles...
C = 'X'-var (if moved right, raise one, if moved left, lower 1, initialise with 0 (or whatever row you wanna start on))
D = 'Y'-var
Set up pic0 like this
[0000000000000000]->pic0
[FFFFFFFFFFFFFFFF]
That means, if the map says 00 , it will pic the 0*8 +pic0 tile, which is the empty one
And if map says 01 , it will take the 1*8+pic0 tile, which is the full black one
Do you get it?
Any questions? (If there's a misstake, it's from the head + on ipod)
-
Well, using your solution, and by surrounding my map with null bytes, IT WORKED!!! :w00t:
-
You're welcome , first time i was able to help someone here on omnimaga :D
-
If your using greyscale you have to do +16 instead of +8.
-
Not greyscale (yet)
-
*bump*
Is it okay if I use this awesome code for a roguelike Im making? I was looking for a tutorial JUST LIKE THIS and I found it here!
Thanks!
-
Hi,
I think it should be fine as long as you give the author credits.