mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-20 13:25:10 +00:00
merge develop in gravity_component
This commit is contained in:
BIN
assets/bombs/explosion/blast.png
Normal file
BIN
assets/bombs/explosion/blast.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
BIN
assets/bombs/explosion/explosion.glb
Normal file
BIN
assets/bombs/explosion/explosion.glb
Normal file
Binary file not shown.
@@ -134,9 +134,25 @@ namespace BBM
|
|||||||
static const std::string unbreakableObj = unbreakableWallPath + objExtension;
|
static const std::string unbreakableObj = unbreakableWallPath + objExtension;
|
||||||
static const std::string unbreakablePnj = unbreakableWallPath + imageExtension;
|
static const std::string unbreakablePnj = unbreakableWallPath + imageExtension;
|
||||||
|
|
||||||
|
for (int i = 0; i < height; i++) {
|
||||||
|
scene->addEntity("Bomb stopper")
|
||||||
|
.addComponent<PositionComponent>(-1, 0, i)
|
||||||
|
.addComponent<TagComponent<Blowable>>();
|
||||||
|
scene->addEntity("Bomb stopper")
|
||||||
|
.addComponent<PositionComponent>(width + 1, 0, i)
|
||||||
|
.addComponent<TagComponent<Blowable>>();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
scene->addEntity("Bomb stopper")
|
||||||
|
.addComponent<PositionComponent>(i, 0, -1)
|
||||||
|
.addComponent<TagComponent<Blowable>>();
|
||||||
|
scene->addEntity("Bomb stopper")
|
||||||
|
.addComponent<PositionComponent>(i, 0, height + 1)
|
||||||
|
.addComponent<TagComponent<Blowable>>();
|
||||||
|
}
|
||||||
|
|
||||||
scene->addEntity("Bottom Wall")
|
scene->addEntity("Bottom Wall")
|
||||||
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, -1))
|
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, -1))
|
||||||
.addComponent<TagComponent<Blowable>>()
|
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
||||||
@@ -145,7 +161,6 @@ namespace BBM
|
|||||||
RAY::Vector3(width + 3, 1, 1));
|
RAY::Vector3(width + 3, 1, 1));
|
||||||
scene->addEntity("Upper Wall")
|
scene->addEntity("Upper Wall")
|
||||||
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, height + 1))
|
.addComponent<PositionComponent>(Vector3f((width + 1) / 2, 0, height + 1))
|
||||||
.addComponent<TagComponent<Blowable>>()
|
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
&MapGenerator::wallCollided, Vector3f(-(width + 1) / 2 , 0.25, 0.25), Vector3f(width + 1, 2, 0.75))
|
||||||
@@ -154,7 +169,6 @@ namespace BBM
|
|||||||
RAY::Vector3(width + 3, 1, 1));
|
RAY::Vector3(width + 3, 1, 1));
|
||||||
scene->addEntity("Left Wall")
|
scene->addEntity("Left Wall")
|
||||||
.addComponent<PositionComponent>(Vector3f(width + 1, 0, height / 2))
|
.addComponent<PositionComponent>(Vector3f(width + 1, 0, height / 2))
|
||||||
.addComponent<TagComponent<Blowable>>()
|
|
||||||
.addComponent<CollisionComponent>(
|
.addComponent<CollisionComponent>(
|
||||||
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
WAL::Callback<WAL::Entity &, const WAL::Entity &, CollisionComponent::CollidedAxis>(),
|
||||||
&MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
|
&MapGenerator::wallCollided, Vector3f(0.25, 0.25, -(height + 1) / 2 ), Vector3f(0.75, 2, height + 1))
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Created by Zoe Roux on 5/31/21.
|
// Created by Zoe Roux on 5/31/21.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <Component/Animation/AnimationsComponent.hpp>
|
||||||
#include <Component/Bomb/BasicBombComponent.hpp>
|
#include <Component/Bomb/BasicBombComponent.hpp>
|
||||||
#include "Component/Timer/TimerComponent.hpp"
|
#include "Component/Timer/TimerComponent.hpp"
|
||||||
#include "System/Event/EventSystem.hpp"
|
#include "System/Event/EventSystem.hpp"
|
||||||
@@ -38,7 +39,14 @@ namespace BBM
|
|||||||
{
|
{
|
||||||
if (radiusToDo <= 0)
|
if (radiusToDo <= 0)
|
||||||
return;
|
return;
|
||||||
wal.getSystem<EventSystem>().dispatchEvent([position, radiusToDo, posFrom](WAL::Wal &wal) {
|
wal.getScene()->scheduleNewEntity("explosion")
|
||||||
|
.addComponent<PositionComponent>(position)
|
||||||
|
.addComponent<TimerComponent>(1s, [](WAL::Entity &explosion, WAL::Wal &wal) {
|
||||||
|
explosion.scheduleDeletion();
|
||||||
|
})
|
||||||
|
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/bombs/explosion/explosion.glb", false,
|
||||||
|
std::make_pair(MAP_DIFFUSE, "assets/bombs/explosion/blast.png"));
|
||||||
|
wal.getSystem<EventSystem>().dispatchEvent([position, count](WAL::Wal &wal) {
|
||||||
for (auto &[entity, pos, _] : wal.getScene()->view<PositionComponent, TagComponent<Blowable>>()) {
|
for (auto &[entity, pos, _] : wal.getScene()->view<PositionComponent, TagComponent<Blowable>>()) {
|
||||||
if (pos.position.round() == position) {
|
if (pos.position.round() == position) {
|
||||||
if (auto *health = entity.tryGetComponent<HealthComponent>())
|
if (auto *health = entity.tryGetComponent<HealthComponent>())
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ namespace BBM
|
|||||||
key.second = gamepad.isPressed(key.first);
|
key.second = gamepad.isPressed(key.first);
|
||||||
controllable.move.x = gamepad.getAxisValue(gamepadComponent.LeftStickX) * -1;
|
controllable.move.x = gamepad.getAxisValue(gamepadComponent.LeftStickX) * -1;
|
||||||
controllable.move.y = gamepad.getAxisValue(gamepadComponent.LeftStickY) * -1;
|
controllable.move.y = gamepad.getAxisValue(gamepadComponent.LeftStickY) * -1;
|
||||||
controllable.move.x -= gamepad.isDown(gamepadComponent.keyRight);
|
controllable.move.x -= static_cast<float>(gamepad.isDown(gamepadComponent.keyRight));
|
||||||
controllable.move.x += gamepad.isDown(gamepadComponent.keyLeft);
|
controllable.move.x += static_cast<float>(gamepad.isDown(gamepadComponent.keyLeft));
|
||||||
controllable.move.y += gamepad.isDown(gamepadComponent.keyUp);
|
controllable.move.y += static_cast<float>(gamepad.isDown(gamepadComponent.keyUp));
|
||||||
controllable.move.y -= gamepad.isDown(gamepadComponent.keyDown);
|
controllable.move.y -= static_cast<float>(gamepad.isDown(gamepadComponent.keyDown));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user