Untitled
unknown
plain_text
2 years ago
4.7 kB
14
Indexable
stage {
backdrop White("gallery:General/White")
let matrix = [ ];
let grid = 4;
let locked = false;
actor Cat_Puzzle {
costume Puzzle_Pieces_1("gallery:Games/Cat Puzzle Pieces 1")
costume Puzzle_Pieces_2("gallery:Games/Cat Puzzle Pieces 2")
costume Puzzle_Pieces_3("gallery:Games/Cat Puzzle Pieces 3")
costume Puzzle_Pieces_4("gallery:Games/Cat Puzzle Pieces 4")
costume Puzzle_Pieces_5("gallery:Games/Cat Puzzle Pieces 5")
costume Puzzle_Pieces_6("gallery:Games/Cat Puzzle Pieces 6")
costume Puzzle_Pieces_7("gallery:Games/Cat Puzzle Pieces 7")
costume Puzzle_Pieces_8("gallery:Games/Cat Puzzle Pieces 8")
costume Puzzle_Pieces_9("gallery:Games/Cat Puzzle Pieces 9")
costume Puzzle_Pieces_10("gallery:Games/Cat Puzzle Pieces 10")
costume Puzzle_Pieces_11("gallery:Games/Cat Puzzle Pieces 11")
costume Puzzle_Pieces_12("gallery:Games/Cat Puzzle Pieces 12")
costume Puzzle_Pieces_13("gallery:Games/Cat Puzzle Pieces 13")
costume Puzzle_Pieces_14("gallery:Games/Cat Puzzle Pieces 14")
costume Puzzle_Pieces_15("gallery:Games/Cat Puzzle Pieces 15")
costume Puzzle_Pieces_16("gallery:Games/Cat Puzzle Pieces 16")
costume Puzzle_Full("gallery:Games/Cat Puzzle Full")
costume Puzzle_Pieces("gallery:Games/Cat Puzzle Pieces")
let i = 0;
let j = 0;
function slide(p, ind, row, col) {
if(locked) {
if(ind != p) {
if(matrix[this.i + row][this.j + col] == 0) {
locked = false;
matrix[this.i][this.j] = 0;
matrix[this.i + row][this.j + col] = this;
this.i = this.i + row;
this.j = this.j + col;
this.glideSecondsTo(0.1, this.x + col * 91, this.y - row * 91);
this.wait(0.2);
}
}
}
}
when clicked {
if(locked) {
this.slide(3, this.i, 1, 0);
this.slide(0, this.i, -1, 0);
this.slide(3, this.j, 0, 1);
this.slide(0, this.j, 0, -1);
locked = true;
}
}
when cloned {
this.hide();
let id = this.cloneId - 1;
this.j = id % grid;
this.i = (id - this.j) / grid;
matrix[this.i][this.j] = this;
this.setCostume(id + 1);
}
when stage.started {
this.setPosition(0, 0);
this.opacity = 100;
this.size = 75;
this.setCostume(17);
this.show();
for(let i = 1; i <= 100; i++) {
this.wait(0.05);
this.opacity -= 1;
}
stage.broadcast("start");
}
}
actor Bomber_Cat {
costume Idle("gallery:Animals/Bomber Cat Idle")
function createMatrix(row, col) {
matrix = [ ];
for(let i = 0; i < row; i++) {
let list = [ ];
for(let j = 0; j < col; j++) {
list.push(0);
}
matrix.push(list);
}
}
function createClones(n) {
for(let i = 1; i <= n; i++) {
createClone(Cat_Puzzle);
}
}
function showMatrix(row, col) {
let y = 137;
for(let i = 0; i < row; i++) {
let x = -137;
for(let j = 0; j < col; j++) {
let item = matrix[i][j];
if (item != 0) {
item.setPosition(x, y);
item.size = 74;
item.show();
}
x += 91;
}
y -= 91;
}
}
when stage.started {
this.setPosition(-250, -50);
this.size = 180;
this.setCostume(this.Idle);
this.createMatrix(grid, grid);
this.createClones(grid * grid - 1);
this.show();
this.wait(1);
this.say("Welcome to the CAT PUZZLE game! Arrange the tiles in order to create the original picture!");
this.wait(4);
this.say("");
this.wait(1);
this.showMatrix(grid, grid);
locked = true;
}
}
}Editor is loading...
Leave a Comment