This site requires JavaScript, please enable it in your browser!
Greenfoot back
chlo
chlo wrote ...

2017/5/12

Need help with drawn image when it scrolls

chlo chlo

2017/5/12

#
I am currently in the process of making a game and I am having trouble with the Saturn level (SaturnGame) background that basically makes the stars background I drew look like it's being dragged across the screen every time I move the avatar, which is supposed to make the background scroll with it. Can anyone help me make the background flow more smoothly and not look like it's not dragging the stars as it scrolls with the avatar? You can find my code I used for it which is in the world SaturnGame, I'm a noob and don't exactly know how to upload scenarios into the discussion but you can find my game on my profile.
danpost danpost

2017/5/12

#
I knew there was an issue when I saw two 'new Scroll' lines in your SaturnWorld class. Remove the one with the 'stars' image and replace that line with the following ... on second though replace the following lines:
GreenfootImage stars = stars();
scroll  = new Scroll(stars, this);
stars();
with this one line:
getScrollBg.drawImage(stars(), 0, 0);
chlo chlo

2017/5/12

#
It works great!! thank you so much.
You need to login to post a reply.