Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Side scrolling..

Author
Message
ADGamer
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location:
Posted: 17th Apr 2005 02:47 Edited at: 1st Jul 2009 08:44
6

NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 17th Apr 2005 19:20 Edited at: 17th Apr 2005 19:20
Mantis Games,

I have written a very simple program which scrolls an image continually from left to right. I used only one image, but had to load it twice, due to the need of two seperate images. The effect is simply achieved by decrementing the x coordinate variable for each image. This would be the x coordinate for the left side of each of the two images.

If their x coordinate becomes less than the width of the image(in this case, 800 pixels), then that image is placed exactly one pixel to the right of the other image. This creates the seamless scrolling. Yes, I believe this is the only reasonable method to create this effect.

As a note, if you are using more than two images to scroll, then I would suggest not pasting the image to the screen, unless the image's x coordinate is equal or lesser than the x coordinate of the right side of the screen. This will probably save much trouble from your processor.

I have attached to this post the source code and single image file I have created for this experiment.

+NanoBrain+

Attachments

Login to view attachments
ADGamer
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location:
Posted: 18th Apr 2005 05:35 Edited at: 1st Jul 2009 08:44
3

Login to post a reply

Server time is: 2025-05-23 10:39:02
Your offset time is: 2025-05-23 10:39:02