![]() |
The JAM Object - Include backgrounds | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The JAM object can be set up to show several backgrounds and foregrounds, each with it's own semi-transparency and scroll speed.
To attatch a simple background to a frame:
That code creates a tiled background which follows the frame at normal speed. However, if we change the line:
to:
the background will scroll at twice the speed of the frame. Changing it to 0.5 makes it scroll at half speed, and so on. Suppose we want parallax scrolling? Not a problem:
Creates 5-layer parallax scrolling. We have 4 backgrounds; each at different speeds, and a foreground (foregrounds are the same as backgrounds, but go in front of the objects. All the features shown here for backgrounds can also be applied to foregrounds.) Note that to see the further back backgrounds, the ones in front must either have transparent areas, or must be set to semi-transparent (see further down) And remember that the scrolling speeds don't have to be in order. You could have the distance scrolling very fast, while the ground is barely moving. That'd confuse your players! You can also set backgrounds to move horizontally at a different speed to vertically:
makes the background scroll at half speed horizontally, and double speed vertically. You can use this to make backgrounds only scroll horizontally, etc. To make a background semitransparent, do this:
makes the background half-visible (0 = solid, 255 = invisible) Note that 2 commas are used in the first case. This is so that the JAM object doesn't get confused and think that you want the background to scroll vertically at a speed of 128! In the second example, we put a value between these commas which shows the speed that we actually want it to scroll vertically. Also note that the backmost background CANNOT have transparency applied to it. (but all foregrounds can) JAM © 2005 no one in particular Project started by David Evans in 2005 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||