Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # You can use a database to store persistent data.
- # Persistent data stays the same between plays of your game!
- generator = game.spawnXY("generator", 60, 40)
- generator.spawnType = "munchkin"
- player = game.spawnHeroXY("raider", 15, 15)
- player.maxHealth = 9000
- player.attackDamage = 9000
- game.addSurviveGoal(20)
- # 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" key in the db
- ui.track(db, "plays")
- # Show the value of the "defeated" property of the game object
- db.set("defaeted", game.defeated)
- # The code below will run when the player wins the game.
- def onVictory(event):
- pass
- # Use db.add(key, value) to add the value of
- # game.defeated to the database with the key "defeated"
- db.add("plays", 1)
- game.on("victory", onVictory)
- ui.track(game, "defeated")
- game.adddeafeated
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement