// You can use a database to store persistent data.
// Persistent data stays the same between plays of your game!

var generator = game.spawnXY("generator", 60, 40);
generator.spawnType = "munchkin";
generator.spawnDelay = 1;
var player = game.spawnPlayerXY("raider", 36, 30);
player.maxHealth = 70;
player.attackDamage = 10;

// db stands for database
// db.add(key, value) increments a value stored in the database.
// This adds 1 to the "plays" key in the database.
db.add("plays", 1);

// Show the value of the "plays" and other keys in the db
ui.track(db, "plays");
ui.track(db, "wins");
ui.track(db, "total defeated");

ui.track(game, "time");

// Show the value of the "defeated" property of the game object
ui.track(game, "defeated");
// The code below will run when the player wins the game.
function onVictory(event) {
    db.add("wins", 1);
    // Use db.add(key, value) to add the value of
    // game.defeated to the database with the key "total defeated"
    db.add("total defeated",  game.defeated);

game.on("victory", onVictory);
















Projektuję strony www Lublin na Joomla i WordPress