Hey, just a quick question. What is the concept behind how to make something sidescrolling. Should I have a long image that it scrolls through left to right, or a series of images? And how would I go about doing this.
You can make a side scrolling by using a very large image (direct solution for the problem)
For this solution you can use 2 GreenfootImages, one for the image directory and other for the changing background, example: img2.drawImage(img1, -230, 0); this is a solution I found and use on my projects. Keep in mind that the image can't be too big or you'll get an error (Java heap space), and by big I mean the size in bytes.
Or you can make using tiles, which is pieces of images that compose the scene. I find this solution a bit harder, since it demands more code but saves a lot of bytes on the final jar.
There are scenarios in the gallery that show moving background.
-
giordanno92
Related to this, to stop actors getting stuck at the edges of the world, change the world constructor to "super(600, 600, 1, false)" (replacing "super(600, 600, 1)" - this assumes a 600x600 world, which is the default size)
As I noticed a few posts about side-scrolling on the forum, I've made this quick scenario which should hopefully help:
http://www.greenfoot.org/scenarios/3767