Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Infinite Scrolling background?  (Read 2767 times)
0 Members and 1 Guest are viewing this topic.
Offline Jwraith

Junior Newbie

« Posted 2005-09-23 23:37:27 »


Basically, I want to add a background layer that would scroll infinitly. You know, such as a "clouds" layer that would scroll across the background of my level slowly...but would never end.

I'm not so much looking for code on how to do this....just help on an algorithm that could do this.

As much as I could figure so far would be to use two identical pictures (both bigger than the display size) and as one is X pixels away from the edge of it being the edge of the screen, start drawing the second picture after it so it smoothly scrolls on...then repeat the process as it reaches the end of the second picture (but switching back to drawing the first).

Though for some reason I cant settle on that idea, maybe I'm just paranoid or whatever....but I figured I'd ask and see if anyone can comment on my plan? I havent had a chance to try coding it yet as this isnt my machine I am posting from Smiley

-All that is needed for evil to triumph is for good men to do nothing-
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #1 - Posted 2005-09-24 00:21:44 »

Usually tiles are used. Since the background doesnt need that much variation (compared to the foreground)  you can use rather big tiles there... like 128x128.

弾幕 ☆ @mahonnaiseblog
Offline Jeff

JGO Coder

Got any cats?

« Reply #2 - Posted 2005-09-24 04:30:28 »

You can also do it with a tilable image that is at elast the size of the screen.  You just "wrap" ity by doing two BLTs.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Pages: [1]
  ignore  |  Print  

hadezbladez (761 views)
2018-11-16 13:46:03

hadezbladez (394 views)
2018-11-16 13:41:33

hadezbladez (758 views)
2018-11-16 13:35:35

hadezbladez (200 views)
2018-11-16 13:32:03

EgonOlsen (2401 views)
2018-06-10 19:43:48

EgonOlsen (2581 views)
2018-06-10 19:43:44

EgonOlsen (1486 views)
2018-06-10 19:43:20

DesertCoockie (2149 views)
2018-05-13 18:23:11

nelsongames (1967 views)
2018-04-24 18:15:36

nelsongames (2648 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!