mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-30 17:18:00 +00:00
add colors to upper_floor
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# Blender v2.92.0 OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib breakable_wall.mtl
|
||||
o cube
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.333333 0.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.333333 0.500000
|
||||
vt 0.666666 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.666666 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.333333 1.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.333333 0.500000
|
||||
vt 0.666666 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.666666 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 0.666666 0.500000
|
||||
vt 0.666666 1.000000
|
||||
vt 0.333333 0.000000
|
||||
vt 0.666666 0.000000
|
||||
vt 0.333333 0.500000
|
||||
vt 0.666666 0.500000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 -1.0000 -0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
usemtl cube
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 3/3/1 2/2/1 4/4/1
|
||||
f 3/5/2 4/6/2 5/7/2
|
||||
f 5/7/2 4/6/2 6/8/2
|
||||
f 5/9/3 6/10/3 7/11/3
|
||||
f 7/11/3 6/10/3 8/12/3
|
||||
f 7/13/4 8/14/4 1/15/4
|
||||
f 1/15/4 8/14/4 2/16/4
|
||||
f 2/17/5 8/12/5 4/18/5
|
||||
f 4/18/5 8/12/5 6/10/5
|
||||
f 7/19/6 1/20/6 5/21/6
|
||||
f 5/21/6 1/20/6 3/22/6
|
||||
@@ -0,0 +1,61 @@
|
||||
# floor.obj
|
||||
#
|
||||
|
||||
mtllib floor.mtl
|
||||
o floor
|
||||
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
|
||||
vt 0.000000 0.000000
|
||||
vt 0.333333 0.000000
|
||||
vt 0.666666 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.333333 0.500000
|
||||
vt 0.666666 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.333333 1.000000
|
||||
vt 0.666666 1.000000
|
||||
vt 1.000000 1.000000
|
||||
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -1.000000 0.000000 0.000000
|
||||
|
||||
g floor
|
||||
usemtl floor
|
||||
# Back
|
||||
s 1
|
||||
f 1/1/1 2/4/1 3/9/1
|
||||
f 3/9/1 2/4/1 4/12/1
|
||||
# Top
|
||||
s 2
|
||||
f 3/1/2 4/4/2 5/9/2
|
||||
f 5/9/2 4/4/2 6/12/2
|
||||
# Front
|
||||
s 3
|
||||
f 5/1/3 6/4/3 7/9/3
|
||||
f 7/9/3 6/4/3 8/12/3
|
||||
# Bottom
|
||||
s 4
|
||||
f 7/1/4 8/4/4 1/9/4
|
||||
f 1/9/4 8/4/4 2/12/4
|
||||
# Right
|
||||
s 5
|
||||
f 2/1/5 8/4/5 4/9/5
|
||||
f 4/9/5 8/4/5 6/12/5
|
||||
# Left
|
||||
s 6
|
||||
f 7/1/6 1/4/6 5/9/6
|
||||
f 5/9/6 1/4/6 3/12/6
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 MiB |
@@ -0,0 +1,12 @@
|
||||
# Blender MTL File: 'None'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Cube.001
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
@@ -0,0 +1,61 @@
|
||||
# floor.obj
|
||||
#
|
||||
|
||||
mtllib floor.mtl
|
||||
o floor
|
||||
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v -0.500000 0.500000 0.500000
|
||||
v 0.500000 0.500000 0.500000
|
||||
v -0.500000 0.500000 -0.500000
|
||||
v 0.500000 0.500000 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
|
||||
vt 0.000000 0.000000
|
||||
vt 0.333333 0.000000
|
||||
vt 0.666666 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.333333 0.500000
|
||||
vt 0.666666 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.333333 1.000000
|
||||
vt 0.666666 1.000000
|
||||
vt 1.000000 1.000000
|
||||
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -1.000000 0.000000 0.000000
|
||||
|
||||
g floor
|
||||
usemtl floor
|
||||
# Back
|
||||
s 1
|
||||
f 1/1/1 2/4/1 3/9/1
|
||||
f 3/9/1 2/4/1 4/12/1
|
||||
# Top
|
||||
s 2
|
||||
f 3/1/2 4/4/2 5/9/2
|
||||
f 5/9/2 4/4/2 6/12/2
|
||||
# Front
|
||||
s 3
|
||||
f 5/1/3 6/4/3 7/9/3
|
||||
f 7/9/3 6/4/3 8/12/3
|
||||
# Bottom
|
||||
s 4
|
||||
f 7/1/4 8/4/4 1/9/4
|
||||
f 1/9/4 8/4/4 2/12/4
|
||||
# Right
|
||||
s 5
|
||||
f 2/1/5 8/4/5 4/9/5
|
||||
f 4/9/5 8/4/5 6/12/5
|
||||
# Left
|
||||
s 6
|
||||
f 7/1/6 1/4/6 5/9/6
|
||||
f 5/9/6 1/4/6 3/12/6
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
+50
-25
@@ -19,7 +19,7 @@ namespace BBM
|
||||
if (!(i % 2) && !(j % 2)) {
|
||||
scene->addEntity("Unbreakable Wall")
|
||||
.addComponent<PositionComponent>(Vector3f(i, 0, j))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(UnbreakableObj, std::make_pair(MAP_DIFFUSE, UnbreakablePnj));
|
||||
}
|
||||
}
|
||||
@@ -33,19 +33,19 @@ namespace BBM
|
||||
|
||||
scene->addEntity("Bottom Wall")
|
||||
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, -1))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(UnbreakableObj, std::make_pair(MAP_DIFFUSE, UnbreakablePnj), RAY::Vector3(width + 3, 1, 1));
|
||||
scene->addEntity("Upper Wall")
|
||||
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, height + 1))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(UnbreakableObj, std::make_pair(MAP_DIFFUSE, UnbreakablePnj), RAY::Vector3(width + 3, 1, 1));
|
||||
scene->addEntity("Left Wall")
|
||||
.addComponent<PositionComponent>(Vector3f(width + 1, 0, height / 2))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(UnbreakableObj, std::make_pair(MAP_DIFFUSE, UnbreakablePnj), RAY::Vector3(1, 1, height + 1));
|
||||
scene->addEntity("Right Wall")
|
||||
.addComponent<PositionComponent>(Vector3f(-1, 0, height / 2))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>(UnbreakableObj, std::make_pair(MAP_DIFFUSE, UnbreakablePnj), RAY::Vector3(1, 1, height + 1));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BBM
|
||||
if (map[std::make_tuple(i, 0, j)] != HOLE && map[std::make_tuple(i, 0, j)] != BUMPER)
|
||||
scene->addEntity("Unbreakable Wall")
|
||||
.addComponent<PositionComponent>(Vector3f(i, -1, j))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/floor.png"));
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,8 @@ namespace BBM
|
||||
{HOLE, &createHole},
|
||||
{FLOOR, &createFloor},
|
||||
{BUMPER, &createBumper},
|
||||
{STAIRS, &createStairs}
|
||||
{STAIRS, &createStairs},
|
||||
{UPPERFLOOR, &createUpperFloor},
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -86,23 +87,32 @@ namespace BBM
|
||||
scene->addEntity("Breakable Block")
|
||||
.addComponent<PositionComponent>(coords)
|
||||
.addComponent<HealthComponent>(1)
|
||||
.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/breakable_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/breakable_wall.png"));
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/breakatble_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/breakable_wall.png"));
|
||||
}
|
||||
|
||||
void MapGenerator::createFloor(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
scene->addEntity("Floor")
|
||||
.addComponent<PositionComponent>(Vector3f(coords))
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/floor.png"));
|
||||
}
|
||||
|
||||
void MapGenerator::createUpperFloor(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
scene->addEntity("Upper Floor")
|
||||
.addComponent<PositionComponent>(Vector3f(coords))
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/upper_floor.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/upper_floor.png"));
|
||||
}
|
||||
|
||||
|
||||
void MapGenerator::createUnbreakable(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
scene->addEntity("Unbreakable Block")
|
||||
.addComponent<PositionComponent>(coords)
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/unbreakable_wall.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/unbreakable_wall.png"));
|
||||
}
|
||||
|
||||
@@ -110,27 +120,27 @@ namespace BBM
|
||||
{
|
||||
scene->addEntity("Hole Block")
|
||||
.addComponent<PositionComponent>(Vector3f(coords.x, coords.y - 1, coords.z))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/hole.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/hole.png"))
|
||||
.addComponent<CollisionComponent>([](const WAL::Entity &entity, WAL::Entity &other) {
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/hole.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/hole.png"));
|
||||
/* .addComponent<CollisionComponent>([](WAL::Entity &other, const WAL::Entity &entity) {
|
||||
if (other.hasComponent<HealthComponent>()) {
|
||||
auto &health = other.getComponent<HealthComponent>();
|
||||
health.takeDmg(health.getHealthPoint());
|
||||
}
|
||||
});
|
||||
}, [](WAL::Entity &other, const WAL::Entity &entity){}); */
|
||||
}
|
||||
|
||||
void MapGenerator::createBumper(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
{
|
||||
std::cout << "Bumper Created" << std::endl;
|
||||
scene->addEntity("Bumper Block")
|
||||
.addComponent<PositionComponent>(Vector3f(coords.x, coords.y - 1, coords.z))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/bumper.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/bumper.png"))
|
||||
.addComponent<CollisionComponent>([](const WAL::Entity &entity, WAL::Entity &other) {
|
||||
.addComponent<PositionComponent>(Vector3f(coords.x, coords.y, coords.z))
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/bumper.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/bumper.png"));
|
||||
/* .addComponent<CollisionComponent>([](const WAL::Entity &entity, WAL::Entity &other) {
|
||||
if (other.hasComponent<MovableComponent>()) {
|
||||
auto &movable = other.getComponent<MovableComponent>();
|
||||
movable.addForce(Vector3f(0, 5, 0));
|
||||
}
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
void MapGenerator::createStairs(Vector3f coords, std::shared_ptr<WAL::Scene> scene)
|
||||
@@ -138,7 +148,7 @@ namespace BBM
|
||||
std::cout << "Stairs Created" << std::endl;
|
||||
scene->addEntity("Stairs Block")
|
||||
.addComponent<PositionComponent>(coords)
|
||||
.addComponent<CollisionComponent>(1)
|
||||
//.addComponent<CollisionComponent>(1)
|
||||
.addComponent<Drawable3DComponent<RAY3D::Model>>("assets/wall/stairs.obj", std::make_pair(MAP_DIFFUSE, "assets/wall/stairs.png"));
|
||||
}
|
||||
|
||||
@@ -163,23 +173,25 @@ namespace BBM
|
||||
|
||||
MapGenerator::MapBlock MapGenerator::createHeight(MapBlock map, int width, int height)
|
||||
{
|
||||
double rnd = static_cast<double>(std::rand())/RAND_MAX;
|
||||
//double rnd = static_cast<double>(std::rand())/RAND_MAX;
|
||||
|
||||
double rnd = 1;
|
||||
|
||||
std::cout << "Height rnd" << rnd << std::endl;
|
||||
if (rnd > 0.60) {
|
||||
std::cout << "Up border" << std::endl;
|
||||
for (int i = 0; i < width + 1; i++) {
|
||||
map[std::make_tuple(i, 1, height)] = map[std::make_tuple(i, 0, height)];
|
||||
map[std::make_tuple(i, 0, height)] = FLOOR;
|
||||
map[std::make_tuple(i, 0, height)] = UPPERFLOOR;
|
||||
map[std::make_tuple(i, 1, 0)] = map[std::make_tuple(i, 0, 0)];
|
||||
map[std::make_tuple(i, 0, 0)] = FLOOR;
|
||||
map[std::make_tuple(i, 0, 0)] = UPPERFLOOR;
|
||||
}
|
||||
map[std::make_tuple(0, 0, height - 1)] = STAIRS;
|
||||
map[std::make_tuple(0, 0, 1)] = STAIRS;
|
||||
map[std::make_tuple(width, 0, height - 1)] = STAIRS;
|
||||
map[std::make_tuple(width, 0, 1)] = STAIRS;
|
||||
map[std::make_tuple(width / 2, -1, height - 1)] = BUMPER;
|
||||
map[std::make_tuple(width / 2, -1, 1)] = BUMPER;
|
||||
map[std::make_tuple(width / 2, 0, height - 1)] = BUMPER;
|
||||
map[std::make_tuple(width / 2, 0, 1)] = BUMPER;
|
||||
}
|
||||
if (rnd > 0.30) {
|
||||
std::cout << "Up center" << std::endl;
|
||||
@@ -188,7 +200,7 @@ namespace BBM
|
||||
if (map[std::make_tuple(i, 0, j)] == FLOOR)
|
||||
continue;
|
||||
map[std::make_tuple(i, 1, j)] = map[std::make_tuple(i, 0, j)];
|
||||
map[std::make_tuple(i, 0, j)] = FLOOR;
|
||||
map[std::make_tuple(i, 0, j)] = UPPERFLOOR;
|
||||
}
|
||||
}
|
||||
map[std::make_tuple(width / 2 - width / 8, 0, height / 2 + height / 4 + 1)] = STAIRS;
|
||||
@@ -209,6 +221,18 @@ namespace BBM
|
||||
return map;
|
||||
}
|
||||
|
||||
MapGenerator::MapBlock MapGenerator::cleanBreakable(MapBlock map, int width, int height)
|
||||
{
|
||||
for (int i = 0; i < width + 1; i++)
|
||||
for (int j = 0; j < height; j++) {
|
||||
if (map[std::make_tuple(i, 0, j)] == BREAKABLE && isCloseToBlockType(map, i, 0, j, STAIRS))
|
||||
map[std::make_tuple(i, 0, j)] = NOTHING;
|
||||
if (map[std::make_tuple(i, 0, j)] == BREAKABLE && map[std::make_tuple(i, -1, j)] == BUMPER)
|
||||
map[std::make_tuple(i, 0, j)] = NOTHING;
|
||||
}
|
||||
return (map);
|
||||
}
|
||||
|
||||
MapGenerator::MapBlock MapGenerator::createMap(int width, int height)
|
||||
{
|
||||
MapBlock map;
|
||||
@@ -237,6 +261,7 @@ namespace BBM
|
||||
if (!((i + 1) % 2) && !((j + 1) % 2))
|
||||
map[std::make_tuple(i, 0, j)] = UNBREAKABLE;
|
||||
map = createHeight(map, width, height);
|
||||
map = cleanBreakable(map, width, height);
|
||||
return (map);
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -34,6 +34,7 @@ namespace BBM
|
||||
NOTHING,
|
||||
BREAKABLE,
|
||||
HOLE,
|
||||
UPPERFLOOR,
|
||||
FLOOR,
|
||||
BUMPER,
|
||||
STAIRS,
|
||||
@@ -98,9 +99,14 @@ namespace BBM
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create bumper of the map
|
||||
//! @brief Create floor of the map
|
||||
static void createFloor(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create upper floor of the map
|
||||
static void createUpperFloor(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
@@ -119,6 +125,13 @@ namespace BBM
|
||||
//! @brief Generate height for the map
|
||||
static MapBlock createHeight(MapBlock map, int width, int height);
|
||||
|
||||
//! @param map Map to load with block declared inside
|
||||
//! @param width Width of the map
|
||||
//! @param height Height of the map
|
||||
//! @brief Clean breakable on stairs, bumpers, etc..
|
||||
static MapBlock cleanBreakable(MapBlock map, int width, int height);
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace BBM
|
||||
}, 3);
|
||||
|
||||
scene->addEntity("camera")
|
||||
.addComponent<PositionComponent>(8, 15, -15)
|
||||
.addComponent<PositionComponent>(8, 20, 7)
|
||||
.addComponent<CameraComponent>(Vector3f(8, 0, 8));
|
||||
std::srand(std::time(NULL));
|
||||
MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene);
|
||||
|
||||
Reference in New Issue
Block a user