Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

8 years ago by Jesse

I packaged up Lawnchair as a plugin for ImpactJS. I made a few small changes:

- Extended from Impact's ig.Class, doesn't need jQuery. This makes it possible to have a "MyStore" class that just extends from ig.Lawnchair, but passes the store settings to "parent" in its "init" method. This methodology makes the code much cleaner because you only have to configure Lawnchair in one spot, and you can stick your storage methods on that class, and not have them all over the place like in the Game class.

- Lives in the "ig" namespace: "ig.Lawnchair"

- Uses "staticInstantiate" to return the same store every time an ig.Lawnchair is created, just like ig.Image objects use the image's path to return the same ig.Image.

- Accepts a store name as the first parameter as a 'string' object in the constructor, as well as the original { name: 'example' } so you can do:
 var store = new ig.Lawnchair('teststore', function() { console.log('teststore is ready');  } );

- Has 3 built-in adapters: dom, memory, webkit-sqlite which are all pasted into the main plugin for less HTTP requests to get Lawnchair functionality.

- You should just need one request for the working library, and only more if you want the optional Lawnchair plugins

- Can pass in "adapterName" as a property of an object that you pass into the constructor if you prefer a certain adapter to be used everytime, but this isn't needed as you'll be given one automatically by Lawnchair

- Does not require a callback as the second constructor parameter, will use "callbackDefault" member of ig.Lawnchair object

- Supports Lawnchair plugins, although you'll have to change the reference of "Lawnchair" to ig.Lawnchair. You don't really need Lawnchair plugins to get and save data, they just make it easier to do so with syntax enhancements. You should just be good with the "impact-plugin" module.

Download it from GitHub:
https://github.com/jmo84/Lawnchair-plugin-for-ImpactJS/

Official Lawnchair site:
http://westcoastlogic.com/lawnchair/

8 years ago by paularmstrong

Forgive me, but... what is Lawnchair?

8 years ago by Hareesun

Boom. http://impactjs.com/tools :P

Lawnchair is a client side JSON document store. You can use it for savegames, local highscore lists and to store your game's settings.

8 years ago by Jesse

I'm using it for local storage for things like the players' "save files", their unlocked levels or game progress, and personal high scores. I'll also use the web for a global scoreboard, but I don't want my game to depend on signing into something to remember how good you did in a level, and I don't want my game to rely on being connected to the Internet. The game shows you your high score for a level, and can also show a "world" high score at the same time. I'm looking into using TapJS for my global game data.
Page 1 of 1
« first « previous next › last »