mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-03 18:31:17 +00:00
Merge branch 'develop' of github.com:AnonymusRaccoon/Bomberman into no_clip_fixes
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 2.1 MiB |
@@ -11,7 +11,8 @@ namespace RAY::Drawables::Drawables3D
|
||||
{
|
||||
|
||||
Plane::Plane(const Vector3 &position, const Vector2 &dimensions, const Color &color) :
|
||||
ADrawable3D(position, color), _dimensions(dimensions)
|
||||
ADrawable3D(position, color),
|
||||
_dimensions(dimensions)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace BBM
|
||||
constexpr const char Blowable[] = "Blowable";
|
||||
// interact with visual features like camera
|
||||
constexpr const char Player[] = "Player";
|
||||
constexpr const char Background[] = "Background";
|
||||
constexpr const char Unbreakable[] = "Unbreakable";
|
||||
constexpr const char Breakable[] = "Breakable";
|
||||
constexpr const char Hole[] = "Hole";
|
||||
|
||||
@@ -68,6 +68,13 @@ namespace BBM
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T2>
|
||||
Vector2<T> operator-(const Vector2<T2> &vec) const
|
||||
{
|
||||
return Vector2<T>(this->x - vec.x, this->y - vec.y);
|
||||
}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
Vector2<T> &operator*=(T2 d)
|
||||
{
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
#include "Component/Tag/TagComponent.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Component/Shaders/Items/AlphaCtxShaderComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include <Drawables/Image.hpp>
|
||||
#include "Component/Shaders/ShaderComponent.hpp"
|
||||
#include "Drawables/Texture.hpp"
|
||||
#include "Component/Gravity/GravityComponent.hpp"
|
||||
#include "Component/BumperTimer/BumperTimerComponent.hpp"
|
||||
#include "Component/Timer/TimerComponent.hpp"
|
||||
@@ -40,8 +38,11 @@ namespace BBM
|
||||
.addComponent<PositionComponent>(8, 0, -5)
|
||||
.addComponent<CameraComponent>(Vector3f(8, 0, 8));
|
||||
scene->addEntity("background image")
|
||||
.addComponent<Drawable2DComponent, RAY::Texture>(true, "assets/backgrounds/game.png", false)
|
||||
.addComponent<PositionComponent>();
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/map/breakable_wall.obj", true, std::make_pair(MAP_DIFFUSE, "assets/backgrounds/game.png"), Vector3f(50, 1, 50))
|
||||
.addComponent<PositionComponent>(5, -2, 0);
|
||||
scene->addEntity("background image")
|
||||
.addComponent<Drawable3DComponent, RAY3D::Model>("assets/map/breakable_wall.obj", true, std::make_pair(MAP_DIFFUSE, "assets/backgrounds/gameWall.png"), Vector3f(50, 1, 50), -90, Vector3f(), Vector3f(1, 0, 0))
|
||||
.addComponent<PositionComponent>(5, 14, 22);
|
||||
MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16, hasHeights), scene);
|
||||
return scene;
|
||||
}
|
||||
@@ -69,7 +70,7 @@ namespace BBM
|
||||
.addComponent<CollisionComponent>(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75})
|
||||
.addComponent<MovableComponent>()
|
||||
.addComponent<AlphaVarShaderComponent>()
|
||||
.addComponent<ShaderComponentModel>("assets/shaders/alpha.fs", "", [](WAL::Entity &myEntity, WAL::Wal &wal, std::chrono::nanoseconds dtime) {
|
||||
.addComponent<ShaderComponentModel>("assets/shaders/alpha.fs", "", [](WAL::Entity &myEntity, WAL::Wal &, std::chrono::nanoseconds dtime) {
|
||||
auto &ctx = myEntity.getComponent<AlphaVarShaderComponent>();
|
||||
|
||||
ctx.clock += dtime;
|
||||
@@ -119,7 +120,7 @@ namespace BBM
|
||||
if (entity.hasComponent<TimerComponent>())
|
||||
return;
|
||||
entity.getComponent<ControllableComponent>().disabled = true;
|
||||
entity.addComponent<TimerComponent>(1s, [](WAL::Entity &ent, WAL::Wal &wal) {
|
||||
entity.addComponent<TimerComponent>(1s, [](WAL::Entity &ent, WAL::Wal &) {
|
||||
ent.scheduleDeletion();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
#include <Wal.hpp>
|
||||
#include <iostream>
|
||||
#include "System/Movable/MovableSystem.hpp"
|
||||
#include "System/Renderer/RenderSystem.hpp"
|
||||
#include <Drawables/2D/Rectangle.hpp>
|
||||
@@ -12,15 +11,9 @@
|
||||
#include "System/Controllable/ControllableSystem.hpp"
|
||||
#include "System/Gamepad/GamepadSystem.hpp"
|
||||
#include <System/Collision/CollisionSystem.hpp>
|
||||
#include "Component/Button/ButtonComponent.hpp"
|
||||
#include <Component/Collision/CollisionComponent.hpp>
|
||||
#include <Component/Controllable/ControllableComponent.hpp>
|
||||
#include <Component/IAControllable/IAControllableComponent.hpp>
|
||||
#include <Component/Keyboard/KeyboardComponent.hpp>
|
||||
#include <System/Gamepad/GamepadSystem.hpp>
|
||||
#include "Component/Renderer/CameraComponent.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "Runner.hpp"
|
||||
#include "Models/GameState.hpp"
|
||||
#include <System/Timer/TimerSystem.hpp>
|
||||
@@ -37,7 +30,6 @@
|
||||
#include "System/Shaders/ShaderDrawable2DSystem.hpp"
|
||||
#include "System/Shaders/ShaderModelSystem.hpp"
|
||||
#include "System/Animation/AnimationsSystem.hpp"
|
||||
#include "Map/Map.hpp"
|
||||
#include "System/IAControllable/IAControllableSystem.hpp"
|
||||
#include "System/MenuControllable/MenuControllableSystem.hpp"
|
||||
#include <System/Bomb/BombSystem.hpp>
|
||||
@@ -50,7 +42,6 @@
|
||||
#include "System/Lobby/LobbySystem.hpp"
|
||||
#include "System/Score/ScoreSystem.hpp"
|
||||
#include "System/EndCondition/EndConditionSystem.hpp"
|
||||
#include "Component/Lobby/LobbyComponent.hpp"
|
||||
#include "System/Bonus/BonusUISystem.hpp"
|
||||
|
||||
namespace BBM
|
||||
|
||||
@@ -80,11 +80,18 @@ namespace BBM
|
||||
maxDist += (lowerXDist + lowerZDist) / 2;
|
||||
if (maxDist < 14)
|
||||
maxDist = 14;
|
||||
if (maxDist > 25)
|
||||
maxDist = 25;
|
||||
cam.target += (newCameraPos.abs() - pos.position.abs()) / 10;
|
||||
if (maxDist > 23)
|
||||
maxDist = 23;
|
||||
Vector3f pos2d(pos.position.abs().x,0, pos.position.abs().z);
|
||||
Vector3f newPos2d(newCameraPos.abs().x, 0, pos.position.abs().z);
|
||||
for (auto &[other, backPos, _] : this->_wal.getScene()->view<PositionComponent, TagComponent<Background>>()) {
|
||||
backPos.position = cam.target;
|
||||
}
|
||||
newCameraPos.y = 0;
|
||||
cam.target += (newCameraPos.abs() - cam.target.abs()) / 10;
|
||||
newCameraPos.y = maxDist;
|
||||
newCameraPos.z -= 1;
|
||||
newCameraPos.z -= newCameraPos.z > 1 ? 1 : 0;
|
||||
pos.position += (newCameraPos.abs() - pos.position.abs()) / 10;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user