Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: collechess on November 02, 2011, 07:26:01 pm
-
How do you create exact tilemap collisions in Axe? My routine to access the value of a tile divides x and y by 4, which is the size of each tile, but means that there is only a collision if it overlaps on the right or is exactly aligned. It does not register collisions on the left. How can I register a collision on any overlap?
-
Dont test for pixels. If youre moving to the right, check if there's a solid tile that is one tile to the right. if not, then keep moving.
-
This:
but collision s the most complicated!, Damn!
Tile based works perfectly. I use this:
:If getKey(2) and (X≠0)
:sub(CC,X,Y,X,Y+7
:!If R
:X-1→X
:End
:End
Just to check for a tile on the left. Now you figure out how to check for tiles in the other 3 directions :)
:Lbl CC
:{r2/8*12+(r1/8)+GDB1}→r5
:{r4/8*12+(r3/8)+GDB1}→r6
:r5+r6→R
:Return
-
Changed for prettification and I think also speed gain:
:If getKey(2)
:If X
:!If CC(X,Y,X,Y+7)
:X--
:End
:End
:End
:
:
:Lbl CC
:{r2/8*12+(r1/8)+GDB1}→r5
:{r4/8*12+(r3/8)+GDB1}→r6
:r5+r6→R
:Return
I just love function based programming so much :)
-
Changed for prettification and I think also speed gain:
:If getKey(2)
:If X
:!If CC(X,Y,X,Y+7)
:X--
:End
:End
:End
:
:
:Lbl CC
:{r2/8*12+(r1/8)+GDB1}→r5
:{r4/8*12+(r3/8)+GDB1}→r6
:r5+r6→R
:Return
I just love function based programming so much :)
And so do I :D
-
uhh, a full commitment what I'm thinking of ?
lol.
-
could someone please show me how to do this in lua?
-
Flyingfisch, I would ask that question in a new thread in a different forum.
-
could someone please show me how to do this in lua?
Same principle, but a different syntax :)
-
If I have 4x4 tiles, I should change the /8 to /4 right? What does the x12 do?
-
I'm guessing the *12 was because in an 8*8-tile map, it's 12 tiles wide. For a 4*4-tile map it's 24 tiles wide.