Jump to content
• Advertisement

#### Archived

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

# Scrolling, Edge Problem

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

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Alright, ive implemented a scrolling algorithm. The main variables are calculated like so:

/* tileX|tileY : tile in the top left hand corner
offsetX|offsetY : ''prestep'' or the amount of pixels to offset the tiles by
finishX|finishY : the tile coordinates of the bottom-right tile

// calculate the top-right tiles, >> = divide

tileX = drawX / m_TileWidth;
tileY = drawY / ( m_TileHeight / 2 );

// calculate the offsets

offsetX = drawX % m_TileWidth;
offsetY = drawY % ( m_TileHeight / 2 );

finishX = tileX + 20; // tileX + max amount displayable

finishY = tileY + 20; // see above

if ( finishX > m_MapWidth )
finishX = m_MapWidth;
if ( finishY > m_MapHeight )
finishY = m_MapHeight;

now this is great and all it smooth scrolls to a certain extent... But when tileX is increased there is a ''gap'' or blank space down the edge of the screen because the tiles in the column preceeding it are no longer displayed. I simple:
tileX--;
wont work because then the offset is out of place. Any ideas on how to fix this edge problem?

#### Share this post

##### Share on other sites
Advertisement
i fixed it myself... just did what i was doing a year back and drew a buffering tile...

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19
• Advertisement

• 11
• 15
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633004
• Total Posts
3009837
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!