Loading...

Another Vox Venio update.

It’s taken me far longer than expected to get parallax scrolling working. I wanted these features:

  • any number of layers
  • each layer has its own independent horizontal and vertical scrolling speeds
  • each layer can be shifted vertically and/or horizontally
  • any layer can be repeated vertically, horizontally, both, or neither

Turns out its fairly easy to do the first two points, but I found it difficult to incorporate the latter two points. It seems like it should be fairly simple maths but I can assure you it was melting my brain. (Heaven help me should I ever try working on a proper 3D game.)

In the video there are three background layers: the sky, the mountains and the trailer building. To implement them into the level simply required these lines in one of the level files:

# background texture          depth x   y   px  py  repHorz repVert
background   painted-hills-bg 0.5    0 -2   0.9 0.9 true    false
background   sky-1px          1.0   -1 -4   1.0 1.0 true    false
background   trailer          0.3   87  3.6 0.0 0.0 false   false

An unexpted side-effect of the way I implemented background layers is that you can use it to implement scenery-like pieces like the trailer.

It’s nice that it’s done. Now I can finally move on to other things…

blog comments powered by Disqus