/usr/share/doc/sludge/SLUDGEDevKitHelp/parallaxAdd.html is in sludge-doc 2.2.1-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<TITLE>parallaxAdd</TITLE>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<BODY>
<HR>
<div align="center"><img id="headerGraphic" src="images/sludge300.png" alt="SLUDGE"/></div>
<h2>parallaxAdd</h2>
<HR>
<H3>Syntax:</H3>
<P>
<pre class="syntax">parallaxAdd (<i>thisFile, scrollSpeedX, scrollSpeedY</i>);</pre>
</P>
<H3>Purpose:</H3>
<P>
Loads an image from the file handle <i>thisFile</i> and uses it as a parallax layer,
visible behind the background image. Parallax layers can scroll at different speeds
to the background image, giving the illusion of depth to a scene as it moves.
</P>
<P>
The value <i>scrollSpeedX</i> specifies how fast the parallax image will move as a
percentage of the the background image as it scrolls. For example, if
<i>scrollSpeedX</i> is 50, for every 2 pixels the main scene moves the parallax
layer will move only 1. If you specify a scroll speed in this way, the width of
the image must be a power of two (i.e. the width must be 1, 2, 4, 8, 16, 32, 64,
128, 256, 512, 1024, 2048 etc. pixels) in order for proper tiling to occur... that
is, the image will repeat horizontally. The same is true of <i>scrollSpeedY</i>
which specifies how fast the image moves vertically as a percentage of the
movement of the main scene - if a value is specified here, the height of the
image must be a power of 2.
</P>
<P>
There is one special value which can be used in the place of either <i>scrollSpeedX</i>
or <i>scrollSpeedY</i> or neither or both at any time - and that value is the word
AUTOFIT. If <i>scrollSpeedX</i> is AUTOFIT, the horizontal scrolling speed of the
parallax layer is calculated automatically (and consequently, there's no way the
image will need to repeat, so the width need not be a power of 2). However, a new
rule is imposed if using this setting - the image must be as wide as, or wider than,
the game window. If <i>scrollSpeedY</i> is AUTOFIT, the vertical scrolling speed of
the layer is calculated automatically and the height need not be a power of 2 -
however, the height of the image must be greater than or equal to the height of
the game window. Got all that? Good.
</P>
<P>
One more thing - you can have multiple parallax layers at once, each with its
own pair of scrolling speeds. The most recently added parallax layer will be
visible through any areas of the scenery coloured bright cyan (0, 255, 255 or #00FFFF).
(Except for 32-bit images, where the alpha channel is used!) Should there be a
further parallax layer, it will be visible through any regions of the most recent
coloured bright cyan, and so on, and so on. So, when loading multiple layers using
this function, start with the furthest away. Also, for a realistic effect, make any
layers that are further away scroll more slowly than those that are nearer the scene.
</P>
<H3>Return value:</H3>
<P>
No return value.
</P>
<H3>Example:</H3>
<P>
<pre># The width and height of each of these must be a
# power of 2...
parallaxAdd ('stars.tga', 10, 10);
parallaxAdd ('mountains.tga', 25, 25);
# This image must be at least as wide and tall as
# the game window...
parallaxAdd ('town roofs.tga', AUTOFIT, AUTOFIT);</pre>
</P>
<H3>See also:</H3>
<P>
<a href="Scrolling_Scenes.html">Scrolling Scenes</a>
</P>
<P>
<a href="parallaxClear.html">parallaxClear</a>
</P>
<P class="copyright-notice">SLUDGE and this SLUDGE documentation are <A HREF="Copyright.html">copyright</A> Hungry Software and contributors 2000-2012
</P>
<HR>
</BODY>
</html>
|