Author Topic: Tile mapping tutorial? for axe?  (Read 10919 times)

0 Members and 1 Guest 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
Re: Tile mapping tutorial? for axe?
« Reply #15 on: November 19, 2011, 03:00:40 pm »
Thanks that helps! can someone also explain movement with tile mapping? like if I have a character I want to be able to move? I would assume it would be similar to the regular getkey stuff
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Tile mapping tutorial? for axe?
« Reply #16 on: November 19, 2011, 03:01:56 pm »
i'm working on it already, actually, and will edit it in here.

EDIT:
The main restriction of our last map drawing style is that it doesn't allow drawing different spots in a tile map larger that 12*8, but rather only draws a single screen. here is a simple example that uses bytes for map data (because usually people have more that 16 tiles) and allows the map to be scrolled with getkey.

Code: [Select]
[HEXCODE]->Pic1
[MapDataInBytes]->GDB1
0->A->B //A and B are the x and y coordinates in the tilemap.
<map's width in tiles, minus 12>->X
<map's height in tiles, minus 8>->Y
Repeat getkey(15) //repeat until Clear is pressed

if getkey(3) //if right key
A<X+A->A //A is increased by the value of (A<X) which can either be 1 or 0, meaning that A will be incremented unless it equals X
end

if getkey(2) //if left key
A-(A>X)->A //similar to the last line
end

if getkey(4) //if up key
B<Y+B->B
end

if getkey(1) //if down key
B-(B>Y)->B
end

For(M,0,7)
For(L,0,11)
PtOff(L*8,M*8,{B+M*X+A+L+GDB1}*8+Pic1)
end
end
/*
/This is a fun section to describe. L*8 and M*8 should be fairly obvious in the first and second arguments.
/B+M*X is, because of Axe's lack of order of operations, interpreted as (B+M)*X. This will give the Y coordinate
/in the map data to read, because in order to find Y coordinates in a single dimensional list, one has to
/multiply that value by the total width of the map. A+L then gives the X coordinate, and adding GDB1 makes it point to
/the tile map data.
*/

end
« Last Edit: November 19, 2011, 03:27:01 pm by shmibs »

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: Tile mapping tutorial? for axe?
« Reply #17 on: November 19, 2011, 03:06:02 pm »
thanks!
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES: