#### Archived

This topic is now archived and is closed to further replies.

# Smooth Scrolling, whats wrong here?

This topic is 6257 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

well, i''m trying to implement smooth scrolling, i.e. tiles move smoothly and not "jumping" so:
  void CRTSMap::Draw(LPDIRECTDRAWSURFACE7 lpDD) { int SmoothX, SmoothY;//this is how much to actually move the map SmoothX=dx%TILEWIDTH; SmoothY=dy%TILEHEIGHT; // grr, the problem int DeltaX, DeltaY;//this is how much whole tiles to change DeltaX=dx/(TILEWIDTH); DeltaY=dy/(TILEHEIGHT/2); if (DeltaY%2) DeltaY++;// this is to fix a "snake prob" ill xpand later int ScreenX, ScreenY; for (int CountY=0;CountY<47;CountY++) { ScreenY=(CountY*TILEHEIGHT); for (int CountX=0;CountX<12;CountX++) { if (CountY%2) { ScreenX=(CountX*TILEWIDTH); } else { ScreenX=(CountX*TILEWIDTH)+(TILEWIDTH/2)-TILEWIDTH; }; if((-DeltaX+CountX>=0)&&(-DeltaY+CountY>=0)&&(-DeltaX+CountXDrawTransparant(lpDD,ScreenX+SmoothX,ScreenY+SmoothY); }; }; }; 
it work "smoothly" for the x axis, but for the y axis theres a "jumping" problem. i know its bcoz i fixed the snake prob, but dunno how to fix tha fix. i know how i sound, but its 4:44am here Gil p.s. snake prob: since my map isnt diamond, a column goes zigzag like staggered tilemaps (TANSTAAFL''s book abt isometrix). so this line is to fix a prob where the zigzag mirrors. p.p.s gotta get some sleep, plz help whoever reads so far and i''m not awake... i''m not making any sense now, am i?

##### Share on other sites
hmm.. methinks that ScreenY=(CountY*TILEHEIGHT); should be after the nested loop, not before. hope dat helps
~~KaMiKaZ~~

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 12
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632991
• Total Posts
3009752
• ### Who's Online (See full list)

There are no registered users currently online

×