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

0 Members and 2 Guests are viewing this topic.

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
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! :w00t:
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
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 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.
« Last Edit: November 23, 2011, 09:53:44 pm by aeTIos »
I'm not a nerd but I pretend:

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: Axe tile mapping! HELP!
« Reply #2 on: November 23, 2011, 09:28:14 pm »
I think I get that thanks!
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe tile mapping! HELP!
« Reply #3 on: November 23, 2011, 09:28:51 pm »
If you experience any problems please ask.
I'm not a nerd but I pretend:

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
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?
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
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:

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
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!
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
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 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
I'm not a nerd but I pretend:

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
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, :)
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
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:

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: Axe tile mapping! HELP!
« Reply #10 on: November 23, 2011, 10:04:58 pm »
ok thanks! :)
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline epic7

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

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
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:

Offline epic7

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

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
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: