вот такая структура объекта уровня в игре, на сколько она удобно?
var firstLvl = {
Number: 1,
Texture: {
BackgroundImage: "Levels/Level_1/background.jpg",
Blocks: {// размер уничтожаеммых обьектов
width: 50,
height: 20,
life: 1,
color: "black",
offset: {
left: 10,
}
},
lineSpacing: 10// меж строчные отступы
},
Board: {
Color: "Black",
//Image:"",// найти картинку
size: {
width: 250,
height: 15
},
Positions: {
x: "center",// or 'left' or 'right'
y: 20 // отступ с низу
},
Offset: {
x: 40,
y: 0
}
},
Ball: {
radius: 20,
position: "center",//position:[left || right || center] .( position on object Board)
color: "green",
speed: 5
}
}
var types = firstLvl.Texture.Blocks.types = [];
types[4] = {
width: 290,
height: 30,
color: "yellow",
life: 4,
offset: {
left: 200,
top: 100,
bottom:20
}
};
types[3] = {
offset: { left: 200 },
color:"green",
inherit: 2 // отсутсвующие свойства наследуються от указанного типа
};
types[2] = {
width: 50,
height: 20,
color: "red",
life: 2,
};
firstLvl.TextureMatrix = [
[4],
[3, 2, 2, 2, 2],
[3, 2, 2, 2, 2],
[3, 2, 2, 2, 2],
[3, 1, 1, 1, 1],
[3, 1, 1, 1, 1],
];