### Author Topic: Axe tile mapping! HELP!  (Read 29414 times)

0 Members and 1 Guest are viewing this topic.

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Axe tile mapping! HELP!
« 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!

GAMES:
Spoiler For Spoiler:

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #1 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 columnsfor(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 drawnT--pt-on(a*8,b*8,T*8+pic1)   ;draw the tileendendendThat are the basics of the tilemap drawing code.
« Last Edit: November 23, 2011, 09:53:44 pm by aeTIos »
I'm not a nerd but I pretend:

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Axe tile mapping! HELP!
« Reply #2 on: November 23, 2011, 09:28:14 pm »
I think I get that thanks!

GAMES:
Spoiler For Spoiler:

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #3 on: November 23, 2011, 09:28:51 pm »
I'm not a nerd but I pretend:

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Axe tile mapping! HELP!
« Reply #4 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?

GAMES:
Spoiler For Spoiler:

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #5 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.
I'm not a nerd but I pretend:

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Axe tile mapping! HELP!
« Reply #6 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!

GAMES:
Spoiler For Spoiler:

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #7 on: November 23, 2011, 09:53:19 pm »
ok.
Wait, I made a stupid mistake
Code: [Select]
T--If Tshould be
Code: (fixed) [Select]
if TT--

{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

T--    ;subtracts one from T so you do not have to draw
I'm not a nerd but I pretend:

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Axe tile mapping! HELP!
« Reply #8 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,

GAMES:
Spoiler For Spoiler:

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #9 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)
« Last Edit: November 23, 2011, 10:05:10 pm by aeTIos »
I'm not a nerd but I pretend:

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Axe tile mapping! HELP!
« Reply #10 on: November 23, 2011, 10:04:58 pm »
ok thanks!

GAMES:
Spoiler For Spoiler:

#### epic7

• Chopin!
• LV11 Super Veteran (Next: 3000)
• Posts: 2200
• Rating: +135/-8
• I like robots
##### Re: Axe tile mapping! HELP!
« Reply #11 on: November 23, 2011, 10:26:16 pm »
Would 01 be
[stuff]->Pic0
[THIS ONE]

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #12 on: November 23, 2011, 10:29:51 pm »
No. 01 would be
[THIS ONE]->pic1
I'm not a nerd but I pretend:

#### epic7

• Chopin!
• LV11 Super Veteran (Next: 3000)
• Posts: 2200
• Rating: +135/-8
• I like robots
##### Re: Axe tile mapping! HELP!
« Reply #13 on: November 23, 2011, 10:31:55 pm »
Would be what i said before?

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Axe tile mapping! HELP!
« Reply #14 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.
I'm not a nerd but I pretend: