fixed minor bugs
This commit is contained in:
parent
70e3542910
commit
5a0a74ef73
10
src/game.cpp
10
src/game.cpp
@ -78,6 +78,12 @@ void game_update_players(game_t *game, double dt) {
|
|||||||
player_t *player = &game->player[i];
|
player_t *player = &game->player[i];
|
||||||
if (player->status == 0)
|
if (player->status == 0)
|
||||||
return;
|
return;
|
||||||
|
if (player->vx > 500.0)
|
||||||
|
player->vx = 500.0;
|
||||||
|
if (player->vy > 500.0)
|
||||||
|
player->vy = 500.0;
|
||||||
|
if (player->vz > 500.0)
|
||||||
|
player->vz = 500.0;
|
||||||
player->x += player->vx * dt;
|
player->x += player->vx * dt;
|
||||||
player->y += player->vy * dt;
|
player->y += player->vy * dt;
|
||||||
player->z += player->vz * dt;
|
player->z += player->vz * dt;
|
||||||
@ -90,7 +96,7 @@ void _explode_bomb(game_t *game, bomb_t *bomb, void(*explosion_callback)(
|
|||||||
for (i = 0; i < GAME_PLAYER_COUNT; i++) {
|
for (i = 0; i < GAME_PLAYER_COUNT; i++) {
|
||||||
player_t *player = &game->player[i];
|
player_t *player = &game->player[i];
|
||||||
if (player->status == 0)
|
if (player->status == 0)
|
||||||
return;
|
continue;
|
||||||
double distance2 = pow(player->x - bomb->x, 2) + pow(player->y
|
double distance2 = pow(player->x - bomb->x, 2) + pow(player->y
|
||||||
- bomb->y, 2) + pow(player->z - bomb->z, 2);
|
- bomb->y, 2) + pow(player->z - bomb->z, 2);
|
||||||
if (distance2 < 10000.0) {
|
if (distance2 < 10000.0) {
|
||||||
@ -111,7 +117,7 @@ void game_update_bombs(game_t *game, double dt, void(*explosion_callback)(
|
|||||||
for (i = 0; i < GAME_BOMB_COUNT; i++) {
|
for (i = 0; i < GAME_BOMB_COUNT; i++) {
|
||||||
bomb_t *bomb = &game->bomb[i];
|
bomb_t *bomb = &game->bomb[i];
|
||||||
if (bomb->status == 0)
|
if (bomb->status == 0)
|
||||||
return;
|
continue;
|
||||||
bomb->x += bomb->vx * dt;
|
bomb->x += bomb->vx * dt;
|
||||||
bomb->y += bomb->vy * dt;
|
bomb->y += bomb->vy * dt;
|
||||||
bomb->z += bomb->vz * dt;
|
bomb->z += bomb->vz * dt;
|
||||||
|
@ -7,7 +7,7 @@ typedef struct team_t team_t;
|
|||||||
typedef struct player_t player_t;
|
typedef struct player_t player_t;
|
||||||
typedef struct game_t game_t;
|
typedef struct game_t game_t;
|
||||||
|
|
||||||
#define GAME_TEAM_COUNT 8
|
#define GAME_TEAM_COUNT 2
|
||||||
#define GAME_PLAYER_COUNT 64
|
#define GAME_PLAYER_COUNT 64
|
||||||
#define GAME_BOMB_COUNT (GAME_PLAYER_COUNT * 4)
|
#define GAME_BOMB_COUNT (GAME_PLAYER_COUNT * 4)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user