Removes bug that made it possible to move with daggers in air.

This commit is contained in:
Linus Probert 2018-07-06 22:30:28 +02:00
parent c6b643835b
commit c96d0b6718
1 changed files with 9 additions and 1 deletions

View File

@ -229,6 +229,11 @@ handle_next_move(UpdateData *data)
static unsigned int step = 1; static unsigned int step = 1;
Player *player = data->player; Player *player = data->player;
// Don't move when projectiles are still moving
if (linkedlist_size(player->projectiles) > 0)
return;
RoomMatrix *matrix = data->matrix; RoomMatrix *matrix = data->matrix;
Vector2d nextDir = read_direction_from(data->input); Vector2d nextDir = read_direction_from(data->input);
if (!vector2d_equals(nextDir, VECTOR2D_NODIR)) if (!vector2d_equals(nextDir, VECTOR2D_NODIR))
@ -327,7 +332,11 @@ player_create(class_t class, SDL_Renderer *renderer)
{ {
Player *player = malloc(sizeof(Player)); Player *player = malloc(sizeof(Player));
player->sprite = sprite_create(); player->sprite = sprite_create();
#ifdef DEBUG
player->daggers = 10;
#else
player->daggers = 0; player->daggers = 0;
#endif
player->stat_data.total_steps = 0; player->stat_data.total_steps = 0;
player->stat_data.steps = 0; player->stat_data.steps = 0;
player->stat_data.hits = 0; player->stat_data.hits = 0;
@ -440,7 +449,6 @@ player_render(Player *player, Camera *cam)
projectile_render(projectile->data, cam); projectile_render(projectile->data, cam);
projectile = projectile->next; projectile = projectile->next;
} }
} }
void void