Guest User

Untitled

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