Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. stage {
  2. backdrop Rét("gallery:Nature/Field")
  3. let list = [ ];
  4.  
  5. actor Animal {
  6. costume Dog("gallery:Animals/Dog Profile 1")
  7. costume Cat("gallery:Animals/Cat Profile 1")
  8. costume Frog("gallery:Animals/Frog Idle")
  9. costume Owl("gallery:Animals/Owl Idle")
  10. costume Starfish("gallery:Animals/Starfish Idle")
  11. costume Pigeon("gallery:Animals/Pigeon Idle")
  12. when stage.started {
  13. this.hide();
  14. if(this.cloneId == 0) {
  15. list = [ ];
  16. for(let i = 1; i <= 6; i++) {
  17. this.setCostume(i);
  18. createClone(this);
  19. }
  20. }
  21. }
  22. when cloned {
  23. list.push(this);
  24. this.setPosition(-350 + this.cloneId * 100, -100);
  25. this.size = Math.randomBetween(2, 8) * 20;
  26. this.show();
  27. }
  28. }
  29.  
  30. actor Nyíl {
  31. costume Purple("gallery:Objects/Arrow Purple")
  32. function Swap(ii, jj) {
  33. let temp = list[ii];
  34. list[ii] = list[jj];
  35. list[jj] = temp;
  36. }
  37. function StageSwap(ii, jj) {
  38. let xpoz = list[jj].x;
  39. let ypoz = list[jj].y;
  40. list[jj].glideSecondsTo(0.5, list[ii].x, list[ii].y);
  41. list[ii].glideSecondsTo(0.5, xpoz, ypoz);
  42. }
  43. function Sort() {
  44. let i = 0;
  45. while(i < list.length - 1) {
  46. let j = i + 1;
  47. while(j < list.length) {
  48. list[i].y += 50;
  49. list[j].y += 50;
  50. this.wait(0.25);
  51. if(list[j].size < list[i].size) {
  52. this.Swap(i, j);
  53. this.StageSwap(i, j);
  54. }
  55. list[i].y -= 50;
  56. list[j].y -= 50;
  57. this.wait(0.25);
  58. j++;
  59. }
  60. i++;
  61. }
  62. }
  63. when clicked {
  64. this.Sort();
  65. }
  66. when stage.started {
  67. this.setPosition(250, 140);
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement