Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stage {
- backdrop Rét("gallery:Nature/Field")
- let list = [ ];
- actor Animal {
- costume Dog("gallery:Animals/Dog Profile 1")
- costume Cat("gallery:Animals/Cat Profile 1")
- costume Frog("gallery:Animals/Frog Idle")
- costume Owl("gallery:Animals/Owl Idle")
- costume Starfish("gallery:Animals/Starfish Idle")
- costume Pigeon("gallery:Animals/Pigeon Idle")
- when stage.started {
- this.hide();
- if(this.cloneId == 0) {
- list = [ ];
- for(let i = 1; i <= 6; i++) {
- this.setCostume(i);
- createClone(this);
- }
- }
- }
- when cloned {
- list.push(this);
- this.setPosition(-350 + this.cloneId * 100, -100);
- this.size = Math.randomBetween(2, 8) * 20;
- this.show();
- }
- }
- actor Nyíl {
- costume Purple("gallery:Objects/Arrow Purple")
- function Swap(ii, jj) {
- let temp = list[ii];
- list[ii] = list[jj];
- list[jj] = temp;
- }
- function StageSwap(ii, jj) {
- let xpoz = list[jj].x;
- let ypoz = list[jj].y;
- list[jj].glideSecondsTo(0.5, list[ii].x, list[ii].y);
- list[ii].glideSecondsTo(0.5, xpoz, ypoz);
- }
- function Sort() {
- let i = 0;
- while(i < list.length - 1) {
- let j = i + 1;
- while(j < list.length) {
- list[i].y += 50;
- list[j].y += 50;
- this.wait(0.25);
- if(list[j].size < list[i].size) {
- this.Swap(i, j);
- this.StageSwap(i, j);
- }
- list[i].y -= 50;
- list[j].y -= 50;
- this.wait(0.25);
- j++;
- }
- i++;
- }
- }
- when clicked {
- this.Sort();
- }
- when stage.started {
- this.setPosition(250, 140);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement