Jump to content
  • Advertisement
Sign in to follow this  
erdirck

[java] switching backgrounds

This topic is 3123 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 having trouble thinking up an algorithm to switch backgrounds with a transition in the middle. I am making a side-scroller and the backgrounds move with a constant speed. When the background hits the bottom of the windows screen the background resets to the top of the screen. I draw two background to avoid seems. My code looks like this: public void update () { posY += speed; if (posY >= 600) { this.posY = posY - 600; } } public void paint(Graphics g) { g.drawImage(pic, posX, posY, null); g.drawImage(pic, posX, posY - backgroundOne.getHeight(null), null); } I am trying to get it so the background pics switches to another transition pic and then switches to another background pic seamlessly when say the player reaches a certain score to progress to the next level. Any ideas or algorithms? Any thoughts would be appreciated. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!