#### Archived

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

# 360 degree scrolling smoothly?

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

## Recommended Posts

Hello Could some please tell me how to get smooth scrolling in any direction. What I have now only scrolls smoothly left right up or down and I cant make it scroll smooth any other direction. This also happens with the sprites in my asteroid game. I''m using floats for everything yet it still jumps quite often when not going up, down, left or right. I know it can be done because there''s games on the Amiga which dont have this problem (such as Project Buzzbar). Any ideas or suggestions would be great thanks.

##### Share on other sites
U could get a basic effect by scrolling by a Horizontal and a verticle, I mean scrolling by(-10,20) will give a different angle to (5, 10), if u need to work it out from an angle a simple bit of tring should enable u to do so.

##### Share on other sites
I've had a lot of success keeping it to 40 directions. Why 40 and not 32? Well, that's what the original Direct Draw game used WAYYYY back in 1995! Don't re-write code that you can steal.

Look in the Donuts source code for something looking like:
double Dirx[40] = ...
and Diry[40]

These are X and Y offsets for moving in 40 directions. You can make your own, but you'll come up with these exact same values. Just scale them bigger or smaller to fit your needs.

xPos += sin(direction); // VERY SLOW
xPos += dirX[direction]; // VERY FAST

-Michael

Edited by - Buster on 5/1/00 3:30:10 PM

##### Share on other sites
Hmmm...I just made sin and cos look-up tables (0 to 359), and whenver the player changed direction, it jumped 5 degrees (+ or -, accordingly), and when they moved forward, i did the velocity calculations on the fly. It worked fine for me.

##### Share on other sites
For my asteroids game I took the look up tables from Space Boudha (cant remember how to spell it) game from the Inside DX book, it works well but there is that occasional unsmooth movement, which looks really bad when the whole screen is scrolling maybe its my PC. Oh well thanks for sugestions.

• 10
• 13
• 52
• 11
• 15