Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. stage {
  2. backdrop White("gallery:General/White")
  3. let matrix = [];
  4. let grid = 9;
  5. let game = false;
  6.  
  7. function creatematrix() {
  8. for(let i = 1; i <= grid + 2; i++) {
  9. let list = [];
  10. for(let j = 1; j <= grid + 2; j++) {
  11. list.push(0);
  12. }
  13. matrix.push(list);
  14. }
  15. }
  16.  
  17. function cloning(n) {
  18. for(let i = 1; i <= n; i++) {
  19. createClone(Square);
  20. }
  21. }
  22.  
  23. function showmatrix() {
  24. let y = 150;
  25. for(let i = 1; i <= grid; i++) {
  26. let x = -50;
  27. for(let j = 1; j <= grid; j++) {
  28. let item = matrix[i][j];
  29. item.setPosition(x, y);
  30. item.show();
  31. x += 29;
  32. }
  33. y -= 29;
  34. }
  35. }
  36.  
  37.  
  38. actor Robot {
  39. costume GameOver("gallery:Text/Game Over 1")
  40. costume Winner("gallery:Text/Winner Blue")
  41.  
  42. when stage.started {
  43. this.hide();
  44. this.size = 50;
  45. this.setPosition(-200, 0);
  46. matrix = [];
  47. creatematrix();
  48. cloning((grid + 2) * (grid + 2));
  49. Ball.say("");
  50. showmatrix();
  51. }
  52.  
  53.  
  54. }
  55.  
  56. actor Square {
  57. costume One("gallery:Text/One")
  58. costume Two("gallery:Text/Two")
  59. costume Three("gallery:Text/Three")
  60. costume Four("gallery:Text/Four")
  61. costume Five("gallery:Text/Five")
  62. costume Six("gallery:Text/Six")
  63. costume Seven("gallery:Text/Seven")
  64. costume Eight("gallery:Text/Eight")
  65. costume Blue("gallery:Objects/Square Blue")
  66. costume Grey("gallery:Objects/Square Grey")
  67. costume Bomb("gallery:Objects/Bomb Explode")
  68. let i = 0;
  69. let j = 0;
  70.  
  71. when stage.started {
  72. this.hide();
  73. this.size = 100;
  74. }
  75.  
  76. when cloned {
  77. this.setCostume(9);
  78. let id = this.cloneId - 1;
  79. j = id % (grid + 2);
  80. i = (id - j) / (grid + 2);
  81. matrix[i][j] = this;
  82. }
  83.  
  84. }
  85.  
  86. actor Ball {
  87. costume Green("gallery:Objects/Ball Green")
  88. costume Red("gallery:Objects/Ball Red")
  89.  
  90. when stage.started {
  91. this.setPosition(-200, -100);
  92. this.setCostume(2);
  93. this.say("Minesweeper game: try to avoid bombs and uncover all other tiles!");
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement