ImpactStorage
view other work
// Including ImpactStorage in your ImpactJS project
ig.module(
'game.main'
)
.requires(
'impact-game',
...
'plugins.impact-storage',
...
)
// Create a ImpactStorage object
storage: new ig.Storage();
// Storing JSON objects example
this.storage = new ig.Storage();
/*
Player's velocity is an object stored as
vel: {x: 200, y: 100}
And that data is now being stored with key playerVel
in localStorage
*/
var player = this.getEntitiesByType(EntityPlayer)[0];
this.storage.set('playerVel',player.vel)
// And let's output it for fun
alert('Player x velocity: '+this.storage.get('playerVel').x);
alert('Player y velocity: '+this.storage.get('playerVel').y);
ImpactStorage
- role: sole developer
- tech: js, ImpactJS
- source: GitHub
ImpactStorage is a plugin for HTML5/js game framework ImpactJS, giving developers an easy-to-use interface to localStorage for their projects. Mostly a facade for localStorage, ImpactStorage is set up to bake with your ImpactJS project, take care of some error handling, some convenience methods, as well as support objects in addition to strings.
Check out all the methods available on GitHub.