[Prototype] Work with collision and new level parse

This commit is contained in:
Nikita Iryupin 2021-04-28 12:41:59 +02:00
parent 500435798f
commit e1a909b728
6 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,20 @@
{
"name": "1",
"difficulty": 1,
"map": [
"X X X X X X X X X X X X X ",
"X Bf X Bf X Bf X Bf X Bf X Bf X ",
"X Bf X Bf X Bf X Bf X Bf X Bf X ",
"X Bf X Bf X Bf Tf Bf X Bf X Bf X ",
"X Bf X Bf X B3 X B3 X Bf X Bf X ",
"X B3 X B3 X Bc X Bc X B3 X B3 X ",
"Bc X Bc Bc X B3 X B3 X Bc Bc X Bc ",
"T3 X B3 B3 X Bc X Bc X B3 B3 X T3 ",
"X Bc X Bc X Bf Bf Bf X Bc X Bc X ",
"X Bf X Bf X Bf X Bf X Bf X Bf X ",
"X Bf X Bf X B3 X B3 X Bf X Bf X ",
"X Bf X Bf X B8 Bc B4 X Bf X Bf X ",
"X X X X X Ba E B5 X X X X X "
],
"bots": ["18*basic", "2*fast"]
}

20
src/Blocks/block.js Normal file
View File

@ -0,0 +1,20 @@
class Block {
constructor(width, height, xBox, yBox, wBox, hBox, tile) {
this._width = width;
this._height = height;
this._xBox = xBox;
this._yBox = yBox;
this._wBox = wBox;
this._hBox = hBox;
this._tile = tile;
}
draw(ctx, x, y){
ctx.drawImage(tile, x, y);
}
resolveAttack(){
return;
}
}

7
src/Blocks/brick.js Normal file
View File

@ -0,0 +1,7 @@
class Brick extends Block {
constructor(width, height, xBox, yBox, wBox, hBox, tile) {
super(width, height, xBox, yBox, wBox, hBox, tile);
}
}

7
src/Blocks/eagle.js Normal file
View File

@ -0,0 +1,7 @@
class Eagle extends Block {
constructor(width, height, xBox, yBox, wBox, hBox, tile) {
super(width, height, xBox, yBox, wBox, hBox, tile);
}
}

7
src/Blocks/iron.js Normal file
View File

@ -0,0 +1,7 @@
class Iron extends Block {
constructor(width, height, xBox, yBox, wBox, hBox, tile) {
super(width, height, xBox, yBox, wBox, hBox, tile);
}
}

7
src/Blocks/river.js Normal file
View File

@ -0,0 +1,7 @@
class River extends Block {
constructor(width, height, xBox, yBox, wBox, hBox, tile) {
super(width, height, xBox, yBox, wBox, hBox, tile);
}
}