HTML and CSS Reference
In-Depth Information
else
this.map.setObject(x, y, tile)
this.modified = true
}
},
cursorAt: function(point) {
//no action. Reserved for the game.
},
You need to use localStoage in order not to lose your work each time the page is updated. Of coure, you can also
provide a back end here:
load: function() {
if (localStorage['mapdata']) {
this.map.load(JSON.parse(localStorage['mapdata']));
this.modified = false
}
},
save: function() {
if (this.modified) {
localStorage['mapdata'] = JSON.stringify(this.map.save());
this.modified = false
}
}
}
Builder Window
Now, it's time to implement a window that will allow you to select a tile from a palette for a brush (see Figure 22-6 ).
Let's call the corresponding class BuilderWnd .
Figure 22-6. Builder window
 
Search WWH ::




Custom Search