Hi folks, I'm creating a space shooter for learning purpose. I created an infinite background and all is working fine.
What If I wanted to create a structured background where for example the player at the beginning sees the Militaruy base, than he flyes over a desert, he sees rivers, piramids and other elements which stays in place and are not random sprites.
I mean what if I'd like to create a specific world to fly over?
My idea is to create a 720xThousands long bg sprite but I understand this is not doable because of system performance...or it is doable?
Just trying to understand the best practice. Thanks
The way I tackled this option:
I created several (The amount can change to your liking - obviously more is going to be a larger file) backgrounds
Each background was a small repeatable background (Or what you labeled an infinite background)
After I traveled 12000 distance units it would change to background 2 -> then 18000 changed to background 3
This allows you to show scenario changes while keeping each one smallish
If you use this:
I suggest setting your infinite background as you already made as animation 1 - then adding the 2nd 3rd etc as new animations
Oh this is a nice idea. Use one sprite with different animations. Sounds cool. I have to try it. Thanks for the tip.
Hi, how you calculate the distance units?
Develop games in your browser. Powerful, performant & highly capable.
I am not sure if there is a built in. But how I have done it before is with a check to verify the unit is moving. Then every tick add a fraction of that movespeed to the total distance traveled.