-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed game logic and preparations for collissions (AAAAAAAAAAAAAAAA…
…AAAAAAAAAAAAAAAAAAAAA)
- Loading branch information
Showing
17 changed files
with
242 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
namespace Jukcraft { | ||
class Entity { | ||
public: | ||
Entity() { | ||
|
||
} | ||
Entity(const glm::vec3& initialPos, const glm::vec3& initialVelocity, | ||
const glm::vec3& initialAcceleration, float initialYaw, float initialPitch) | ||
:position(initialPos), velocity(initialVelocity), acceleration(initialAcceleration), | ||
yaw(initialYaw), pitch(initialPitch) { | ||
|
||
} | ||
virtual ~Entity() {} | ||
|
||
virtual void tick(float delta_time) = 0; | ||
|
||
constexpr const glm::vec3& getPos() const { return position; } | ||
constexpr const glm::vec3& getVelocity() const { return position; } | ||
constexpr const glm::vec3& getAccel() const { return position; } | ||
constexpr float getYaw() const { return yaw; } | ||
constexpr float getPitch() const { return pitch; } | ||
protected: | ||
glm::vec3 position; | ||
glm::vec3 velocity; | ||
glm::vec3 acceleration; | ||
float yaw, pitch; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "pch.h" | ||
#include "models/Collider.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
#include "entity/Entity.h" | ||
#include "models/Collider.h" | ||
|
||
namespace Jukcraft { | ||
class Mob : public Entity { | ||
public: | ||
Mob(const glm::vec3& initialPos = glm::vec3(0.0f), const glm::vec3& initialVelocity = glm::vec3(0.0f), | ||
const glm::vec3& initialAcceleration = glm::vec3(0.0f), float initialYaw = 0.0f, float initialPitch = 0.0f) | ||
:Entity(initialPos, initialVelocity, initialAcceleration, initialYaw, initialPitch), | ||
width(0.6f), height(1.8f), collider(){ | ||
|
||
} | ||
virtual ~Mob() { | ||
|
||
} | ||
void updateCollider() { | ||
collider.vx1 = position - glm::vec3(width / 2.0f, 0, width / 2.0f); | ||
collider.vx2 = position + glm::vec3(width / 2.0f, height, width / 2.0f); | ||
} | ||
|
||
void tick(float delta_time) override { | ||
updateCollider(); | ||
|
||
acceleration += velocity * delta_time; | ||
position += velocity * delta_time; | ||
} | ||
protected: | ||
float width, height; | ||
|
||
Collider collider; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "pch.h" | ||
#include "entity/player/Player.h" | ||
|
||
namespace Jukcraft { | ||
Player::Player(const glm::vec3& initialPos, const glm::vec3& initialVelocity, | ||
const glm::vec3& initialAcceleration, float initialYaw, float initialPitch) | ||
:Mob(initialPos, initialVelocity, initialAcceleration, initialYaw, initialPitch) { | ||
|
||
|
||
} | ||
Player::~Player() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
#include "entity/Mob.h" | ||
|
||
namespace Jukcraft { | ||
class Player : public Mob { | ||
public: | ||
Player(const glm::vec3& initialPos = glm::vec3(0.0f), const glm::vec3& initialVelocity = glm::vec3(0.0f), | ||
const glm::vec3& initialAcceleration = glm::vec3(0.0f), float initialYaw = 0.0f, float initialPitch = 0.0f); | ||
virtual ~Player(); | ||
|
||
|
||
friend class Camera; | ||
}; | ||
} |
Oops, something went wrong.