Skip to content

Commit

Permalink
Updated invincibility/turbo timer to 20 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
alemart committed Jan 18, 2021
1 parent 395b995 commit b1dad71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Binary file modified musics/invincible.ogg
Binary file not shown.
18 changes: 9 additions & 9 deletions src/entities/player.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Open Surge Engine
* player.c - player module
* Copyright (C) 2008-2012, 2018, 2019 Alexandre Martins <[email protected]>
* Copyright (C) 2008-2012, 2018-2021 Alexandre Martins <[email protected]>
* http://opensurge2d.org
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -69,14 +69,14 @@
((x) / 57.2957795131f)

/* public constants */
const int PLAYER_INITIAL_LIVES = 5; /* initial lives */
const float PLAYER_MAX_TURBO = 23.0f; /* turbo timer */
const float PLAYER_MAX_INVINCIBILITY = 23.0f; /* invincibility timer */
const int PLAYER_INITIAL_LIVES = 5; /* initial lives */

/* private constants */
static const int PLAYER_MAX_STARS = 16; /* how many invincibility stars */
static const float PLAYER_MAX_BLINK = 2.0f; /* how many seconds does the player blink if he/she gets hurt? */
static const float PLAYER_UNDERWATER_BREATH = 30.0f; /* how many seconds can the player stay underwater before drowning? */
static const int PLAYER_MAX_STARS = 16; /* how many invincibility stars */
static const float PLAYER_MAX_BLINK = 2.0f; /* how long does the player blink if he/she gets hurt, in seconds */
static const float PLAYER_UNDERWATER_BREATH = 30.0f; /* how long can the player stay underwater before drowning, in seconds */
static const float PLAYER_TURBO_TIME = 20.0f; /* super speed time, in seconds */
static const float PLAYER_INVINCIBILITY_TIME = 20.0f; /* invincibility time, in seconds */

/* private data */
static int collectibles; /* shared collectibles */
Expand Down Expand Up @@ -309,15 +309,15 @@ void player_update(player_t *player, player_t **team, int team_size, brick_list_

/* update timer & finish */
player->invincibility_timer += dt;
if(player->invincibility_timer >= PLAYER_MAX_INVINCIBILITY)
if(player->invincibility_timer >= PLAYER_INVINCIBILITY_TIME)
player_set_invincible(player, FALSE);
}

/* turbo speed */
if(player->turbo) {
/* update timer & finish */
player->turbo_timer += dt;
if(player->turbo_timer >= PLAYER_MAX_TURBO)
if(player->turbo_timer >= PLAYER_TURBO_TIME)
player_set_turbo(player, FALSE);
}

Expand Down
2 changes: 0 additions & 2 deletions src/entities/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

/* constants */
extern const int PLAYER_INITIAL_LIVES; /* initial lives */
extern const float PLAYER_MAX_INVINCIBILITY; /* invincibility timer */
extern const float PLAYER_MAX_TURBO; /* turbo timer */

/* shield types */
enum playershield_t {
Expand Down

0 comments on commit b1dad71

Please sign in to comment.