Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. # You can use a database to store persistent data.
  2. # Persistent data stays the same between plays of your game!
  3.  
  4. generator = game.spawnXY("generator", 60, 40)
  5. generator.spawnType = "munchkin"
  6. player = game.spawnHeroXY("raider", 15, 15)
  7. player.maxHealth = 9000
  8. player.attackDamage = 9000
  9. game.addSurviveGoal(20)
  10.  
  11. # db stands for database
  12. # db.add(key, value) increments a value stored in the database.
  13. # This adds 1 to the "plays" key in the database.
  14. db.add("plays", 1)
  15.  
  16. # Show the value of the "plays" key in the db
  17. ui.track(db, "plays")
  18.  
  19. # Show the value of the "defeated" property of the game object
  20. db.set("defaeted", game.defeated)
  21. # The code below will run when the player wins the game.
  22. def onVictory(event):
  23. pass
  24. # Use db.add(key, value) to add the value of
  25. # game.defeated to the database with the key "defeated"
  26. db.add("plays", 1)
  27.  
  28. game.on("victory", onVictory)
  29. ui.track(game, "defeated")
  30. game.adddeafeated
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement