Jump to content
  • Advertisement


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


Smooth Scrolling

This topic is 5539 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

I am making a 2d game in java, with 2 background planes, but when I make the scroll of this planes, adding or subtracting n units in the x coordinate (the near background moves faster than the far background plane) the scroll is not smooth, like in the comercial games, how I can do it smooth?

Share this post

Link to post
Share on other sites
I can think of a couple things:
(1) Use time-based movement. It may be that your framerate is just too low for the effect to work, so you are moving the layers too fast.

(2) Slow things down a bit...move the front layer back in 3d space so that it moves slower.

(3) Blur the faster moving layer- may not help much...but worth a try if all else fails.

If you have any issues with my answers...post an applet or some code so I can look at it.

Brian J
DL Vacuum - A media file organizer I made | Mumbling Miles - A band I was the guitarist/vocalist for

Share this post

Link to post
Share on other sites
the code is something like:

// in applet init
Image layer1 = getImage(...,"layer1.gif");
Image layer2 = getImage(...,"layer2.gif");

// in applet paint

// in main loop
offset = 10;

if (rightPressed) { layer1_x -= offset; layer2_x -= offset/2; }
if (leftPressed) { layer1_x += offset; layer2_x += offset/2; }


Share this post

Link to post
Share on other sites
Set the offset lower...that will definately make it smoother, but also slower. I can''t tell you anything else except to increase your FPS. If you have some sort of timer or something that limits the framerate, try lowering the time between frames.

Share this post

Link to post
Share on other sites

  • Advertisement

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!