Author Topic: [Tutorial] Tilemaps in Axe Basic  (Read 49095 times)

0 Members and 1 Guest are viewing this topic.

Offline lafferjm

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 11
  • Rating: +0/-0
    • View Profile
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #45 on: April 15, 2010, 09:05:07 pm »
I think its becasue you forgot to close the parenthesis on {J*2+I+GDB1}→A

Remember, parenthesis matter when storing to variables.

Tried doing that and it still didn't work.

I loaded the last code in Sourcecoder, saved, opened in Wabbitemu, making sure the code was intact, compiled fine with latest Axe version, and when running Asm(prgmB it just says Done

Don't forget the DispGraph at the end.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #46 on: April 15, 2010, 09:23:30 pm »
oh ok thatnks x.x

EDIT: ok I get the same problem as Lafferjm
« Last Edit: April 15, 2010, 09:30:46 pm by DJ Omnimaga »

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #47 on: April 15, 2010, 09:56:20 pm »
Okay I'm starting with the original code and making revisions.  I bolded things that needed fixing:

:.B
:[1111→GDB1
:[1001
:[1001
:[1111
:[FFFFFFFFFFFFFFFF→Pic1
:ClrDraw
:For(I,0,1
:For(J,0,3
:{J*2+I+GDB1}→A      <--Grid is 2x4 bytes.
:A^16→B
:A/16→A
:If A
:Pt-On(I*8,J*8,A-1*8+Pic1     <--Don't forget, order of operations is left to right always.
:End
:If B
:Pt-On(I*8,J*8,B-1*8+Pic1     <--Minus 1 is more efficient than minus 8 anyway
:End
:End
:End
:DispGraph

If this doesn't work then something is wrong...
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #48 on: April 15, 2010, 10:01:05 pm »
Is it supposed to do the following?

Offline lafferjm

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 11
  • Rating: +0/-0
    • View Profile
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #49 on: April 15, 2010, 10:10:44 pm »
It works now, thank you.  Now to go over the code and see why it works.

_player1537

  • Guest
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #50 on: April 18, 2010, 03:40:11 pm »
well, figured since there was already a tilemapper in axe thread I would put this here.  I made another tilemapper that works with 8x8 sprites, and scrolls.  I believe it works on the same principle as SIr's program, I'll have to look at it a bit more.  anyways, here goes (it's attached at the bottom as well)

Pic3 holds the tilemap data
Pic4 holds the tile data
W is the X position for the tilemapper
R is the Y position
W is how many bytes each row of tile makes (ie in a tilemap of 18x5, 18/2=9=W)  W is also used to check if you are too far in one direction
I didn't add something to limit the Y movement, you'll have to add that yourself, not too much work really
Code: [Select]
:.B
:Full
:[0000000000000000FFFFFFFFFFFFFFFF→Pic4
:[111111111111111100→Pic3
:[000000000000000000
:[000000000000000000
:[000000000000000000
:[000000000000000000
:[000000000000010100
:[000000000000001010
:[000000000000000101
:[000000000000000000
:9→M
:2→W
:0→R
:ClrDraw
:Repeat getKey(15)
:Repeat getKey(0)
:End
:
:If getKey(2)
:W-1+(W=2)→W
:End
:If getKey(3)
:W+1-(2*M-8=W)→W
:End
:If getKey(4)
:R-1+(R=0)→R
:End
:If getKey(1)
:R+1→R
:End
:sub(AA)
:DispGraph
:Pause 100
:End
:
:
:Return
:Lbl AA
:For(V,0,7
:For(Z,0,3
:Pt-Off(16*Z+(W^2*8),8*V,Pic4+({R+V*M+Pic3+Z+(W/2)+(W^2)}/16*8)
:Pt-Off(16*Z+8-(W^2*8),8*V,Pic4+({R+V*M+Pic3+Z+(W/2)}^16*8)
:End
:End
:

Lbl AA is the specific tilemapping part, the rest just shows how to use it

hope it proves useful to someone
« Last Edit: April 18, 2010, 04:58:12 pm by _player1537 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #51 on: April 18, 2010, 04:29:50 pm »
D:

SirCmpwn

  • Guest
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #52 on: April 18, 2010, 04:40:52 pm »
DJ, try changing a single character.  For example, add a single comment anywhere in the code.  Then, try it again.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #53 on: April 18, 2010, 04:43:07 pm »
still no luck

_player1537

  • Guest
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #54 on: April 18, 2010, 04:45:26 pm »
try making your own map, just use some random map but keep the lbl A part and try it (might be group corruption which would suck)

SirCmpwn

  • Guest
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #55 on: April 18, 2010, 04:50:57 pm »
Could you post your full code?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #56 on: April 18, 2010, 04:57:53 pm »
no need to post the full code, all I did was adding a line break, changing map data a bit then trying, then changing it back, removing comments and stuff


This means there's a problem with the posted code or it's an Axe Parser bug

_player1537

  • Guest
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #57 on: April 18, 2010, 05:00:19 pm »
sorry, I forgot to attach the file, woops.  It's attached to the original post now

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #58 on: April 18, 2010, 05:06:40 pm »
Ok ty the attached file works. Is the tilemapper supposed to look weird like this tho? It doesn't appear to have any limit of how much it can scroll down.


Offline {AP}

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 981
  • Rating: +74/-3
  • I am Webmaster!
    • View Profile
    • Removed From Game
Re: [Tutorial] Tilemaps in Axe Basic
« Reply #59 on: April 18, 2010, 05:11:06 pm »
Yeah, he didn't put a limit on the Y movement for whatever reason.
Quote
I didn't add something to limit the Y movement, you'll have to add that yourself, not too much work really
Personally, I'd think that if you were sharing an engine, that you'd at least get it to run right on it's own without those weird errors.
If they edit it from there and it messes up, THEN it's the user's problem.

To each his own, I guess.