1 decade ago by riceje7
ImpactJS-Plugins by Joe Rice
* * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * *
PersistantData Plugin
* * * * * * * * * * * * * * * * * * * * * * *
A plugin to maintain data between separate instances of ig.Game for ImpactJS.
Get it HERE
By injecting into
between instances of
Simply require
like normal, but instead pass an optional object as a an additional parameter to the
Example:
And its as simple as that. If anyone encounters any bugs, errors, or problems with the plugin
you can shoot me an email [mailto:joerice@foursquaregames.com HERE].
Let me know what you think!
* * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * *
PersistantData Plugin
* * * * * * * * * * * * * * * * * * * * * * *
A plugin to maintain data between separate instances of ig.Game for ImpactJS.
Get it HERE
By injecting into
ig.System
and ig.Game
this plugin will allow you to pass a data objectbetween instances of
ig.Game
. Simply require
game.plugins.PersistantData
in your module, then load your ig.Game
class like normal, but instead pass an optional object as a an additional parameter to the
ig.system.setGame()
function.Example:
ig.module('game.example').require('game.plugins.PersistantData').defines(function(){ Game1 = ig.Game.extend({ // Put your game code here as you normally would someData: { x: 100, y: 150 }, init: function(){ ig.system.setGame(Game2, { // Notice the extra parameter, which is an object. Though it passedData: this.someData // <==== can be of any data type. However to pass more than one piece of }); // data an object is needed. } }); Game2 = ig.Game.extend({ // Put your game code here as you normally would passedData: null, init: function(){ // Now you can access the object passed through ig.system.setGame through this.persistantData this.passedData = this.persistantData.passedData; } }); });
And its as simple as that. If anyone encounters any bugs, errors, or problems with the plugin
you can shoot me an email [mailto:joerice@foursquaregames.com HERE].
Let me know what you think!