Author Topic: scrolling tilemap  (Read 4696 times)

0 Members and 1 Guest are viewing this topic.

Shazane Koronova

  • Guest
scrolling tilemap
« on: January 16, 2007, 08:45:00 am »
I was talking about a collision detection problem, but after I fixed that I added more to the code and caused a much more complicated problem.

To create a large, scrolling tilemap I simply made the sprite's position remain constant, and instead of changing the sprite's coordinates I changed the x and y offset in the tilemap function.  

For movement purposes, it works! However, something is just off.  what is displayed is not aligned with what the processor reads, because I can walk through solid tiles, but not invisible tiles with an identical pattern to the real ones, but in a different place.

X and Y are the X offset and Y offset variables, the sprite's position on the screen is (40, 24), so how can I know what the starting values for X and Y should be to make sure it aligns and the right tiles are solid?

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
scrolling tilemap
« Reply #1 on: January 16, 2007, 11:19:00 am »
*Halifax looks back to his Xlib coding days
There are 10 types of people in this world-- those that can read binary, and those that can't.

Shazane Koronova

  • Guest
scrolling tilemap
« Reply #2 on: January 16, 2007, 03:19:00 pm »
Doesn't quite answer my question now does it?

Offline Jon

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 278
  • Rating: +0/-0
    • View Profile
scrolling tilemap
« Reply #3 on: January 16, 2007, 05:58:00 pm »
Are adding the sprite coordinates AND the tilemap offset?  If you only add the tilemap offset, it will check the tile at the topleft, and if you only add the sprite coordinates, then it will check somewhere in the top left of the tilemap, without any relevance to you.

Shazane Koronova

  • Guest
scrolling tilemap
« Reply #4 on: January 17, 2007, 12:08:00 pm »
Thank you!!! It works!!!!!!

Offline Jon

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 278
  • Rating: +0/-0
    • View Profile
scrolling tilemap
« Reply #5 on: January 18, 2007, 05:59:00 pm »
QuoteBegin-Shazane Koronova+17 Jan, 2007, 18:08-->
QUOTE (Shazane Koronova @ 17 Jan, 2007, 18:08)
Thank you!!! It works!!!!!!  

 Glad I could help. :)smile.gif  Good luck on your project! :thumbup:google.gif

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
scrolling tilemap
« Reply #6 on: January 19, 2007, 02:12:00 am »
mhmm btw are you making an asm scrolling tilemap or pure basic one? I am confused since i thought you were using TI-86 o.oblink.gif and there is no xLIB for TI-86

Shazane Koronova

  • Guest
scrolling tilemap
« Reply #7 on: January 19, 2007, 02:26:00 pm »
Oh, tis quite tragic.  EVERYTHING I did to link the wonderful 86 to any computer in the world was an appalling failure!

Sadly I surrendered and decided to try my 83+, but there is no MLC interpreter for the 83, which is what I really wanted to use.  I thought, "XLib! this may suffice!"  Hopefully my instincts betray me not.

My greatest fear is of the sheer lack of RAM on this TI-83 pieceofcrap... I hope I can even finish my project...    

Offline lolje

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 299
  • Rating: +2/-0
    • View Profile
scrolling tilemap
« Reply #8 on: April 25, 2007, 03:30:00 pm »
Well, you could also use the Sprite-Number as a trigger (walkable/non-walkable/building/unit...) and use the decimals in the matrix for life-points or Items;


an example (with xlib) :

Task:

1. Draw the Tilemap,Draw the Cursor(or whatever)-Sprite
    Walk on the Map to define the Coordinates

2. Get the Number of the Sprite (T)

3. Use the Number (T) as indicator for Walls/Ground/Buildings/Units or whatever comes to your mind

4. (optional) Call a subroutine or a Label in the Program
Note: When using Goto NEVER 'jump out' of a Loop or another Construction with an 'End' - otherwhise u'll end up with a huge memory leak in your program getting slower and slower until you get a 'Memory-Error'. The only construction you might use looks like this:

c1-->
CODE
ec1
:If X=1:Goto LB
83+/84+ xLIB projects
Age of culture II (~89%)

Contact: [email protected]