diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-19 18:47:53 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-19 18:47:53 -0400 |
commit | 0a9abffb2d6dd5e999242d5310350f88565cc98b (patch) | |
tree | c12d6c7ef6169e1f51f5af184073bf0b3a3dec39 /src | |
parent | 4b4125e234cb727c70822e0a1fce0688c357741e (diff) | |
download | therapy-0a9abffb2d6dd5e999242d5310350f88565cc98b.tar.gz therapy-0a9abffb2d6dd5e999242d5310350f88565cc98b.tar.bz2 therapy-0a9abffb2d6dd5e999242d5310350f88565cc98b.zip |
Fixed bug allowing player to jump through walls when crossing a vertical map boundary
It turns out that it is somewhat confusing that GAME_HEIGHT != MAP_HEIGHT*TILE_HEIGHT
Diffstat (limited to 'src')
-rw-r--r-- | src/components/map_collision.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/components/map_collision.cpp b/src/components/map_collision.cpp index 432fea6..3ad574b 100644 --- a/src/components/map_collision.cpp +++ b/src/components/map_collision.cpp | |||
@@ -5,10 +5,10 @@ | |||
5 | 5 | ||
6 | MapCollisionComponent::MapCollisionComponent(const Map& map) : map(map) | 6 | MapCollisionComponent::MapCollisionComponent(const Map& map) : map(map) |
7 | { | 7 | { |
8 | addCollision(-6, 0, GAME_HEIGHT, Direction::left, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Left).type)); | 8 | addCollision(-6, 0, MAP_HEIGHT*TILE_HEIGHT, Direction::left, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Left).type)); |
9 | addCollision(GAME_WIDTH+6, 0, GAME_HEIGHT, Direction::right, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Right).type)); | 9 | addCollision(GAME_WIDTH+6, 0, MAP_HEIGHT*TILE_HEIGHT, Direction::right, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Right).type)); |
10 | addCollision(-7, 0, GAME_WIDTH, Direction::up, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Up).type)); | 10 | addCollision(-6, 0, GAME_WIDTH, Direction::up, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Up).type)); |
11 | addCollision(GAME_HEIGHT+6, 0, GAME_WIDTH, Direction::down, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Down).type)); | 11 | addCollision(MAP_HEIGHT*TILE_HEIGHT+6, 0, GAME_WIDTH, Direction::down, collisionFromMoveType(map.getAdjacent(Map::MoveDir::Down).type)); |
12 | 12 | ||
13 | for (int i=0; i<MAP_WIDTH*MAP_HEIGHT; i++) | 13 | for (int i=0; i<MAP_WIDTH*MAP_HEIGHT; i++) |
14 | { | 14 | { |
@@ -204,7 +204,7 @@ void MapCollisionComponent::processCollision(Game& game, Entity& collider, Colli | |||
204 | game.loadMap(game.getWorld().getMap(map.getAdjacent(Map::MoveDir::Right).map), std::make_pair(-collider.size.first/2, old_position.second)); | 204 | game.loadMap(game.getWorld().getMap(map.getAdjacent(Map::MoveDir::Right).map), std::make_pair(-collider.size.first/2, old_position.second)); |
205 | } else if (dir == Direction::up) | 205 | } else if (dir == Direction::up) |
206 | { | 206 | { |
207 | game.loadMap(game.getWorld().getMap(map.getAdjacent(Map::MoveDir::Up).map), std::make_pair(old_position.first, GAME_HEIGHT-collider.size.second/2)); | 207 | game.loadMap(game.getWorld().getMap(map.getAdjacent(Map::MoveDir::Up).map), std::make_pair(old_position.first, MAP_HEIGHT*TILE_HEIGHT-collider.size.second/2)); |
208 | } else if (dir == Direction::down) | 208 | } else if (dir == Direction::down) |
209 | { | 209 | { |
210 | game.loadMap(game.getWorld().getMap(map.getAdjacent(Map::MoveDir::Down).map), std::make_pair(old_position.first, -collider.size.second/2)); | 210 | game.loadMap(game.getWorld().getMap(map.getAdjacent(Map::MoveDir::Down).map), std::make_pair(old_position.first, -collider.size.second/2)); |