/*========================================================================
====================
= Parallax Control =
====================
Arguments (taken from creation code):
num_bkgs : Number of backgrounds in the Room.
parallax[x] : Parallax Rate for background layer 'x'.
'x' must be an integer between 0 and 7 inclusive.
All values greater than zero are valid.
Higher values increase parallax speed.
A value of 10 moves the background with the port.
-1 Disables Parallax control (Useful for self-scrolling BKGs)
parallax_y[x] : Parallax rate for the 'y' axis of layer 'x'.
===========================================================================*/
// Loop for setting parallax for specified number of backgrounds.
var i1;
for (i1=0; i1<num_bkgs; i1+=1)
{
if parallax[i1] != -1 // If Sentinel value is not used
{
if parallax[i1] != 0 // Division by Zero Trap
background_x[i1] = view_xview[0]- view_xview[0]*(parallax[i1]/10.0)
else // Error Trap for Zero
background_x[i1] = view_xview[0]
//If parallax is also applied to the 'y' axis
if parallax_y[i1] !=0
{
background_y[i1] = view_yview[0] - view_yview[0]*parallax_y[i1]
}
}
}
====================
= Parallax Control =
====================
Arguments (taken from creation code):
num_bkgs : Number of backgrounds in the Room.
parallax[x] : Parallax Rate for background layer 'x'.
'x' must be an integer between 0 and 7 inclusive.
All values greater than zero are valid.
Higher values increase parallax speed.
A value of 10 moves the background with the port.
-1 Disables Parallax control (Useful for self-scrolling BKGs)
parallax_y[x] : Parallax rate for the 'y' axis of layer 'x'.
===========================================================================*/
// Loop for setting parallax for specified number of backgrounds.
var i1;
for (i1=0; i1<num_bkgs; i1+=1)
{
if parallax[i1] != -1 // If Sentinel value is not used
{
if parallax[i1] != 0 // Division by Zero Trap
background_x[i1] = view_xview[0]- view_xview[0]*(parallax[i1]/10.0)
else // Error Trap for Zero
background_x[i1] = view_xview[0]
//If parallax is also applied to the 'y' axis
if parallax_y[i1] !=0
{
background_y[i1] = view_yview[0] - view_yview[0]*parallax_y[i1]
}
}
}