Creating the parallax setting list:
New in release 2, you can now set all the default parallax settings for each map that will use a parralax background at the very beggining of the script. This is a sample line:
$map_parallax[ID]=Parallax.new("name", direction, speed,opacity,hue)
You can see 2 settings by default in the script, simply replace them by whatever you want. Replace ID with the map ID, and the other settings by what you want. To add more settings, just copy a line and paste it below the others. To delete settings, simply delete a line. To know how to use the syntax, read on.
To start a Parallax Background:
To start a parallax panoramas, you must insure that your panorama image file is 640X480 and is in the Panoramas directory of your project.
Remember than all parallax set in the script will automatically start upon map load. Which means you don't have to "start" them, nor do anything. Just try the demo, and change the starting position to the other map; you will see that the parallax will start automatically, even if there isn't any auto start or parallel process events on those maps !
But still, you may want to modify a parallax from within the game flow, so you can still do it as in Release 1, just a slight modification at the beggining of the syntax, that's all. So, if you want to re-start, start or modify a parralax, use the following syntax in a call script:
Code:
$parallax_active=true
$map_parallax[ID]=
Parallax.new("sky1", 4, 2,255,0)
(Explanation will follow)
Remember that now, you can modify a parallax setting for another map, even if you aren't in that map yet.
$map_parallax[ID]=Parallax.new(
"filename",
direction,
speed,
opacity, hue_color)
$map_parallax[ID] Is the name of your map parallax. It is now standard name, and you can't change it. Simply change the ID by the ID # of your map. So to use the parallax from map ID#4, you write "$map_parallax[4]".
Remember the following trick: As you can see in my demo, I oftenly uses the syntax
$map_parallax[$game_map.map_id], this is because $game_map.map_id contains the ID of the map you are in. So by using this instead of the raw ID#, I can simply copy and paste event from a map and another, without having to edit anything !
"filename" This is the exact file name of your panorama file, you can omit the file extention. But the name is case sensitve. The file must be in your Graphics\Panoramas folder in your game Project. And the file MUST be 640X480.
direction There you choose a direction in whicj the parallax will move. Here's the choices (Remember ! Those are the numbers on your keyboard's numpad... It's easy to remember !)
0 = Will not move
2 = Down
4 = Left
6 = Right
8 = Up
I still have to work on the 4 other directions, but they are harder to define...
speed Here you choose the speed of the moving panorama. If you set the speed to 0, it won't move either. There are 2 limits of speed:
Vertical Limit (up and down): 60
Horizontal Limit (left and right): 40
Don't worry, if you set the speed higher than that, the script automatically set the speed to the highest possible one.
opacity You choose the opacity of your parallax background here. 0 is transparent (invisible) and 255 is opaque (fully visible). This is useful mainly when used with fade in/out actions. (Explained later).
hue_color You can choose a hue color, just as with the character and fog. 0 will make no changes to the color. Experiment with it to create cool effects.
About Security:
I will tell you this right now, as it is important. As in my Memorize Location Script, I created a "security" variable that is turn to "true" (on) when a parallax is active on the map, and set to "false" (off) when there isn't. That way, you can encapsulate every actions like Erase Parallax, fade in/out and fade loop in a simple conditional branch that will check if that variable is true or not. If it is, you can go on with the actions, if not, you decide what the event will do.
The variable is called "$parallax_active". So to use it in your conditional branches, you simply choose the last page to the right (I think it is page 4) and you go to the last option to the bottom, named "Script". In there, you write this:
Code:
$parallax_active==true
Then, the events you add below it will execute if that is true, meaning if a parallax is active in the map, and you can use the Else Handler to add what happens if there isn't any. Look at my demo for example of this.
How to erase a parallax:
To erase a parallax, you use the following syntax:
Code:
$map_parallax[ID].erase
This will have the effect of erasing the parallax from the map, and it will also set the map default parallax empty. Which means that if you erase it, exit the map and come back, it gonna still be erased. If you just want to make it invisible for a while, just use a fade out.
The fade options:
There are 4 fade actions:
- Fade In
- Fade Out
- Fade Loop
- Stop fade
Here's the syntaxes for each:
FADE IN:
Code:
$map_parallax[ID].fade_in(speed)
FADE OUT:
Code:
$map_parallax[ID].fade_out(speed)
FADE LOOP:
Code:
$map_parallax[ID].fade_loop(speed)
STOP FADE:
Code:
$map_parallax[ID].stop_fade
"Speed" is the speed you want the fading to have, it's pretty simple. I don't have to explain what Fade In and Out do... I hope so. Fade Loop will simply loop the fade In and fade Out actions in queue; it will Fade In , then fade out, then fade in again, etc. Stop fade will stop a fade that is happening.
Conclusion:
So if anybody can help me with the diagonals direction, I'm all ears. I haven't yet try hard to find a solution, I was tired and I wanted to release the script before going to sleep... lol
Beside that, make sure to follow the guidelines the events tells you in my demo, and take care !
If you found any bug, reply to the post and I'll look into it !