I want to store the currency of my Incremental Game buy clicking on a button.
This is the code:
$('#saveGame').click(function() {
localStorage.setItem('evoAmountKey','evoAmount');
});
and to load the save i used:
$('#loadGame').click(function() {
localStorage.getItem('evoAmountKey','evoAmount');
});
but it doesn't work. And how do i save something if the var looks like this?:
var hunter = {
Amount: 0,
Cost: 75,
Increment: 5
};
can i simply type:
$('#load/saveGame').click(function() {
localStorage.getItem('hunterKey','hunter.Amount','hunter.Cost', 'hunter.Increment');
});
Can you give me a example please :)