Skip to content

Commit

Permalink
VERSÃO FINAL!!!
Browse files Browse the repository at this point in the history
ACABOU!!!
ACABOU!!!
ACABOU!!!

...
  • Loading branch information
GSimas committed Jul 3, 2015
1 parent d3d2d90 commit d35d68c
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 235 deletions.
3 changes: 3 additions & 0 deletions Game-C/Game-C.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="objects.h" />
<Unit filename="resource.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Extensions>
<code_completion />
<envvars />
Expand Down
304 changes: 152 additions & 152 deletions Game-C/bin/Debug/allegro.log

Large diffs are not rendered by default.

58 changes: 38 additions & 20 deletions Game-C/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern const int GRAVITY = 1; //gravidade padrao em 1
extern const int FPS = 60;
extern int back_x;
extern int back_y;
extern bool keys[8];

extern const int TELA_INICIO = 0;
extern const int TELA_ISNTRU = 1;
extern const int TELA_JOGO = 2;
Expand All @@ -45,7 +45,7 @@ void InitPlayer(Player &player, int *text_color)
player.alive = true;
player.shield = false;
player.velx = 0;
player.vely = 0;
player.vely = 1;
player.boundx = 40;
player.boundy = 40;
player.score = 0;
Expand All @@ -67,19 +67,19 @@ void InitPlayer(Player &player, int *text_color)

void PlayerSample(Player &player, int letra, ALLEGRO_SAMPLE_ID *musica3id, ALLEGRO_SAMPLE *musica3)
{
if(letra == 4)
if(letra == 3)
{
if(!player.alive)
{
al_stop_sample_instance(player.instance[0]);
al_play_sample(musica3, 1, 0, 1, ALLEGRO_PLAYMODE_LOOP, musica3id);
al_stop_sample_instance(player.instance[1]);
}

if(player.lives == 2)
{
al_stop_sample(musica3id);
//al_stop_sample(musica3id);
al_play_sample_instance(player.instance[0]);
}

if(player.lives == 1)
{
al_stop_sample_instance(player.instance[0]);
Expand Down Expand Up @@ -205,7 +205,7 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[],
Obstacle &obstacle, Boss boss[], int *num_boss, int *text_color,
ALLEGRO_SAMPLE *musica3, ALLEGRO_SAMPLE_ID *musica3id,
ALLEGRO_SAMPLE *musica666, ALLEGRO_SAMPLE_ID *musica666id,
int letra)
int letra, bool *UP, bool *RIGHT, bool *LEFT, bool *Q, bool *W, bool *E)
{
int j;
if(player.lives <= 0)
Expand All @@ -220,13 +220,13 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[],
player.lives = 5;
player.speed = 7;
player.jumpSpeed = 15;
player.jump = false;
player.jump = true;
player.moving = false;
player.colision = false;
player.alive = true;
player.shield = false;
player.velx = 0;
player.vely = 0;
player.vely = 1;
player.boundx = 40;
player.boundy = 50;
player.score = 0;
Expand Down Expand Up @@ -263,12 +263,29 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[],
al_stop_sample_instance(boss[j].instance[0]);
al_stop_sample_instance(boss[j].instance[1]);
if(letra == 666)
al_stop_sample_instance(boss[j].instance[2]);
al_stop_sample_instance(boss[j].instance[2]);
}
obstacle.score = 5;
*UP = false;
*RIGHT = false;
*LEFT = false;
*Q = false;
*W = false;
*E = false;
*tela = TELA_FINAL;
for(j=0; j<8; j++)
keys[j] = false;
}
}

void ResetKeys(struct Player &player, bool *UP, bool *RIGHT, bool *LEFT, bool *Q, bool *W, bool *E)
{
if(player.alive == false)
{
*UP = false;
*RIGHT = false;
*LEFT = false;
*Q = false;
*W = false;
*E = false;
}
}

Expand Down Expand Up @@ -957,6 +974,7 @@ void InitBoss(struct Boss boss[], int *num_boss, int letra)
boss[j].sample[2] = al_load_sample("sounds/starwars.ogg");
boss[j].instance[2] = al_create_sample_instance(boss[j].sample[2]);
al_attach_sample_instance_to_mixer(boss[j].instance[2], al_get_default_mixer());
al_set_sample_instance_gain(boss[j].instance[2], 3);
}
boss[j].x = back_x;
boss[j].y = back_y;
Expand All @@ -981,6 +999,8 @@ void InitBoss(struct Boss boss[], int *num_boss, int letra)
boss[j].instance[1] = al_create_sample_instance(boss[j].sample[1]);
al_attach_sample_instance_to_mixer(boss[j].instance[0], al_get_default_mixer());
al_attach_sample_instance_to_mixer(boss[j].instance[1], al_get_default_mixer());
al_set_sample_instance_gain(boss[j].instance[0], 2);
al_set_sample_instance_gain(boss[j].instance[1], 2);

}
}
Expand All @@ -1003,7 +1023,7 @@ void UpdateBoss(struct Boss boss[], int *num_boss, int *text_boss, struct Player
int *num_enemyred, struct Enemy_blue enemyblue[], int *num_enemyblue, int letra)
{
*num_boss = 0;
if(player.score > 2 && boss[0].lived == false)
if(player.score > 20 && boss[0].lived == false)
{
boss[0].alive = true;
*num_boss = 1;
Expand Down Expand Up @@ -1087,7 +1107,6 @@ void BossSample(struct Boss boss[], int *num_boss, int letra, ALLEGRO_SAMPLE_ID
}
if(letra == 1)
{
al_stop_sample(musica1id);
al_play_sample_instance(boss[j].instance[1]);
}
if(letra == 666)
Expand All @@ -1100,19 +1119,18 @@ void BossSample(struct Boss boss[], int *num_boss, int letra, ALLEGRO_SAMPLE_ID
{
switch(letra)
{
case 1:
case 1:
boss[j].instance_played = true;
al_stop_sample_instance(boss[j].instance[1]);
al_stop_samples();
al_play_sample(musica1, 1, 0, 1, ALLEGRO_PLAYMODE_LOOP, musica1id);
break;
case 666:
case 666:
al_stop_sample_instance(boss[j].instance[2]);
boss[j].instance_played = true;
break;
}
}
}
}}
}

//funcao para colisao de player com boss
void PlayerColisionBoss(struct Player &player, struct Boss boss[], int *num_boss)
Expand Down Expand Up @@ -1195,7 +1213,7 @@ void InitBackground0(struct Sprite &background0, ALLEGRO_SAMPLE *musica0, ALLEGR
background0.image[12] = al_load_bitmap("images/telas/tela-inicio0.png");
background0.image[13] = al_load_bitmap("images/telas/tela-instru0.png");
background0.image[14] = al_load_bitmap("images/telas/tela-final0.png");
background0.image[15] = al_load_bitmap("images/telas/reprovado.png");
background0.image[15] = al_load_bitmap("images/reprovado.png");

//carregar musica referente
switch (letra)
Expand Down
3 changes: 2 additions & 1 deletion Game-C/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[], int *num_enemy
Boss boss[], int *num_boss, int *text_color,
ALLEGRO_SAMPLE *musica3, ALLEGRO_SAMPLE_ID *musica3id,
ALLEGRO_SAMPLE *musica666, ALLEGRO_SAMPLE_ID *musica666id,
int letra);
int letra, bool *UP, bool *RIGHT, bool *LEFT, bool *Q, bool *W, bool *E);
void ResetKeys(struct Player &player, bool *UP, bool *RIGHT, bool *LEFT, bool *Q, bool *W, bool *E);
void TransportPlayer(Player &player);

//Funções shootQ
Expand Down
Binary file added Game-C/icon.ico
Binary file not shown.
Loading

0 comments on commit d35d68c

Please sign in to comment.