Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: saintrunner on November 23, 2011, 09:11:40 pm

Title: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 09:11:40 pm
So I've read the tutorial here on Omnimaga, but I still don't get it!
Can someone make a quick tutorial on tile mapping? I'd like to implement this into some of my games, and any help is appreciated! :w00t:
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 09:22:17 pm
Okay, very quick (basically commented code): Say what part you don't get.
Code: [Select]
[01010101]->GDB1   ;this is the tilemap in hexadecimal code.
[01000001]
[01010001]
[01000001]
(Some sprite data to pic1 here)
for(b,0,3)   ;outer loop for drawing the different columns
for(a,0,3)   ;inner loop for drawing the rows
{B*4+A+GDB1}->T  ;gets the tile number minus 1 to T
if T ;checks if a tile should be drawn
T--
pt-on(a*8,b*8,T*8+pic1)   ;draw the tile
end
end
end
That are the basics of the tilemap drawing code.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 09:28:14 pm
I think I get that thanks!
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 09:28:51 pm
If you experience any problems please ask.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 09:35:46 pm
ok I'm having trouble understanding the for(
could you go into more detail on what they are for and what they do?
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 09:39:53 pm
A for loop repeats until the variable specified reaches the second number (it adds one to the variable each time a loop is ran)
For(variable, start, stop)
so for(a,0,3) will loop from a = 0 to a = 3. The best thing is that you can access the variable inside the loop.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 09:44:16 pm
{B*4+A+GDB1}->T  ;gets the tile number minus 1 to T
T--
if T
pt-on(a*8,b*8,T*8+pic1)

can you now explain this? And thanks so much btw, no one has explained it to me this well yet and we are just getting started!
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 09:53:19 pm
ok.
Wait, I made a stupid mistake
Code: [Select]
T--
If T
should be
Code: (fixed) [Select]
if T
T--


{B*4    ; B is the row number counted from zero, 4 is the width of a row
+A        ; A is the column number (sorry for being wrong there)
{B*4+A  ;gets the tile number counted from upper left.
+GDB1}  ;GDB1 is the pointer to the tilemap.
->T    ;store the number that this returns in T
If T   ; only draw a tile when T is not zero (zero means no sprite)
T--   ;subtract one from T to get the tile number
pt-on(a*8,B*8,  ;draws the sprite at a*8,b*8
T*8   ;multiplies T by 8 since one sprite is 8 bytes
+Pic1  ;Pointer to sprite data

I hope it is clear now ;D


T--    ;subtracts one from T so you do not have to draw
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 09:59:13 pm
Yeah that helps a lot! One more thing so I can be sure I understand all this....Can you make a quick source code that implements this? It could just be a ball moving a crossed a platform or something. You don't have too but it would be VERY helpful since I'm a visual learner, :)
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:03:31 pm
Hmmm...
You can just play around with this code, throw it in a repeat getKey(15) loop, and add Dispgraph:ClrDraw after it. You can for example change numbers in the map (Create some sprites before and put them in Pic1).
Or try to figure out how to draw a 5x4 map instead of a 4x4. The possibilities are endless.
(if you really want I will create a program but not now since I am a bit tired)
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 10:04:58 pm
ok thanks! :)
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:26:16 pm
Would 01 be
[stuff]->Pic0
[THIS ONE]
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:29:51 pm
No. 01 would be
[THIS ONE]->pic1
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:31:55 pm
So then instead, 10
Would be what i said before?
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:33:47 pm
You might mean 01.
And no, since you subtract 1 from the sprite number, the 1 is 0 and so on.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:36:28 pm
So It seems like I misinterpreted the other guy's tutorial and Im now back to confusion.  :P
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:37:55 pm
No. You did not, since I use a slightly faster way to draw a map: If there is a zero, draw no tile. Gives a speed gain :D
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:39:32 pm
Uh.... So then how does the mapping work?
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:41:18 pm
In words:
Loop through the map.
Check if there is a tile.
If there is , subtract 1 from the tile number and draw the tile
end
end
end
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:42:46 pm
No the part before that with the gdb
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:44:19 pm
Oh that.
Just easy: add 1 to all tile numbers then type all the tile numbers in in hexadecimal.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 10:45:09 pm
:.TILE
:Repeat getKey(15)
:[01010101]→GDB1  
:[01000001]
:[01000001]
:[01010101]
:[FFFFFFFFFFFFFFFF]→Pic1
:For(B,0,3)   
:For(A,0,3)   
:{B*4+A+GDB1}→T   
:If T
:T--
:Pt-On(A*8,B*8,T*8+Pic1)   
:End
:End
:End
:DispGraph
:ClrDraw
:End


so this is my code for my tile practice, and as you see it displays a box in the upper left hand corner of the screen, but I can't figure out how to make this a bigger box! What do I adjust?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:47:42 pm
Oh that.
Just easy: add 1 to all tile numbers then type all the tile numbers in in hexadecimal.
But it's still the part that confuses me the most
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:47:53 pm
Wait, take the data parts out of the loop.
so
(blargh)->pointers
repeat getkey (15)
for a,0,3
etc.

What should you modify?
The map and
:For(B,0,3)      ;max number is number of rows minus one
:For(A,0,3)      ;max number is number of columns minus one
:{B*4+A+GDB1} ;max number is number of columns

Try to make the box 5*5.
Title: Re: Axe tile mapping! HELP!
Post by: mrmprog on November 23, 2011, 10:48:11 pm
Will this help? http://omniurl.tk/11593/211160
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 23, 2011, 10:51:13 pm
ok so


:.TILE
:[01010101]→GDB1 
:[01000001]
:[01000001]
:[01010101]
:[FFFFFFFFFFFFFFFF]→Pic1
:Repeat getKey(15)
:For(B,0,3)   
:For(A,0,3)   
:{B*4+A+GDB1}→T   
:If T
:T--
:Pt-On(A*8,B*8,T*8+Pic1)   
:End
:End
:End
:DispGraph
:ClrDraw
:End


ok now how do I make a bigger box?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 10:52:44 pm
So If I had
[border]->Pic1
[grass]

How would I make a simple thing to make a border on the outside and grass on the inside. (just the beginning pic and gdb stuff)
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 10:53:07 pm
Change (for example)
[01010101]

to
[0101010101]

and change
for(a,0,3)
to
for(a,0,4)

and
{B*4
to
{B*5

that does the trick, now try to figure out how it works!



Epic:
It would be (3*3 map)
[010101->GDB1
[010201
[010101
but in this case, there is no whitespace so you could leave the if T:T-- part out and subtract one from your tile numbers.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 11:03:49 pm
So how do you know which 2 numbers to use with the pics?
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 23, 2011, 11:05:24 pm
basically if you have empty tiles you add 1 to all numbers and later on use the if T:T-- trick, if you do not, you count from zero and leave if T:T-- out.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 23, 2011, 11:07:13 pm
*facepalm*

I just want to know what 2 numbers represent each pic, unless I'm understanding the whole thing wrong.
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 02:02:53 pm
Hey same for me too. I kinda get it but not really sure either.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 02:05:07 pm
I think I get it! :)
So I can try and answer some questions, I probably won't know all of it but I was able to put tiles in my program (by the way go check out the FADE thread!)
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 24, 2011, 02:05:34 pm
Nice! Glad I was clear!
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 02:08:08 pm
yeah you helped a lot!
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 03:05:06 pm
What I don't understand is after I have added a whole bunch of pics, how I put them into a GDB.
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 03:16:59 pm
I'm not sure if this has been mentioned, but I'm more concerned with saving space defining 50+ sprites/tiles
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 03:59:50 pm
I think thats the only way to tile map, unless of course you save it all elsewhere, and refer too it, but then the space on the calc in a whole is still using the same. sorry I don't think there is a way around that :P
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 04:36:08 pm
What I don't understand is after I have added a whole bunch of pics, how I put them into a GDB.
*cough*
;)
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 06:21:43 pm
I only have a vague idea can't GDB be stored in the same way as GDB except they're recommended for not just pics?
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 06:48:47 pm
I think so, But yeah it's easier as just pics, and you refer to it later as the pic
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 08:24:04 pm
Yay I got it right? At least I understand something!
Lol lots left to understand.
*facepalm*

I just want to know what 2 numbers represent each pic, unless I'm understanding the whole thing wrong.
I don't know the exact values, there should be a guide somewhere but it can be worked out.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 08:50:56 pm
What I don't understand is after I have added a whole bunch of pics, how I put them into a GDB.
*cough*
;)
!
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 08:58:18 pm
I kno epic7 I can't really explain it for you
750th post! time for a break
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:00:59 pm
D:
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 09:17:17 pm
What i can say if it's [FFFFFFFF] it's completely black
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:19:06 pm
Is the GDB written in hex then?
No pics needed for it?

I dont need anyone to explain how hexadecimals work.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 09:19:29 pm
I CAN EXPLAIN THIS PART! just reword your questions!
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 09:21:00 pm
GDB is for data
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:21:04 pm
How does the GDB work?

Do you store pics at the beggining of the program and then somehow reference them from the gdb?
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 09:22:20 pm
I think GDB is just for data. The Axe manual explains it ok.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:23:11 pm
How to make a tilemap?

Ok, he says

[01010101]->GDB1   ;this is the tilemap in hexadecimal code.
[01000001]
[01010001]
[01000001]
(Some sprite data to pic1 here)


I dont understand how that works.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 09:26:00 pm
Yes and yes.

Here's aeTIos' code, cause it made sense to me


:.TILE
:Repeat getKey(15)
:[01010101]→GDB1 
:[01000001]
:[01000001]
:[01010101]
:[FFFFFFFFFFFFFFFF]→Pic1
:For(B,0,3)   
:For(A,0,3)   
:{B*4+A+GDB1}→T   
:If T
:T--
:Pt-On(A*8,B*8,T*8+Pic1)   
:End
:End
:End
:DispGraph
:ClrDraw
:End

each '01' is like a sprite, what ever your pic1 is, is what each '01' is representing! so if your pic1 sprite is a solid block ( hex code [FFFFFFFFFFFFFFFF] ) then you will have a box displayed at each '01' point on the screen
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:28:10 pm
So
01 = Pic1
What would be pic2, pic3, or
[FFFFFFFFFFFFFFFF]->Pic1
[This one]
[And this one]
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 09:36:11 pm
kinda,

01 represents a sprite that is 8x8
so in that code if you had

[01010101]->gdb1
[FFFFFFFFFFFFFFFF]->pic1
for(b,0,3)
for(a,o,3)  //look at the 3's, notice i'm trying to display 4 boxs right nest to each other
{b*4+a+gdb1}->T  //so the four is put with b because there are going to be 4 boxes from left             to right, and then a is how many rows down the calc reads, so as set before it is 3 but with 0 it is really 4, keep in mind we only have one row so the a is irrelevant

and then the rest of the code is irrelevant to your question
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:39:07 pm
That part seems irrelivant too :/
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 09:41:56 pm
OH well all you need to do for the other pics is put them under as so
[FFFFFFFFFFFFFFF]->pic1
[FFFFF12345FFFFF]   //not real code I don't think just random for purpose of example

and then when you want to display the second one you just add (i think 8 ) to pic1
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:46:54 pm
I just thought you put different pairs of numbers in the gdb to use different sprites in it
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 09:50:03 pm
no the gdb is like the map

like if you had this:
[01010101]->gdb1
[01000001]
[01000001]
[01010101]

and your pic was an X for example

your display would be like this:

X X X X
X      X
X      X
X X X X

or a box
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 09:57:38 pm
Ok then. So 00 is simply blank, it seems. 01 is pic1. The question I've been trying to ask is if 01 is pic1, what numbers are for the other pics?
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 09:58:49 pm
02 03?
PS: That doesn't sound right to me
in axe you can have PicA7B for example
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 09:59:02 pm
1 just means true and 0 just means not true. if it is true then the pxls are turned on, if false, then they are off, the 1 in 01 is in no relation to the 1 in pic1, it could be pic4325
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 10:04:59 pm
Look,
http://www.omnimaga.org/index.php?action=articles;sa=view;article=46
He has stuff like
:[0C0C0C0C0100000008090A0000000000000000010C0C0C0C]

In the beginning, he says 0 1 2 3 4 5 6 7 8 9 A B C etc. each represent a tile.

He stores them all to a pic and it seems like
00 is the first
01 is second
02 is third
and it continues like that
Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 24, 2011, 10:06:55 pm
That makes sense just like binary code
and Hex goes up to FFFFFF....
Title: Re: Axe tile mapping! HELP!
Post by: Darl181 on November 24, 2011, 10:08:13 pm
So you're trying to store the pics one after the other into a GDB?
...
Technically you don't "store" in a GDB, GDB#, Str#, Pic# etc are just pointers much like L1, except you declare them yourself.
To have the pics after the GDB you can do something like this:
[]→GDB1
[FFFFFFFFFFFFFFFF]
.or [FFFFFFFFFFFFFFFF]→GDB1, it's basically the same thing iirc
[FF818181818181FF]
[0000000000000000]
.etc

and just sub GDB# for the normal Pic#.

Is this what you're trying to do?
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 10:08:57 pm
well the 0C is just a dead zone, and what he did was he stored the parts of the pics as letters and numbers, (i think), so when it was all displayed it just what to what ever pic had that letter or number. Sorry but I didn't really understand that tutorial and I'm only going off of what aeTIos taught me like one day ago. :P

edit: i think he just did that so you could understand where each part of the hex's were on the map
Title: Re: Axe tile mapping! HELP!
Post by: Darl181 on November 24, 2011, 10:11:36 pm
So, is there one part in particular you're confused about?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 10:11:50 pm
Nope.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 10:12:30 pm
do understand a little bit?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 10:18:56 pm
Darl there is 1 part im confused about I was saying no to your post before that :P

So saintrunner, what I'm understanding from you is that you can only use a choice of 1 sprite and blank spots where 01 is that sprite and 00 is blank.
Title: Re: Axe tile mapping! HELP!
Post by: Darl181 on November 24, 2011, 10:22:18 pm
You can have up to 255 choices if you use one byte (two hex chars)
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 10:22:40 pm
yes and no you can use multiple sprite, you just add 8 I think to pic 1 to get the other one so like

[01010101]->gdb
[ffffffffffffffff]->pic1
[1234567890123456]

to display the second one after pic 1
you have
{B*4+A+pic1+8}

I think, that might work, but i'm not sure, I know you can use different sprites all in pic 1, for example to display a big character, but I'm not exactly sure, so you can!

I can't help much more, sorry, good luck :P
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 24, 2011, 10:33:38 pm
I know how to use one now, but I think there's an easier way for the multiple.
I'll just wait 'till Aetios returns or another experienced person returns.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 24, 2011, 10:34:58 pm
Yeah, sorry, like I said I just learned this, and I don't know all of it yet :P I atleast hope I helped a little lol
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 25, 2011, 02:40:31 am
Hmm, seems that you all have troubles understanding.
So what do the hex numbers in the GDB mean?
Those numbers represent the position of the sprite in pic1 +1
So, if you have 3 sprites, one being +,another an X, and the other an O and they're all stored in a row in pic1, you could get this tilemap: (.. means a blank "tile")

OXXO
+....+
X....X
O++O

This would be represented by this map data:
[03020203]->GDB1
[01000001]
[02000002]
[03010103]

I hope this is more clear.
My point that was not 100% clear to you:
You can store more than one sprite to a pic since a pic is NO MORE than a pointer (which is again just a number)
So have fun storing 15 sprites in a row and play around with it a bit.

Title: Re: Axe tile mapping! HELP!
Post by: Jonius7 on November 25, 2011, 05:34:03 am
Hey thanks for that explanation. That cleared up a lot.
Generally we kinda get it just not the specific theory behind it.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on November 25, 2011, 08:35:15 am
THANKS SO MUCH!
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on November 25, 2011, 11:54:46 am
Hmm, seems that you all have troubles understanding.
So what do the hex numbers in the GDB mean?
Those numbers represent the position of the sprite in pic1 +1
So, if you have 3 sprites, one being +,another an X, and the other an O and they're all stored in a row in pic1, you could get this tilemap: (.. means a blank "tile")

OXXO
+....+
X....X
O++O

This would be represented by this map data:
[03020203]->GDB1
[01000001]
[02000002]
[03010103]

I hope this is more clear.
My point that was not 100% clear to you:
You can store more than one sprite to a pic since a pic is NO MORE than a pointer (which is again just a number)
So have fun storing 15 sprites in a row and play around with it a bit.


I know you can store more than one sprite to a pic.
Yesterday, I was asking if 01 02 03 04 and so on worked for multiple sprites stored into pic1. So it looks like I was right :P

So it goes
[01]->Pic1
[02]
[03]
[04]
[05]

Ok. So...... How hard is it to make it scroll now?

And

if T
T--

Does that mean it just skipps to the next one if there's a blank tile?
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on November 25, 2011, 01:15:30 pm
For the last part, indeed. For the scrolling part: Check out Yunhua's tutorial. For the first part: You were right, weird that I did not notice :$
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 05, 2011, 04:07:44 pm
So, how does scrolling work?

How would I do something simple like shifting the tilemapper 1 pixel to the left or something?
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 05, 2011, 07:54:50 pm


How would I do something simple like shifting the tilemapper 1 pixel to the left or something?

horizontal + and - and vertical + and - do that I think... or do you mean like move a tile mapped square down?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 05, 2011, 08:06:00 pm
You could take 1 away from X of corse, but wouldn't there be more to it if its a tilemap larger than the screen?
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 05, 2011, 08:09:56 pm
I guess so, I just know the horizontal and vertical commands move the stuff of the screen in a specified direction one pxl. sorry I don't really know exactly how it works. I go look for a tut

edit: ok this is copy and paste from the axe commands list

Horizontal +
Horizontal +r
Horizontal +(BUF)   //The main buffer, back buffer, or specified buffer is shifted right by 1 pixel. White pixels are shifted in.

Horizontal -
Horizontal -r
Horizontal -(BUF)   //The main buffer, back buffer, or specified buffer is shifted left by 1 pixel. White pixels are shifted in.

Vertical +
Vertical +r
Vertical +(BUF)   //The main buffer, back buffer, or specified buffer is shifted down by 1 pixel. New pixels are not shifted in, that row remains the same.

Vertical -
Vertical -r
Vertical -(BUF)   //The main buffer, back buffer, or specified buffer is shifted up by 1 pixel. New pixels are not shifted in, that row remains the same.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 05, 2011, 08:18:23 pm
That will just shift whats on the screen, not actually show the next pixel of the tilemapper i think.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 05, 2011, 08:28:42 pm
Oh I see what you want i think, I've always done

:[12908479610374]->pic1
:[89785454612539]

then put a pt-on(X,Y,pic1+8) //+8 counts down 8 (or one sprite) for the second
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 05, 2011, 08:51:50 pm
Nope... That doesnt seem like that is for a scrolling tilemapper.

I've heard of yunhua's tutorial, I just wanted to know how basically it works; how it shifts the tilemap.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 05, 2011, 08:53:22 pm
OH! I see what your wanting, *Face Palm*, and sorry, I am not skilled in that area :(
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 05, 2011, 08:54:07 pm
/me summons someone experienced
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on December 06, 2011, 09:33:20 am
I do not have time to explain this in-depth, but what I always do (it's been a long time since I created a scrolling tilemapper) is like this:
Code: [Select]
(big tilemap here)->GDB1

now display the tilemap from [scrolled X] to [scrolled X]+(96/tile size).
Same for Y.
Title: Re: Axe tile mapping! HELP!
Post by: Darl181 on December 06, 2011, 02:48:27 pm
There's multiple ways to do it...
Basically the general things to work towards are
1) Scrolling the map
2) Drawing over the distortions/columns that Vertical/Horizontal +/- cause
3) Updating variables etc so the dynamic parts (pretty much what's not the map) work properly

The tilemap itself isn't shifted, just a different part of it is drawn.  The "scrolling" is brought about by the different parts of the map being drawn at certain offsets.
So if the map is drawn as normal, it appears normal.  But if, after that, you draw the map starting with the second row, the map appears to move--though it's just a different part of the same map drawn to the screen.

Hope this helps, I'm not the best at explaining things :P
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 06, 2011, 03:31:55 pm
I do not have time to explain this in-depth, but what I always do (it's been a long time since I created a scrolling tilemapper) is like this:
Code: [Select]
(big tilemap here)->GDB1

now display the tilemap from [scrolled X] to [scrolled X]+(96/tile size).
Same for Y.
So if X was the amount scrolled for only horizontal scrolling,i
I'm going to guess what I interpreted
Repeat getkey(15)
For(B,0,8
For(A,X,X+12
{B*13+A+GDB1}->T
If T
T--
Pt-On(A-X*8,B*8,T*8+Pic1
End
End
End
DispgraphClrdraw
End
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 09, 2011, 03:56:47 pm
*cough*

How does scrolling work then?
Title: Re: Axe tile mapping! HELP!
Post by: LincolnB on December 10, 2011, 07:41:59 pm
With scrolling, you need an X offset and a Y offset, in pixels. I use T for the X offset, and S for the Y offset. Assuming you have a pointer to the tilemap in W and the start of the Tile sprites in Pic1, using A, B, C, D, and E as temporary variables...

Code: [Select]
ClrDraw

0-(T^8)->C
For(A,T/8-1,T/8+11
0-(S^8)->D
For(B,S/8-1,S/8+11

If {B*WIDTH_OF_MAP+A+W}->E
Pt-On(C,D,E-1*8+Pic1
End

D+8->D
End
C+8->C
End

Dispgraph

So when T is 8 and S is 8, you're at the top-left most corner of the tilemap. You can increment/decrement T and S using the arrow keys.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 10, 2011, 08:41:46 pm
/me sees why parser loves butts (in a manly way) :thumbsup:

Pointer for the tilemap? You mean like doing
GDB1->W
or something?
Title: Re: Axe tile mapping! HELP!
Post by: LincolnB on December 10, 2011, 11:15:18 pm
lol yeah, that's correct, assuming your map data is in GDB1.
Title: Re: Axe tile mapping! HELP!
Post by: aeTIos on December 12, 2011, 07:12:39 am
^^ That. The map itself is not shifted.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 14, 2011, 04:33:48 pm
Changing S and T by 1 increments by 1 pixel at a time, right?

And width of map in tiles?
Title: Re: Axe tile mapping! HELP!
Post by: LincolnB on December 15, 2011, 09:29:58 am
Changing S and T by 1 increments by 1 pixel at a time, right?

Yeah, that's right. And "width of map in tiles" means you enter the number of columns your entire map has.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 09:44:20 pm
Does
0-(S^8)->D
Have to be inside the loop?
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 16, 2011, 09:47:26 pm
If it is storing something to a variable then no, unless it only happens if something in the loop causes it, in which case you could use lbls
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 09:49:34 pm
I'm not sure if it could be out of the loop to optimize, but it seems like it could...
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 16, 2011, 09:51:27 pm
It wouldn't do much, but it helps I guess. are you doing this for speed or size?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 09:52:50 pm
Speed. I only have 6mhz.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 16, 2011, 09:58:42 pm
ok then, what I usually do is put my variables and lines and hex's outside of the main loop (as far as tile maps, if you are scrolling I don't know where you put them) so you could experiment with moving those out if you haven't already.
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 10:07:15 pm
Yeah, I know that, but I just wanted to try to move one line in a for loop out of the for loop, and see if it works.

It seems like it has to be in the loop though.
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 16, 2011, 10:11:07 pm
Yeah wouldn't the for( loop be saying for this being true then change this variable? Yeah It needs the loop
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 10:12:31 pm
Wat?
For( isn't an if...

But I figured out why it wouldn't work, so...
Title: Re: Axe tile mapping! HELP!
Post by: parserp on December 16, 2011, 10:14:44 pm
If {B*WIDTH_OF_MAP+A+W}->E
is width of map in pixels or tiles?
Title: Re: Axe tile mapping! HELP!
Post by: saintrunner on December 16, 2011, 10:14:46 pm
No not an If statement, but since it is a loop it is telling it to change the variable, I thought you wanted to set a variable at the beginning like setting an X or a Y, but nevermind
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 10:16:00 pm
If {B*WIDTH_OF_MAP+A+W}->E
is width of map in pixels or tiles?
Tiles
Title: Re: Axe tile mapping! HELP!
Post by: parserp on December 16, 2011, 10:36:01 pm
ok, so, why isn't this working?

Code: [Select]
:.SCROLL
:[0101010101010101010101010101010101010101]->GDB1  //<--------note that it's 20 tiles long
:[...more hex stuff..........................................]
:[......(all consisting of 01's and 02's).................]
:[................................................................]
:[................................................................]
:[................................................................]
:[................................................................]
:[................................................................]
:[................................................................]
:[0101010101010101010101010101010101010101]
:GDB1->W
:[FFFFFFFFFFFFFFFF]->Pic1
:[0000000000000000]
:ClrDraw
:Repeat getKey(15)
:0-(T^8)->C
:T/8-1->F
:T/8+11->G
:S/8+11->I
:For(A,F,G
:0-(S^8)->D
:For(B,H,I
:If {B*20+A+W}->E
:Pt-On(C,D,E-1*8+Pic1
:End
:D+8->D
:End
:C+8->C
:End
:DispGraph
:End
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 10:43:53 pm
Maybe because use you forgot about H?
Title: Re: Axe tile mapping! HELP!
Post by: parserp on December 16, 2011, 10:44:22 pm
Maybe because use you forgot about H?
? where should it be?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 10:45:55 pm
:T/8-1->F
:T/8+11->G
:.Where's the -> H?
:S/8+11->I
Title: Re: Axe tile mapping! HELP!
Post by: parserp on December 16, 2011, 10:47:29 pm
:T/8-1->F
:T/8+11->G
:.Where's the -> H?
:S/8+11->I
wait, what?
what would I have to add in to make it work?
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 16, 2011, 10:50:43 pm
S/8-1->H
I believe.
Title: Re: Axe tile mapping! HELP!
Post by: LincolnB on December 16, 2011, 10:50:54 pm
I think you forgot a line, S/8-1->H

*sniff* makes me so happy, seeing people use my code.

EDIT: Ninja'd. And I was wrong the first time anyways :P
Title: Re: Axe tile mapping! HELP!
Post by: parserp on December 16, 2011, 10:52:16 pm
S/8-1->H
I believe.
oooh duh I am soo dumb. :P
that is actually in my source, I just forgot to put it in there.
so... any suggestions?
Title: Re: Axe tile mapping! HELP!
Post by: LincolnB on December 16, 2011, 10:54:13 pm
Parser, I think you just forgot to clear the screen every frame before you draw everything. You're probably getting gobbledy gook all over the screen when you try and scroll?
Title: Re: Axe tile mapping! HELP!
Post by: parserp on December 16, 2011, 10:56:07 pm
Parser, I think you just forgot to clear the screen every frame before you draw everything. You're probably getting gobbledy gook all over the screen when you try and scroll?
no. it doesn't give me a bunch of crap, it just doesn't display anything, then exits when I press clear.
Title: Re: Axe tile mapping! HELP!
Post by: leafy on December 16, 2011, 10:56:31 pm
:.SCROLL
:[0101010101010101010101010101010101010101]→GDB1  //<--------note that it's 20 tiles long
:[...more hex stuff..........................................]
:[......(all consisting of 01's and 02's).................]
:[................................................................]
:[................................................................]
:[................................................................]
:[................................................................]
:[................................................................]
:[................................................................]
:[0101010101010101010101010101010101010101]
:GDB1→W
:[FFFFFFFFFFFFFFFF]→Pic1
:[0000000000000000]

Note: This assumes your xposition is S, yposition is T (uninflated)


:Repeat getKey(15)
:S/8→E
:T/8→D
:S^8→F
:T^8→G
:For(A,0,12)
:A*8-F→C
:For(B,0,8)
:Pt-Off(C,B*8-G,{B+D*20+A+E+W}*8+Pic1)
:End:End
:DispGraph
:End
Title: Re: Axe tile mapping! HELP!
Post by: epic7 on December 17, 2011, 10:40:27 am
Also, you could just use 00 instead of using 02 since its blank.