Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. /************************
  2. * validationEngaged.js *
  3. ************************
  4. *
  5. * They're really on to us now! The validateLevel function
  6. * has been activated to enforce constraints on what you can
  7. * do. In this case, you're not allowed to remove any blocks.
  8. *
  9. * They're doing all they can to keep you here. But you
  10. * can still outsmart them.
  11. */
  12.  
  13. function startLevel(map) {
  14. map.placePlayer(map.getWidth()-7, map.getHeight()-5);
  15.  
  16. var x = 0;
  17. var y = 0;
  18.  
  19. for (x = 0; x * y <= 104; x++) {
  20. for (y = 0; y <= map.getHeight() - 3; y++) {
  21. map.placeObject(x, y, 'block');
  22. }
  23. }
  24.  
  25. map.placeObject(7, 5, 'exit');
  26. }
  27.  
  28. function validateLevel(map) {
  29. numBlocks = 2 * (map.getHeight()-13) + 2 * (map.getWidth()-10);
  30.  
  31. map.validateAtLeastXObjects(numBlocks, 'block');
  32. map.validateExactlyXManyObjects(1, 'exit');
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement