Epic Blog of Awesome

code.tech.sci.math.art.write

Game Mechanic Explorer

A collection of concrete examples for various game mechanics, algorithms, and effects. The examples are all implemented in JavaScript using the Phaser game framework, but the concepts and methods are general and can be adapted to any engine. Think of it as pseudocode. Each section contains several different examples that progress in sequence from a very basic implementation to a more advanced implementation. Every example is interactive and responds to keyboard or mouse input or touch.

via Game Mechanic Explorer.

Save game data locally – Coding and Game Design – HTML5 Game Devs Forum

Its really just:

localStorage.setItem'myItemKey', 'myContent';
localStorage.getItem'myItemKey';

Only thing to keep in mind: localstorage can only store strings.So in order to store whole objects, do this:

localStorage.setItem'myObject', JSON.stringifymyObject;

and in reverse:

myObject = JSON.parselocalStorage.getItem'myObject';

via Save game data locally – Coding and Game Design – HTML5 Game Devs Forum.

JavaScript Programming Patterns « klauskomenda.com

JavaScript is meant to be used to add behaviour to a website, might it be for form validation or for more complex operations like drag & drop functionality or performing asynchronous requests to the webserver (aka Ajax). During the past few years, JavaScript libraries became increasingly popular. One of the reasons is definitely that websites are getting more and more complex and reinventing the wheel each time is not acceptable if you are working on a tight schedule. But letting aside libraries and focusing on the “bare” syntax of JavaScript, it is very valuable to know what kind of options you have in terms of programming patterns when writing JavaScript.

via JavaScript Programming Patterns « klauskomenda.com.