Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. stage {
  2. scene White("gallery:Generic/White")
  3. let ROW = 6;
  4. let Cols = 12;
  5. let matr = 0;
  6.  
  7. actor Robot {
  8. costume Idle("gallery:Figures/Robot Idle")
  9.  
  10. @editorPosition(100, 100)
  11. function CreateMatrix(rows, cols) {
  12. let i = 0;
  13. let matr = [];
  14. while(i < rows) {
  15. let list = [];
  16. let j = 0;
  17. while(i < rows) {
  18. list.push(0);
  19. j++;
  20. }
  21. matr.push(list);
  22. i++;
  23. }
  24. }
  25.  
  26. @editorPosition(100, 100)
  27. function ShowMatrix(rows, cols) {
  28. let i = 0;
  29. let Y = 130;
  30. while(i < rows) {
  31. let j = 0;
  32. let X = -280;
  33. while(j < cols) {
  34. let item = matr[i][j];
  35. item.setPosition(X, Y);
  36. item.setCostume(Math.randomBetween(1, 3));
  37. item.show();
  38. X += 50;
  39. j++;
  40. }
  41. Y -= 50;
  42. i++;
  43. }
  44. }
  45.  
  46. @editorPosition(100, 100)
  47. function CreateClones(N) {
  48. for(let i = 1; i <= N; i++) {
  49. stage.createClone(Button);
  50. }
  51. }
  52.  
  53. @editorPosition(10, 10)
  54. when stage.started {
  55. CreateMatrix(ROWS, COLS);
  56. CreateClones(ROWS * COLS);
  57. this.hide();
  58. ShowMatrix(ROWS, COLS);
  59. }
  60.  
  61. }
  62.  
  63. actor Gomb {
  64. @bubblePosition(0.7, 0.65)
  65. costume Blue("gallery:Objects/Button Blue")
  66. @bubblePosition(0.7, 0.65)
  67. costume Lilac("gallery:Objects/Button Purple")
  68. @bubblePosition(0.7, 0.65)
  69. costume Green("gallery:Objects/Button Green")
  70.  
  71. when cloned {
  72. let id = this.cloneId - 1;
  73. let j = id % COLS;
  74. let i =(id - j)/ COLS;
  75. matr[i][j] = this;
  76.  
  77. }
  78. when stage.started{
  79. this.hide();
  80. }
  81.  
  82. }
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement