mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
Apply prettier to css, html, js, md, ts, and yml (#1249)
* Apply prettier to css, js, html, md, ts, and yml As a followup I will add prettier to the .pre-commit config. This patch is 100% generated by prettier. I used a forked version of prettier that understands the py-script tag. See https://github.com/hoodmane/pyscript-prettier-precommit for more info. * Apply old pre-commit * Revert some problems * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert some changes * More changes * Fix pre-commit * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var Level = Mario.Level = function(options) {
|
||||
(function () {
|
||||
var Level = (Mario.Level = function (options) {
|
||||
this.playerPos = options.playerPos;
|
||||
this.scrolling = options.scrolling;
|
||||
this.loader = options.loader;
|
||||
@@ -55,164 +55,241 @@
|
||||
this.scenery[i] = [];
|
||||
this.blocks[i] = [];
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Level.prototype.putFloor = function(start, end) {
|
||||
Level.prototype.putFloor = function (start, end) {
|
||||
for (var i = start; i < end; i++) {
|
||||
this.statics[13][i] = new Mario.Floor([16*i,208], this.floorSprite);
|
||||
this.statics[14][i] = new Mario.Floor([16*i,224], this.floorSprite);
|
||||
this.statics[13][i] = new Mario.Floor([16 * i, 208], this.floorSprite);
|
||||
this.statics[14][i] = new Mario.Floor([16 * i, 224], this.floorSprite);
|
||||
}
|
||||
};
|
||||
|
||||
Level.prototype.putGoomba = function(x, y) {
|
||||
this.enemies.push(new Mario.Goomba([16*x, 16*y], this.goombaSprite() ));
|
||||
Level.prototype.putGoomba = function (x, y) {
|
||||
this.enemies.push(new Mario.Goomba([16 * x, 16 * y], this.goombaSprite()));
|
||||
};
|
||||
|
||||
Level.prototype.putKoopa = function(x, y) {
|
||||
this.enemies.push(new Mario.Koopa([16*x, 16*y], this.koopaSprite(), false));
|
||||
Level.prototype.putKoopa = function (x, y) {
|
||||
this.enemies.push(
|
||||
new Mario.Koopa([16 * x, 16 * y], this.koopaSprite(), false),
|
||||
);
|
||||
};
|
||||
|
||||
Level.prototype.putWall = function(x, y, height) {
|
||||
Level.prototype.putWall = function (x, y, height) {
|
||||
//y is the bottom of the wall in this case.
|
||||
for (var i = y-height; i < y; i++) {
|
||||
this.statics[i][x] = new Mario.Floor([16*x, 16*i], this.wallSprite);
|
||||
for (var i = y - height; i < y; i++) {
|
||||
this.statics[i][x] = new Mario.Floor([16 * x, 16 * i], this.wallSprite);
|
||||
}
|
||||
};
|
||||
|
||||
Level.prototype.putPipe = function(x, y, height) {
|
||||
Level.prototype.putPipe = function (x, y, height) {
|
||||
for (var i = y - height; i < y; i++) {
|
||||
if (i === y - height) {
|
||||
this.statics[i][x] = new Mario.Floor([16*x, 16*i], this.pipeLEndSprite);
|
||||
this.statics[i][x+1] = new Mario.Floor([16*x+16, 16*i], this.pipeREndSprite);
|
||||
this.statics[i][x] = new Mario.Floor(
|
||||
[16 * x, 16 * i],
|
||||
this.pipeLEndSprite,
|
||||
);
|
||||
this.statics[i][x + 1] = new Mario.Floor(
|
||||
[16 * x + 16, 16 * i],
|
||||
this.pipeREndSprite,
|
||||
);
|
||||
} else {
|
||||
this.statics[i][x] = new Mario.Floor([16*x, 16*i], this.pipeLMidSprite);
|
||||
this.statics[i][x+1] = new Mario.Floor([16*x+16, 16*i], this.pipeRMidSprite);
|
||||
this.statics[i][x] = new Mario.Floor(
|
||||
[16 * x, 16 * i],
|
||||
this.pipeLMidSprite,
|
||||
);
|
||||
this.statics[i][x + 1] = new Mario.Floor(
|
||||
[16 * x + 16, 16 * i],
|
||||
this.pipeRMidSprite,
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//sometimes, pipes don't go straight up and down.
|
||||
Level.prototype.putLeftPipe = function(x,y) {
|
||||
this.statics[y][x] = new Mario.Floor([16*x, 16*y], this.LPipeSprites[0]);
|
||||
this.statics[y+1][x] = new Mario.Floor([16*x,16*(y+1)], this.LPipeSprites[1]);
|
||||
this.statics[y][x+1] = new Mario.Floor([16*(x+1),16*y], this.LPipeSprites[2]);
|
||||
this.statics[y+1][x+1] = new Mario.Floor([16*(x+1),16*(y+1)], this.LPipeSprites[3]);
|
||||
this.statics[y][x+2] = new Mario.Floor([16*(x+2),16*y], this.LPipeSprites[4]);
|
||||
this.statics[y+1][x+2] = new Mario.Floor([16*(x+2),16*(y+1)], this.LPipeSprites[5]);
|
||||
Level.prototype.putLeftPipe = function (x, y) {
|
||||
this.statics[y][x] = new Mario.Floor(
|
||||
[16 * x, 16 * y],
|
||||
this.LPipeSprites[0],
|
||||
);
|
||||
this.statics[y + 1][x] = new Mario.Floor(
|
||||
[16 * x, 16 * (y + 1)],
|
||||
this.LPipeSprites[1],
|
||||
);
|
||||
this.statics[y][x + 1] = new Mario.Floor(
|
||||
[16 * (x + 1), 16 * y],
|
||||
this.LPipeSprites[2],
|
||||
);
|
||||
this.statics[y + 1][x + 1] = new Mario.Floor(
|
||||
[16 * (x + 1), 16 * (y + 1)],
|
||||
this.LPipeSprites[3],
|
||||
);
|
||||
this.statics[y][x + 2] = new Mario.Floor(
|
||||
[16 * (x + 2), 16 * y],
|
||||
this.LPipeSprites[4],
|
||||
);
|
||||
this.statics[y + 1][x + 2] = new Mario.Floor(
|
||||
[16 * (x + 2), 16 * (y + 1)],
|
||||
this.LPipeSprites[5],
|
||||
);
|
||||
};
|
||||
|
||||
Level.prototype.putCoin = function(x, y) {
|
||||
this.items.push(new Mario.Coin(
|
||||
[x*16, y*16],
|
||||
this.coinSprite()
|
||||
));
|
||||
Level.prototype.putCoin = function (x, y) {
|
||||
this.items.push(new Mario.Coin([x * 16, y * 16], this.coinSprite()));
|
||||
};
|
||||
|
||||
Level.prototype.putCloud = function(x, y) {
|
||||
this.scenery[y][x] = new Mario.Prop([x*16, y*16], this.cloudSprite);
|
||||
Level.prototype.putCloud = function (x, y) {
|
||||
this.scenery[y][x] = new Mario.Prop([x * 16, y * 16], this.cloudSprite);
|
||||
};
|
||||
|
||||
Level.prototype.putQBlock = function(x, y, item) {
|
||||
this.blocks[y][x] = new Mario.Block( {
|
||||
pos: [x*16, y*16],
|
||||
Level.prototype.putQBlock = function (x, y, item) {
|
||||
this.blocks[y][x] = new Mario.Block({
|
||||
pos: [x * 16, y * 16],
|
||||
item: item,
|
||||
sprite: this.qblockSprite,
|
||||
usedSprite: this.ublockSprite
|
||||
usedSprite: this.ublockSprite,
|
||||
});
|
||||
};
|
||||
|
||||
Level.prototype.putBrick = function(x,y,item) {
|
||||
Level.prototype.putBrick = function (x, y, item) {
|
||||
this.blocks[y][x] = new Mario.Block({
|
||||
pos: [x*16, y*16],
|
||||
pos: [x * 16, y * 16],
|
||||
item: item,
|
||||
sprite: this.brickSprite,
|
||||
bounceSprite: this.brickBounceSprite,
|
||||
usedSprite: this.ublockSprite,
|
||||
breakable: !item
|
||||
breakable: !item,
|
||||
});
|
||||
};
|
||||
|
||||
Level.prototype.putBigHill = function(x, y) {
|
||||
var px = x*16, py = y*16;
|
||||
Level.prototype.putBigHill = function (x, y) {
|
||||
var px = x * 16,
|
||||
py = y * 16;
|
||||
this.scenery[y][x] = new Mario.Prop([px, py], this.hillSprites[0]);
|
||||
this.scenery[y][x+1] = new Mario.Prop([px+16, py], this.hillSprites[3]);
|
||||
this.scenery[y-1][x+1] = new Mario.Prop([px+16, py-16], this.hillSprites[0]);
|
||||
this.scenery[y][x+2] = new Mario.Prop([px+32, py], this.hillSprites[4]);
|
||||
this.scenery[y-1][x+2] = new Mario.Prop([px+32, py-16], this.hillSprites[3]);
|
||||
this.scenery[y-2][x+2] = new Mario.Prop([px+32, py-32], this.hillSprites[1]);
|
||||
this.scenery[y][x+3] = new Mario.Prop([px+48, py], this.hillSprites[5]);
|
||||
this.scenery[y-1][x+3] = new Mario.Prop([px+48, py-16], this.hillSprites[2]);
|
||||
this.scenery[y][x+4] = new Mario.Prop([px+64, py], this.hillSprites[2]);
|
||||
this.scenery[y][x + 1] = new Mario.Prop([px + 16, py], this.hillSprites[3]);
|
||||
this.scenery[y - 1][x + 1] = new Mario.Prop(
|
||||
[px + 16, py - 16],
|
||||
this.hillSprites[0],
|
||||
);
|
||||
this.scenery[y][x + 2] = new Mario.Prop([px + 32, py], this.hillSprites[4]);
|
||||
this.scenery[y - 1][x + 2] = new Mario.Prop(
|
||||
[px + 32, py - 16],
|
||||
this.hillSprites[3],
|
||||
);
|
||||
this.scenery[y - 2][x + 2] = new Mario.Prop(
|
||||
[px + 32, py - 32],
|
||||
this.hillSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 3] = new Mario.Prop([px + 48, py], this.hillSprites[5]);
|
||||
this.scenery[y - 1][x + 3] = new Mario.Prop(
|
||||
[px + 48, py - 16],
|
||||
this.hillSprites[2],
|
||||
);
|
||||
this.scenery[y][x + 4] = new Mario.Prop([px + 64, py], this.hillSprites[2]);
|
||||
};
|
||||
|
||||
Level.prototype.putBush = function(x, y) {
|
||||
this.scenery[y][x] = new Mario.Prop([x*16, y*16], this.bushSprite);
|
||||
Level.prototype.putBush = function (x, y) {
|
||||
this.scenery[y][x] = new Mario.Prop([x * 16, y * 16], this.bushSprite);
|
||||
};
|
||||
|
||||
Level.prototype.putThreeBush = function(x,y) {
|
||||
px = x*16;
|
||||
py = y*16;
|
||||
Level.prototype.putThreeBush = function (x, y) {
|
||||
px = x * 16;
|
||||
py = y * 16;
|
||||
this.scenery[y][x] = new Mario.Prop([px, py], this.bushSprites[0]);
|
||||
this.scenery[y][x+1] = new Mario.Prop([px+16, py], this.bushSprites[1]);
|
||||
this.scenery[y][x+2] = new Mario.Prop([px+32, py], this.bushSprites[1]);
|
||||
this.scenery[y][x+3] = new Mario.Prop([px+48, py], this.bushSprites[1]);
|
||||
this.scenery[y][x+4] = new Mario.Prop([px+64, py], this.bushSprites[2]);
|
||||
this.scenery[y][x + 1] = new Mario.Prop([px + 16, py], this.bushSprites[1]);
|
||||
this.scenery[y][x + 2] = new Mario.Prop([px + 32, py], this.bushSprites[1]);
|
||||
this.scenery[y][x + 3] = new Mario.Prop([px + 48, py], this.bushSprites[1]);
|
||||
this.scenery[y][x + 4] = new Mario.Prop([px + 64, py], this.bushSprites[2]);
|
||||
};
|
||||
|
||||
Level.prototype.putTwoBush = function(x,y) {
|
||||
px = x*16;
|
||||
py = y*16;
|
||||
Level.prototype.putTwoBush = function (x, y) {
|
||||
px = x * 16;
|
||||
py = y * 16;
|
||||
this.scenery[y][x] = new Mario.Prop([px, py], this.bushSprites[0]);
|
||||
this.scenery[y][x+1] = new Mario.Prop([px+16, py], this.bushSprites[1]);
|
||||
this.scenery[y][x+2] = new Mario.Prop([px+32, py], this.bushSprites[1]);
|
||||
this.scenery[y][x+3] = new Mario.Prop([px+48, py], this.bushSprites[2]);
|
||||
this.scenery[y][x + 1] = new Mario.Prop([px + 16, py], this.bushSprites[1]);
|
||||
this.scenery[y][x + 2] = new Mario.Prop([px + 32, py], this.bushSprites[1]);
|
||||
this.scenery[y][x + 3] = new Mario.Prop([px + 48, py], this.bushSprites[2]);
|
||||
};
|
||||
|
||||
Level.prototype.putSmallHill = function(x, y) {
|
||||
var px = x*16, py = y*16;
|
||||
Level.prototype.putSmallHill = function (x, y) {
|
||||
var px = x * 16,
|
||||
py = y * 16;
|
||||
this.scenery[y][x] = new Mario.Prop([px, py], this.hillSprites[0]);
|
||||
this.scenery[y][x+1] = new Mario.Prop([px+16, py], this.hillSprites[3]);
|
||||
this.scenery[y-1][x+1] = new Mario.Prop([px+16, py-16], this.hillSprites[1]);
|
||||
this.scenery[y][x+2] = new Mario.Prop([px+32, py], this.hillSprites[2]);
|
||||
this.scenery[y][x + 1] = new Mario.Prop([px + 16, py], this.hillSprites[3]);
|
||||
this.scenery[y - 1][x + 1] = new Mario.Prop(
|
||||
[px + 16, py - 16],
|
||||
this.hillSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 2] = new Mario.Prop([px + 32, py], this.hillSprites[2]);
|
||||
};
|
||||
|
||||
Level.prototype.putTwoCloud = function(x,y) {
|
||||
px = x*16;
|
||||
py = y*16;
|
||||
Level.prototype.putTwoCloud = function (x, y) {
|
||||
px = x * 16;
|
||||
py = y * 16;
|
||||
this.scenery[y][x] = new Mario.Prop([px, py], this.cloudSprites[0]);
|
||||
this.scenery[y][x+1] = new Mario.Prop([px+16, py], this.cloudSprites[1]);
|
||||
this.scenery[y][x+2] = new Mario.Prop([px+32, py], this.cloudSprites[1]);
|
||||
this.scenery[y][x+3] = new Mario.Prop([px+48, py], this.cloudSprites[2]);
|
||||
this.scenery[y][x + 1] = new Mario.Prop(
|
||||
[px + 16, py],
|
||||
this.cloudSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 2] = new Mario.Prop(
|
||||
[px + 32, py],
|
||||
this.cloudSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 3] = new Mario.Prop(
|
||||
[px + 48, py],
|
||||
this.cloudSprites[2],
|
||||
);
|
||||
};
|
||||
|
||||
Level.prototype.putThreeCloud = function(x,y) {
|
||||
px = x*16;
|
||||
py = y*16;
|
||||
Level.prototype.putThreeCloud = function (x, y) {
|
||||
px = x * 16;
|
||||
py = y * 16;
|
||||
this.scenery[y][x] = new Mario.Prop([px, py], this.cloudSprites[0]);
|
||||
this.scenery[y][x+1] = new Mario.Prop([px+16, py], this.cloudSprites[1]);
|
||||
this.scenery[y][x+2] = new Mario.Prop([px+32, py], this.cloudSprites[1]);
|
||||
this.scenery[y][x+3] = new Mario.Prop([px+48, py], this.cloudSprites[1]);
|
||||
this.scenery[y][x+4] = new Mario.Prop([px+64, py], this.cloudSprites[2]);
|
||||
this.scenery[y][x + 1] = new Mario.Prop(
|
||||
[px + 16, py],
|
||||
this.cloudSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 2] = new Mario.Prop(
|
||||
[px + 32, py],
|
||||
this.cloudSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 3] = new Mario.Prop(
|
||||
[px + 48, py],
|
||||
this.cloudSprites[1],
|
||||
);
|
||||
this.scenery[y][x + 4] = new Mario.Prop(
|
||||
[px + 64, py],
|
||||
this.cloudSprites[2],
|
||||
);
|
||||
};
|
||||
|
||||
Level.prototype.putRealPipe = function(x, y, length, direction, destination) {
|
||||
px = x*16;
|
||||
py = y*16;
|
||||
this.pipes.push(new Mario.Pipe({
|
||||
pos: [px, py],
|
||||
length: length,
|
||||
direction: direction,
|
||||
destination: destination
|
||||
}));
|
||||
}
|
||||
Level.prototype.putRealPipe = function (
|
||||
x,
|
||||
y,
|
||||
length,
|
||||
direction,
|
||||
destination,
|
||||
) {
|
||||
px = x * 16;
|
||||
py = y * 16;
|
||||
this.pipes.push(
|
||||
new Mario.Pipe({
|
||||
pos: [px, py],
|
||||
length: length,
|
||||
direction: direction,
|
||||
destination: destination,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
Level.prototype.putFlagpole = function(x) {
|
||||
this.statics[12][x] = new Mario.Floor([16*x, 192], this.wallSprite);
|
||||
for (i=3; i < 12; i++) {
|
||||
this.scenery[i][x] = new Mario.Prop([16*x, 16*i], this.flagpoleSprites[1])
|
||||
Level.prototype.putFlagpole = function (x) {
|
||||
this.statics[12][x] = new Mario.Floor([16 * x, 192], this.wallSprite);
|
||||
for (i = 3; i < 12; i++) {
|
||||
this.scenery[i][x] = new Mario.Prop(
|
||||
[16 * x, 16 * i],
|
||||
this.flagpoleSprites[1],
|
||||
);
|
||||
}
|
||||
this.scenery[2][x] = new Mario.Prop([16*x, 32], this.flagpoleSprites[0]);
|
||||
this.items.push(new Mario.Flag(16*x));
|
||||
}
|
||||
this.scenery[2][x] = new Mario.Prop([16 * x, 32], this.flagpoleSprites[0]);
|
||||
this.items.push(new Mario.Flag(16 * x));
|
||||
};
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user