Skip to content

Commit

Permalink
[ClientWorld|ServerWorld] Increased world size. [Player] Sprint added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Jan 20, 2019
1 parent 0b88b1b commit 3105fe9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Movement: <kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd>
- Inventory: <kbd>E</kbd>
- Jump: <kbd>Space</kbd>
- Sprint: <kbd>Left Ctrl</kbd>
- Jetpack: <kbd>X</kbd>
- Exit: <kbd>Escape</kbd>

Expand Down
4 changes: 2 additions & 2 deletions client/include/world/ClientWorld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class ClientWorld : public gk::IDrawable {
void draw(gk::RenderTarget &target, gk::RenderStates states) const override;

// FIXME: Duplicated with those in ServerWorld
const s32 m_width = 32;
const s32 m_width = 64;
const s32 m_height = 4;
const s32 m_depth = 32;
const s32 m_depth = 64;

std::vector<std::unique_ptr<ClientChunk>> m_chunks;

Expand Down
5 changes: 5 additions & 0 deletions client/source/world/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ void Player::processInputs() {
if (gk::GamePad::isKeyPressed(GameKey::Right) && gk::GamePad::isKeyPressed(GameKey::Up)) move(45.0f);
if (gk::GamePad::isKeyPressed(GameKey::Left) && gk::GamePad::isKeyPressed(GameKey::Down)) move(-135.0f);
if (gk::GamePad::isKeyPressed(GameKey::Right) && gk::GamePad::isKeyPressed(GameKey::Down)) move(135.0f);

if (gk::GamePad::isKeyPressed(GameKey::Sprint)) {
m_velocity.x *= 1.5;
m_velocity.z *= 1.5;
}
}

void Player::updatePosition(const ClientWorld &world) {
Expand Down
1 change: 1 addition & 0 deletions common/include/core/input/GameKey.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace GameKey {
Jump,
Fly,
Sneak,
Sprint,

Dig,
Use,
Expand Down
1 change: 1 addition & 0 deletions common/source/core/input/KeyboardHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ KeyboardHandler::KeyboardHandler() {
addKey(GameKey::Jump, "Jump");
addKey(GameKey::Fly, "Fly");
addKey(GameKey::Sneak, "Sneak");
addKey(GameKey::Sprint, "Sprint");

addKey(GameKey::Dig, "Dig");
addKey(GameKey::Use, "Use");
Expand Down
1 change: 1 addition & 0 deletions resources/config/keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Jump key="Space"/>
<Fly key="X"/>
<Sneak key="Left Shift"/>
<Sprint key="Left Ctrl"/>

<Dig key="L"/>
<Use key="M"/>
Expand Down
4 changes: 2 additions & 2 deletions server/include/world/ServerWorld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class ServerWorld {

private:
// FIXME: Duplicated with those in ClientWorld
const s32 m_width = 32;
const s32 m_width = 64;
const s32 m_height = 4;
const s32 m_depth = 32;
const s32 m_depth = 64;

std::vector<std::unique_ptr<ServerChunk>> m_chunks;
};
Expand Down

0 comments on commit 3105fe9

Please sign in to comment.