Multiple Backgrounds for depth...
bladeolson
Member Posts: 295
This might be sort of a newbie question, but I am wondering what is the trick to make multiple backgrounds. You know the ones in many games have like a very far away backgound like a mountainside. Then a closer one like buildings or trees or something. Then the foreground where the game takes place. I see this in a lot of games. The look is something that makes it look like there is more depth. Can someone explain how this is done?
Comments
Is that what you are asking?
actor 1 - sky & clouds
actor 2 - mountains
actor 3 - trees
make actor 1 (the farthest away) move speed the smallest
make actor 2 have a movement speed between actor 1 and 3
make actor 3 move speed really high
this way they will move in different speeds, giving the idea of depth.
to make actors seem closer or farther away, play with the speeds.
http://itunes.apple.com/us/app/orbots-attack/id353356009?mt=8
They did some nice work with the 3d illusion by animating a little fog and out of focus buildings in the far distance with a foreground (the controls) sharp and the enemies as a mid range 3d graphic.
Very well done.
As for animation of layer actors (ie. scolling layered background elements at different speeds)...that's up to your creativity/imagination.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
You mean this example by Mr. Ford: http://gamesalad.com/game/play/33976
It *is* awesome...
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
one more question if you guys care. Does your character trigger these background movements as long as it is moving? or should this kind of movement just happen automatically?
So at the start , speed could = 0
Set the background motion to speed (which is 0) multiplied by 2, say. This would make the background stand still.
Then when you want it to start moving, trigger another variable (say, 'moving' to true).
Then if 'moving' = 'true'
Let speed = 10
This would then make the background move as its speed would be 20 (speed (10) * 2)
Does that make sense? It's 5am here so I may not have described it well enough - sorry!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Be sure to not display any imagery where it is not seen. Clip your images at the bottom where they are not visible. This will lighten the image load. Also...use 8 bit PNGs at ALL TIMES...unless transparency is involved.
Keep those images tight and efficient too.
I was thinking that too. How do you perform clipping? I would imagine it is some kind of rule that if things are not in the view area, don't make them visible. Any good examples?
I made the car parallax demo here with GameSalad that is mentioned above and the images are very small they neatly wrap left to right giving the illusion that they are very long, and each layer is also very shallow in height as they overlay each other.
So the file size is small and I have tested it on the iphone and it runs very fast - so anything is possible. Good luck
JCFord
Just make the image smaller then position the Y at its correct center point.
eg:
the background layer (the slow moving mountains) would be only 150 px tall (with 30 px to allow for overlap of the layer in front). So make the image 150 px tall and then position on the scene with the Y at 275 px. Then manipulate your X position to make it roll and wrap sideways.
Its that simple.
Repeat for each layer as you come forward.
Constrain self.x to scene.camera.x/2+(offset)
Constrain self.y to scene.camera.y/2+(offset)
To make a second layer that looks "farther away" make another prototype with behaviors:
Constrain self.x to scene.camera.x/5+(offset)
Constrain self.y to scene.camera.y/5+(offset)
The offset will center the image over the center of your scene. Remember this solution is for a platform jumper, so I bet it would be even easier to make one for a side scrolling shooter. My solution is also not necessarily the best, so anyone with good ideas on how to optimize this more I'm all ears.