Author Topic: Tilemapping in Axe  (Read 11284 times)

0 Members and 1 Guest are viewing this topic.

Offline zeldaking

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 197
  • Rating: +15/-0
    • View Profile
Tilemapping in Axe
« on: August 02, 2011, 01:39:46 pm »
I know there are specific tutorials out there for tilemapping in axe, but they don't help if you can't ask questions about them. I am trying to learn tilemapping, but it is pretty confusing. Can someone give a small example and we can go from there?

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Tilemapping in Axe
« Reply #1 on: August 02, 2011, 02:26:24 pm »
Do you want smooth scrolling?
I can write a simple example.  ;)

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline zeldaking

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 197
  • Rating: +15/-0
    • View Profile
Re: Tilemapping in Axe
« Reply #2 on: August 02, 2011, 02:28:38 pm »
Well considering I understand that part, sure. Nothing to complicated (hint: 1 or 2 character sprites)

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Tilemapping in Axe
« Reply #3 on: August 02, 2011, 02:46:05 pm »
For in-depth explanations of any of this code or questions or bugs (I haven't tested this. :P), just post'em.  ;)

Code: [Select]
:.TILEMAP
:[0000000000000000]->Pic0
:[FFFFFFFFFFFFFFFF]
:
:[010101010101010101010101010101010101010101010101]→GDB1
:[010101010101010101010101010101010101010101010101]
:[010101010101010101010101010101010101010101010101]
:[010101010101010101010101010101010101010101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010100000000000000000000000000000101010101]
:[010101010101010101010101010101010101010101010101]
:[010101010101010101010101010101010101010101010101]
:[010101010101010101010101010101010101010101010101]
:
:0->P->Q  \\P and Q are the coordinates of the corner of the screen relative to the entire chunk of level data
:
:Repeat getKey(15)
:
:getKey(3)-getKey(2)+P->P
:getKey(1)-getKey(4)+Q->Q  \\I didn't code in collision detection, if you need that too, tell me
:
:sub(MAP)
:
:Pt-On(40,24,(your sprite here)
:
:DispGraph
:
:End
:
:Lbl MAP
:ClrDraw
:For(B,0,7)
:For(A,0,11)
:Pt-On(8*A,8*B,{Q+B*24+P+A+GDB1}*8+Pic0
:End
:End

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline zeldaking

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 197
  • Rating: +15/-0
    • View Profile
Re: Tilemapping in Axe
« Reply #4 on: August 02, 2011, 02:49:17 pm »
Thanks, that is exactly what I need to get started.
for the map drawing .sub(map. is it A*8 because of 8x8 tiles? Also what is {Q+B*24+P+A+GDB1} can you give me answer in depth?
« Last Edit: August 02, 2011, 02:52:27 pm by zeldaking »

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: Tilemapping in Axe
« Reply #5 on: August 02, 2011, 03:46:53 pm »
Thanks, that is exactly what I need to get started.
for the map drawing .sub(map. is it A*8 because of 8x8 tiles? Also what is {Q+B*24+P+A+GDB1} can you give me answer in depth?

I think it just locates the data located in a specific point of GBD1, so that only the data needed is displayed on the screen, and not the entire GBD1, if I'm not mistaken.

I say this because I know the {} mean to load a point in data, and it has the pointer for the data, GBD1, which says that it loads from a point inside GBD1.

I'm sure yunhua will correct me if I'm wrong, but that is my answer

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Tilemapping in Axe
« Reply #6 on: August 02, 2011, 04:03:12 pm »
What he said.
the A*8 is indeed because of the 8x8 tiles, and in {Q+B*24+P+A+GDB1}, Q+B*24 is interpreted as (Q+B)*24 because of left to right order of operations.  The width of the map is 24, so to get to the next row, you add 24, in this case, you add Q+B number of rows.  Add one to go one byte to the right, so P and A are added, plus the original pointer, GDB1.

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: Tilemapping in Axe
« Reply #7 on: August 02, 2011, 04:10:29 pm »
What he said.

;D Woot! I figured it out!

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Tilemapping in Axe
« Reply #8 on: August 02, 2011, 07:21:44 pm »
also, if it clarifies anything, given an array GDB1 with n number of columns, you can access the yth element down and the xth element over via the following formula:

{y*n+x+GDB1}

keep in mind this returns one byte, a value between 0 and 255. to do other things like access nibbles and two-byte integers (between 0 and 65,535) it gets slightly more complicated, but retains the same idea.

Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: Tilemapping in Axe
« Reply #9 on: August 02, 2011, 10:17:10 pm »
also, if it clarifies anything, given an array GDB1 with n number of columns, you can access the yth element down and the xth element over via the following formula:

{y*n+x+GDB1}

keep in mind this returns one byte, a value between 0 and 255. to do other things like access nibbles and two-byte integers (between 0 and 65,535) it gets slightly more complicated, but retains the same idea.



But 256 tiles is a lot of sprites to choose from, and I can't think of many, if any, projects that use anywhere near 65,536 sprites, although I would love to see such a behemoth project that uses all of them!
That would be monstrous :D

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Tilemapping in Axe
« Reply #10 on: August 04, 2011, 07:23:35 pm »
right, that would be pretty epic :) but hard to do it well in a game, and not make it look like you just crammed as many tiles as you could without considering actual content
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Tilemapping in Axe
« Reply #11 on: August 14, 2011, 01:57:36 pm »
What he said.
the A*8 is indeed because of the 8x8 tiles, and in {Q+B*24+P+A+GDB1}, Q+B*24 is interpreted as (Q+B)*24 because of left to right order of operations.  The width of the map is 24, so to get to the next row, you add 24, in this case, you add Q+B number of rows.  Add one to go one byte to the right, so P and A are added, plus the original pointer, GDB1.

Hem... Is it normal? IRL, or in C, the * operaotr has more priotiy than +...

Offline zeldaking

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 197
  • Rating: +15/-0
    • View Profile
Re: Tilemapping in Axe
« Reply #12 on: August 14, 2011, 01:58:51 pm »
Well, I am making a game with about 160 grayscale sprites (called condor) and I think it isn't too hard.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Tilemapping in Axe
« Reply #13 on: August 14, 2011, 02:00:33 pm »
For a C project, i made the references intuitives: In a sokoban, if box = 3 and dot = 2, then box on a dot = 3+2

Ashbad

  • Guest
Re: Tilemapping in Axe
« Reply #14 on: August 14, 2011, 03:45:32 pm »
What he said.
the A*8 is indeed because of the 8x8 tiles, and in {Q+B*24+P+A+GDB1}, Q+B*24 is interpreted as (Q+B)*24 because of left to right order of operations.  The width of the map is 24, so to get to the next row, you add 24, in this case, you add Q+B number of rows.  Add one to go one byte to the right, so P and A are added, plus the original pointer, GDB1.

Hem... Is it normal? IRL, or in C, the * operaotr has more priotiy than +...

In Axe, yes it's normal, since that's how math is defined in it.