[ClientPlayer] Moved hitbox to Player.
This commit is contained in:
parent
c3a9eadcea
commit
78e46f71c6
10
README.md
10
README.md
@ -68,9 +68,9 @@ This list is non exhaustive.
|
||||
|
||||
- Menus (title screen, server selection, pause menu, settings menu)
|
||||
- Basic worldgen (lakes, trees, flowers, pseudo-caves)
|
||||
- Infinite world in X/Y/Z axis
|
||||
- Infinite world in X/Y/Z axis (#25)
|
||||
- Lighting system with smooth lighting
|
||||
- Networking
|
||||
- Networking (#20)
|
||||
- Lua API
|
||||
- Block/item/recipe definition
|
||||
- Custom GUI creation
|
||||
@ -79,15 +79,15 @@ This list is non exhaustive.
|
||||
|
||||
### Missing features
|
||||
|
||||
- Texture pack system
|
||||
- World loading/saving
|
||||
- Texture pack system (#34)
|
||||
- World loading/saving (#26)
|
||||
- Particle system
|
||||
- Fluid propagation
|
||||
- Player model display (currently displaying an ugly box)
|
||||
- Day/night cycle with sun/moon display
|
||||
- Real worldgen (seed-based, biomes, cave tunnels)
|
||||
- Entities (block drops, mobs, etc...)
|
||||
- Clouds
|
||||
- Clouds (#52)
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -59,8 +59,6 @@ class ClientPlayer : public Player {
|
||||
float pointTargetedY() const { return m_y + sin(m_angleV * RADIANS_PER_DEGREES); }
|
||||
float pointTargetedZ() const { return m_z + sin(m_angleH * RADIANS_PER_DEGREES) * cos(m_angleV * RADIANS_PER_DEGREES) - 0.00001; }
|
||||
|
||||
const gk::FloatBox &hitbox() const { return m_hitbox; }
|
||||
|
||||
static ClientPlayer &getInstance() { return *s_instance; }
|
||||
static void setInstance(ClientPlayer *instance) { s_instance = instance; }
|
||||
|
||||
@ -89,8 +87,6 @@ class ClientPlayer : public Player {
|
||||
|
||||
const float m_gravity = 0.001;
|
||||
const float m_jumpSpeed = 0.06f;
|
||||
|
||||
gk::FloatBox m_hitbox;
|
||||
};
|
||||
|
||||
#endif // CLIENTPLAYER_HPP_
|
||||
|
@ -41,8 +41,6 @@ ClientPlayer::ClientPlayer(gk::Camera &camera) : m_camera(camera) {
|
||||
m_angleH = -90.0;
|
||||
m_angleV = 0.01;
|
||||
|
||||
m_hitbox = gk::FloatBox{-0.2, -1.8, -0.2, 0.4, 1.8, 0.4};
|
||||
|
||||
m_camera.setPosition(m_x, m_y - 0.1, m_z);
|
||||
m_camera.setTargetPosition(pointTargetedX(), pointTargetedY(), pointTargetedZ());
|
||||
}
|
||||
|
@ -23,11 +23,15 @@
|
||||
#ifndef PLAYER_HPP_
|
||||
#define PLAYER_HPP_
|
||||
|
||||
#include <gk/core/Box.hpp>
|
||||
|
||||
#include "Inventory.hpp"
|
||||
#include "ISerializable.hpp"
|
||||
|
||||
class Player : public ISerializable {
|
||||
public:
|
||||
Player();
|
||||
|
||||
void serialize(sf::Packet &packet) const override;
|
||||
void deserialize(sf::Packet &packet) override;
|
||||
|
||||
@ -42,6 +46,8 @@ class Player : public ISerializable {
|
||||
void setPosition(s32 x, s32 y, s32 z) { m_x = x; m_y = y; m_z = z; }
|
||||
void setClientID(u16 clientID) { m_clientID = clientID; }
|
||||
|
||||
const gk::FloatBox &hitbox() const { return m_hitbox; }
|
||||
|
||||
protected:
|
||||
s32 m_x = 0;
|
||||
s32 m_y = 0;
|
||||
@ -50,6 +56,8 @@ class Player : public ISerializable {
|
||||
u16 m_clientID = 0;
|
||||
|
||||
Inventory m_inventory{9, 4};
|
||||
|
||||
gk::FloatBox m_hitbox;
|
||||
};
|
||||
|
||||
#endif // PLAYER_HPP_
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "Network.hpp"
|
||||
#include "Player.hpp"
|
||||
|
||||
Player::Player() {
|
||||
m_hitbox = gk::FloatBox{-0.2, -1.8, -0.2, 0.4, 1.8, 0.4};
|
||||
}
|
||||
|
||||
void Player::serialize(sf::Packet &packet) const {
|
||||
packet << m_x << m_y << m_z << m_inventory;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user