Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => Topic started by: Shazane Koronova on January 16, 2007, 08:45:00 am

Title: scrolling tilemap
Post by: Shazane Koronova 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?
Title: scrolling tilemap
Post by: Halifax on January 16, 2007, 11:19:00 am
*Halifax looks back to his Xlib coding days
Title: scrolling tilemap
Post by: Shazane Koronova on January 16, 2007, 03:19:00 pm
Doesn't quite answer my question now does it?
Title: scrolling tilemap
Post by: Jon 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.
Title: scrolling tilemap
Post by: Shazane Koronova on January 17, 2007, 12:08:00 pm
Thank you!!! It works!!!!!!
Title: scrolling tilemap
Post by: Jon 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
Title: scrolling tilemap
Post by: DJ Omnimaga 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
Title: scrolling tilemap
Post by: Shazane Koronova 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...    
Title: scrolling tilemap
Post by: lolje 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