I have been having a really frusterating problem with tilemaps recently, where the player/cursor position is incremented differently than where in the tilemap is being displayed.

What I need is a tilemap in which the player/cursor moves at the same speed as the displayed tiles.

I have attempted to correct the issue by using another variable which is incremented/decremented whenever the tilemap moves, but that does not seem to work.

Help would be much appreciated.

Screenshot

Code:

Lbl TILEMAP
ZeroScreen
0->ALLOWZERO
*{FILEPTR->SS
{FILEPTR+1->NS
{TILEMAP->MAPD
{TILEMAP+3->SPTRS
*{TILEMAP+12->TMYM
*{TILEMAP+13->TMXM
*{TILEMAP+9->CCMX/2->CCX
*{TILEMAP+8->CCMY/2->CCY
While 1
   det(49,TILEMAP,SS*TMCX,SS*TMCY
   SetColor(255
   Rectangle(SS*TMCX,SS*TMCX,SS,SS
   *{FILEPTR->A
   Rectangle(0,209-A,A+2,A+2
   Rectangle(A+1,209-A,A+2,A+2
   Sprite({SPTRS+TILIX*3},1,210-A
   *{MAPD+TMXM*TMCY+TMCX->V
   Sprite({SPTRS+V*3},A+2,210-A
   SetColor(0
   FillRectangle(180,201,140,18
   SetTextXY(180,201
   PrintString("tile index:
   PrintInt(TILIX,3
   SetTextXY(180,210
   PrintString("map value:
   PrintInt(V,3
   SetColor(255
   HorizLine(0,220,320
   PrintStringXY("get",1,221
   PrintStringXY("tile-",210,221
   PrintStringXY("tile+",270,221
   Call K
   If K=15 or K=55
      Goto TILESET
   End
   min(TMXM,~1+max(1,1+TMCX+(K=3)-(K=2->TMCX
   min(TMYM,~1+max(1,1+TMCY+(K=1)-(K=4->TMCY
   If K=54 or K=9
      TILIX->*{MAPD+TMXM*TMCY+TMCX
   End
   If K=48 or K=53
      *{MAPD+TMXM*TMCY+TMCX->TILIX
   End
   TILIX+(K=49)-(K=50->TILIX
   If TILIX=NS
      0->TILIX
   End
   If TILIX=~1
      NS-1->TILIX
   End
   If K=56
      Goto EXPORTTM
   End
End


EDIT: made my own renderer for now.
relative offset = absolute offset - tilemap offset

You don't follow this when you draw your relatively offset items, such as the square.
MateoConLechuga wrote:
relative offset = absolute offset - tilemap offset

You don't follow this when you draw your relatively offset items, such as the square.


yes, but where do I get those variables?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement