Skip to content

Commit b6ee2a2

Browse files
authored
Fixes a bug where the player bleed would not match player pos (#134)
1 parent a3b19d2 commit b6ee2a2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/player.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ has_collided(Player *player, RoomMatrix *matrix, Vector2d direction)
257257
RoomSpace *space = &matrix->spaces[matrixPos.x][matrixPos.y];
258258

259259
if (player_has_collided(player, space)) {
260-
player->sprite->pos.x -= TILE_DIMENSION * (int)direction.x;
261-
player->sprite->pos.y -= TILE_DIMENSION * (int)direction.y;
260+
player_update_pos(player, -TILE_DIMENSION * (int)direction.x, -TILE_DIMENSION * (int)direction.y);
262261

263262
gamecontroller_rumble(0.30f, 100);
264263
if (space->monster) {
@@ -343,6 +342,8 @@ player_update_pos(Player *player, Uint32 dx, Uint32 dy)
343342
static void
344343
move(Player *player, RoomMatrix *matrix, Vector2d direction)
345344
{
345+
// TODO(Linus): This data flow is ugly as hell. Clean up
346+
346347
player_turn(player, &direction);
347348

348349
Position lastPos = position_to_matrix_coords(&player->sprite->pos);

0 commit comments

Comments
 (0)