@@ -22,7 +22,7 @@ extern const int GRAVITY = 1; //gravidade padrao em 1
22
22
extern const int FPS = 60 ;
23
23
extern int back_x ;
24
24
extern int back_y ;
25
- extern bool keys [ 8 ];
25
+
26
26
extern const int TELA_INICIO = 0 ;
27
27
extern const int TELA_ISNTRU = 1 ;
28
28
extern const int TELA_JOGO = 2 ;
@@ -45,7 +45,7 @@ void InitPlayer(Player &player, int *text_color)
45
45
player .alive = true;
46
46
player .shield = false;
47
47
player .velx = 0 ;
48
- player .vely = 0 ;
48
+ player .vely = 1 ;
49
49
player .boundx = 40 ;
50
50
player .boundy = 40 ;
51
51
player .score = 0 ;
@@ -67,19 +67,19 @@ void InitPlayer(Player &player, int *text_color)
67
67
68
68
void PlayerSample (Player & player , int letra , ALLEGRO_SAMPLE_ID * musica3id , ALLEGRO_SAMPLE * musica3 )
69
69
{
70
- if (letra == 4 )
70
+ if (letra == 3 )
71
71
{
72
72
if (!player .alive )
73
73
{
74
- al_stop_sample_instance (player .instance [0 ]);
75
- al_play_sample (musica3 , 1 , 0 , 1 , ALLEGRO_PLAYMODE_LOOP , musica3id );
74
+ al_stop_sample_instance (player .instance [1 ]);
76
75
}
77
76
78
77
if (player .lives == 2 )
79
78
{
80
- al_stop_sample (musica3id );
79
+ // al_stop_sample(musica3id);
81
80
al_play_sample_instance (player .instance [0 ]);
82
81
}
82
+
83
83
if (player .lives == 1 )
84
84
{
85
85
al_stop_sample_instance (player .instance [0 ]);
@@ -205,7 +205,7 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[],
205
205
Obstacle & obstacle , Boss boss [], int * num_boss , int * text_color ,
206
206
ALLEGRO_SAMPLE * musica3 , ALLEGRO_SAMPLE_ID * musica3id ,
207
207
ALLEGRO_SAMPLE * musica666 , ALLEGRO_SAMPLE_ID * musica666id ,
208
- int letra )
208
+ int letra , bool * UP , bool * RIGHT , bool * LEFT , bool * Q , bool * W , bool * E )
209
209
{
210
210
int j ;
211
211
if (player .lives <= 0 )
@@ -220,13 +220,13 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[],
220
220
player .lives = 5 ;
221
221
player .speed = 7 ;
222
222
player .jumpSpeed = 15 ;
223
- player .jump = false ;
223
+ player .jump = true ;
224
224
player .moving = false;
225
225
player .colision = false;
226
226
player .alive = true;
227
227
player .shield = false;
228
228
player .velx = 0 ;
229
- player .vely = 0 ;
229
+ player .vely = 1 ;
230
230
player .boundx = 40 ;
231
231
player .boundy = 50 ;
232
232
player .score = 0 ;
@@ -263,12 +263,29 @@ void ResetPlayer(int *tela, Player &player, Enemy_red enemyred[],
263
263
al_stop_sample_instance (boss [j ].instance [0 ]);
264
264
al_stop_sample_instance (boss [j ].instance [1 ]);
265
265
if (letra == 666 )
266
- al_stop_sample_instance (boss [j ].instance [2 ]);
266
+ al_stop_sample_instance (boss [j ].instance [2 ]);
267
267
}
268
268
obstacle .score = 5 ;
269
+ * UP = false;
270
+ * RIGHT = false;
271
+ * LEFT = false;
272
+ * Q = false;
273
+ * W = false;
274
+ * E = false;
269
275
* tela = TELA_FINAL ;
270
- for (j = 0 ; j < 8 ; j ++ )
271
- keys [j ] = false;
276
+ }
277
+ }
278
+
279
+ void ResetKeys (struct Player & player , bool * UP , bool * RIGHT , bool * LEFT , bool * Q , bool * W , bool * E )
280
+ {
281
+ if (player .alive == false)
282
+ {
283
+ * UP = false;
284
+ * RIGHT = false;
285
+ * LEFT = false;
286
+ * Q = false;
287
+ * W = false;
288
+ * E = false;
272
289
}
273
290
}
274
291
@@ -957,6 +974,7 @@ void InitBoss(struct Boss boss[], int *num_boss, int letra)
957
974
boss [j ].sample [2 ] = al_load_sample ("sounds/starwars.ogg" );
958
975
boss [j ].instance [2 ] = al_create_sample_instance (boss [j ].sample [2 ]);
959
976
al_attach_sample_instance_to_mixer (boss [j ].instance [2 ], al_get_default_mixer ());
977
+ al_set_sample_instance_gain (boss [j ].instance [2 ], 3 );
960
978
}
961
979
boss [j ].x = back_x ;
962
980
boss [j ].y = back_y ;
@@ -981,6 +999,8 @@ void InitBoss(struct Boss boss[], int *num_boss, int letra)
981
999
boss [j ].instance [1 ] = al_create_sample_instance (boss [j ].sample [1 ]);
982
1000
al_attach_sample_instance_to_mixer (boss [j ].instance [0 ], al_get_default_mixer ());
983
1001
al_attach_sample_instance_to_mixer (boss [j ].instance [1 ], al_get_default_mixer ());
1002
+ al_set_sample_instance_gain (boss [j ].instance [0 ], 2 );
1003
+ al_set_sample_instance_gain (boss [j ].instance [1 ], 2 );
984
1004
985
1005
}
986
1006
}
@@ -1003,7 +1023,7 @@ void UpdateBoss(struct Boss boss[], int *num_boss, int *text_boss, struct Player
1003
1023
int * num_enemyred , struct Enemy_blue enemyblue [], int * num_enemyblue , int letra )
1004
1024
{
1005
1025
* num_boss = 0 ;
1006
- if (player .score > 2 && boss [0 ].lived == false)
1026
+ if (player .score > 20 && boss [0 ].lived == false)
1007
1027
{
1008
1028
boss [0 ].alive = true;
1009
1029
* num_boss = 1 ;
@@ -1087,7 +1107,6 @@ void BossSample(struct Boss boss[], int *num_boss, int letra, ALLEGRO_SAMPLE_ID
1087
1107
}
1088
1108
if (letra == 1 )
1089
1109
{
1090
- al_stop_sample (musica1id );
1091
1110
al_play_sample_instance (boss [j ].instance [1 ]);
1092
1111
}
1093
1112
if (letra == 666 )
@@ -1100,19 +1119,18 @@ void BossSample(struct Boss boss[], int *num_boss, int letra, ALLEGRO_SAMPLE_ID
1100
1119
{
1101
1120
switch (letra )
1102
1121
{
1103
- case 1 :
1122
+ case 1 :
1104
1123
boss [j ].instance_played = true;
1105
1124
al_stop_sample_instance (boss [j ].instance [1 ]);
1106
- al_stop_samples ();
1107
- al_play_sample (musica1 , 1 , 0 , 1 , ALLEGRO_PLAYMODE_LOOP , musica1id );
1108
1125
break ;
1109
- case 666 :
1126
+ case 666 :
1110
1127
al_stop_sample_instance (boss [j ].instance [2 ]);
1111
1128
boss [j ].instance_played = true;
1112
1129
break ;
1130
+ }
1113
1131
}
1114
1132
}
1115
- }}
1133
+ }
1116
1134
1117
1135
//funcao para colisao de player com boss
1118
1136
void PlayerColisionBoss (struct Player & player , struct Boss boss [], int * num_boss )
@@ -1195,7 +1213,7 @@ void InitBackground0(struct Sprite &background0, ALLEGRO_SAMPLE *musica0, ALLEGR
1195
1213
background0 .image [12 ] = al_load_bitmap ("images/telas/tela-inicio0.png" );
1196
1214
background0 .image [13 ] = al_load_bitmap ("images/telas/tela-instru0.png" );
1197
1215
background0 .image [14 ] = al_load_bitmap ("images/telas/tela-final0.png" );
1198
- background0 .image [15 ] = al_load_bitmap ("images/telas/ reprovado.png" );
1216
+ background0 .image [15 ] = al_load_bitmap ("images/reprovado.png" );
1199
1217
1200
1218
//carregar musica referente
1201
1219
switch (letra )
0 commit comments