Advertisement
Guest User

Untitled

a guest
May 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 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. map.placeObject(1, 1, 'block');
  16. map.placeObject(1, 2, 'block');
  17. map.placeObject(1, 3, 'block');
  18. map.placeObject(1, 4, 'block');
  19. map.placeObject(1, 5, 'block');
  20. map.placeObject(1, 6, 'block');
  21. map.placeObject(1, 7, 'block');
  22. map.placeObject(1, 8, 'block');
  23. map.placeObject(1, 9, 'block');
  24. map.placeObject(1, 10, 'block');
  25. map.placeObject(1, 11, 'block');
  26.  
  27. for (y = 10; y <= map.getHeight() - 3; y++) {
  28.  
  29. map.placeObject(map.getWidth() - 5, y, 'block');
  30. }
  31.  
  32. for (x = 5; x <= map.getWidth() - 5; x++) {
  33. map.placeObject(x, 10, 'block');
  34. map.placeObject(x, map.getHeight() - 3, 'block');
  35. }
  36.  
  37. map.placeObject(7, 5, 'exit');
  38. }
  39.  
  40. function validateLevel(map) {
  41. numBlocks = 2 * (map.getHeight()-13) + 2 * (map.getWidth()-10);
  42.  
  43. map.validateAtLeastXObjects(numBlocks, 'block');
  44. map.validateExactlyXManyObjects(1, 'exit');
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement