I’m building a 2D game in which the player is constantly moving in the upward direction and when the player reaches the max height visible (e.g 480) then the layer moves down.
But the problem is that my FPS drops when I’m adding a larger background (e.g 8192) in height.
My questions are:
-
Should I re-use the same backgrounds again and again or should I look for something else?
-
I have learned about TileMaps that their cab be a very huge layer which are rendered easily by the iPhone.
-
Should I use the parallax scrolling or not?
You should cut the large background into equal smaller ones.
You most likely don’t need tile map for vertical scrolling. Just add your smaller backgrounds in an array and show only those that are visible to player.
On the example I’m updating only
BG1,BG2andBG3parts. WhenBG1go off the screen, I will remove it and addBG4aboveBG3. The same goes withBG5,BG6, etc.You could also create infinitely looped background by sorting an array with smaller background parts.
Use of parallax scrolling depends on your game art. Parallax effect is created by two or more background layers scrolled with different speed. Watch some videos to understand it better.