These actions allow you to show visual and sound effects. The difference between them is that effect is a nuclear action that ends after its execution, while ambient effects perdure over time. For example, an effect can be a thunder, while an ambient can be rain.
- ambient ambient_id: param1: value1 param2: value2 - effect effect_id: param3: value3 param4: value4 - ambient CLEAR:
There are a few ambients and effects already coded, but these depend almost entirely on the kind of game you’re making. You can check the defined ambients and effects and tailor them to your needs. The effects and ambients usually use extra assets, either images, spritesheets, music and even code. All of this should be loaded in the extra section of the setup file. Check the Setup Guide for more info about this file.
The ambients are defined inside the file RenJS/Ambient.js, inside the map called RenJS.ambient. A special ambient called CLEAR takes care of stopping any ambient set before. Other ambients are:
To make your own effect you can either modify the ones already coded, or make a completely different thing taking advantage of the visual effects and sprite manipulation capabilities of Phaser. The only thing you should remember is to call the funtion RenJS.resolve() when you finish. This function tells the automat that controls the story that it can continue with the next action. Another usefull thing is to add a function to call when the ambient is cleared. You can push a function to RenJS.ambient.clearFunctions and it will be called when the ambient CLEAR is set. This way you can destroy any sprite, stop any music, etc, that your ambient uses.
Very similar to ambients, the effects are defined inside the RenJS/Effects.js file. Some of the effects available are:
- effect ROLLINGCREDITS: endGame: true text: - Thank you for playing - Game Name - null - made by - lunafromthemoon - null - with - RenJS - null - whatever else you want to say