Ennemis + interactions avec projectile
- Ajout d'une structure monster pour pouvoir les différentier. - Début de la tache sur les ennemis - Modification de l'interaction projectile/ennemis
This commit is contained in:
parent
fdcf7c7179
commit
ea4fb86ac1
8 changed files with 52336 additions and 51248 deletions
|
@ -1,4 +1,4 @@
|
||||||
635E684B79701B039C64EA45C3F84D30=CA3D7F5B74D23BB249A63D9AEFB759CA
|
635E684B79701B039C64EA45C3F84D30=CA3D7F5B74D23BB249A63D9AEFB759CA
|
||||||
8DF89ED150041C4CBC7CB9A9CAA90856=786F7A4E7FD721DD7DA504061EFBB9FE
|
8DF89ED150041C4CBC7CB9A9CAA90856=786F7A4E7FD721DD7DA504061EFBB9FE
|
||||||
DC22A860405A8BF2F2C095E5B6529F12=27012316FF7CB74C53C654C2433BBA42
|
DC22A860405A8BF2F2C095E5B6529F12=786F7A4E7FD721DD7DA504061EFBB9FE
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
|
|
@ -141,20 +141,39 @@ struct Missile
|
||||||
|
|
||||||
struct Joueur
|
struct Joueur
|
||||||
{
|
{
|
||||||
uint16_t x;
|
// uint32_t et pas 16 car fonction d'affichage bitmap (j'en sais pas plus)
|
||||||
uint16_t y;
|
uint32_t x;
|
||||||
|
uint32_t y;
|
||||||
uint8_t dx;
|
uint8_t dx;
|
||||||
uint8_t dy;
|
uint8_t dy;
|
||||||
uint8_t health;
|
uint8_t health;
|
||||||
struct Missile missile;
|
struct Missile missile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Monster
|
||||||
|
{
|
||||||
|
uint32_t x;
|
||||||
|
uint32_t y;
|
||||||
|
uint8_t pbmp;
|
||||||
|
struct Missile missile;
|
||||||
|
uint8_t type;
|
||||||
|
uint8_t health;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Définition des paramètres du joueurs
|
// Définition des paramètres du joueurs
|
||||||
|
|
||||||
struct Joueur joueur = {10, 10, 1, 1, 3};
|
struct Joueur joueur = {10, 10, 1, 1, 3};
|
||||||
|
|
||||||
uint32_t LCD_COLOR_BACKGROUND = LCD_COLOR_BLACK;
|
uint32_t LCD_COLOR_BACKGROUND = LCD_COLOR_BLACK;
|
||||||
|
|
||||||
|
// Number of waves of enemies before the game is won.
|
||||||
|
|
||||||
|
uint8_t waves_left = 10;
|
||||||
|
|
||||||
|
// La limite au dela de laquelle les ennemis ne peuvent pas être (utilisé pour
|
||||||
|
uint32_t Limit_ennemis_x = 50;
|
||||||
|
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
@ -1566,11 +1585,30 @@ void f_GameMaster(void const * argument)
|
||||||
/* USER CODE BEGIN 5 */
|
/* USER CODE BEGIN 5 */
|
||||||
TickType_t xLastWakeTime;
|
TickType_t xLastWakeTime;
|
||||||
const TickType_t xPeriodeTache = 10;
|
const TickType_t xPeriodeTache = 10;
|
||||||
|
// Si la variable end est à 1, le jeu s'arrete.
|
||||||
|
uint8_t end = 0;
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
xQueueReceive(Queue_FHandle, &end, 0);
|
||||||
|
if (end == 1){
|
||||||
|
vTaskDelete(Block_EnemieHandle);
|
||||||
|
vTaskDelete(ProjectileHandle);
|
||||||
|
vTaskDelete(Joueur_1Handle);
|
||||||
|
|
||||||
|
//TODO L'affichage de l'écran de fin et des scores
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end == 0){
|
||||||
|
if (waves_left == 0){
|
||||||
|
vTaskDelete(Block_EnemieHandle);
|
||||||
|
vTaskDelete(ProjectileHandle);
|
||||||
|
vTaskDelete(Joueur_1Handle);
|
||||||
|
|
||||||
|
//TODO L'affichage de l'écran de fin et des scores
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1622,7 +1660,7 @@ void f_Joueur_1(void const * argument)
|
||||||
BSP_LCD_SetTextColor(LCD_COLOR_BACKGROUND);
|
BSP_LCD_SetTextColor(LCD_COLOR_BACKGROUND);
|
||||||
BSP_LCD_FillRect(joueur.x, joueur.y, Width, Height);
|
BSP_LCD_FillRect(joueur.x, joueur.y, Width, Height);
|
||||||
|
|
||||||
BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp)
|
// BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp)
|
||||||
while (HAL_ADC_PollForConversion(&hadc3, 100) != HAL_OK);
|
while (HAL_ADC_PollForConversion(&hadc3, 100) != HAL_OK);
|
||||||
joystick_v = HAL_ADC_GetValue(&hadc3);
|
joystick_v = HAL_ADC_GetValue(&hadc3);
|
||||||
while (HAL_ADC_PollForConversion(&hadc1, 100) != HAL_OK);
|
while (HAL_ADC_PollForConversion(&hadc1, 100) != HAL_OK);
|
||||||
|
@ -1663,9 +1701,42 @@ void f_block_enemie(void const * argument)
|
||||||
/* USER CODE BEGIN f_block_enemie */
|
/* USER CODE BEGIN f_block_enemie */
|
||||||
TickType_t xLastWakeTime;
|
TickType_t xLastWakeTime;
|
||||||
const TickType_t xPeriodeTache = 10;
|
const TickType_t xPeriodeTache = 10;
|
||||||
|
uint8_t number_monsters = 30;
|
||||||
|
struct Monster list_monsters[30];
|
||||||
|
uint8_t end = 0;
|
||||||
|
uint8_t deplacement = 1;
|
||||||
|
struct Missile missile;
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
xQueueReceive(Queue_EHandle, &missile, 0);
|
||||||
|
if (number_monsters == 0){
|
||||||
|
xQueueSend(Queue_FHandle, &end, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0;i< number_monsters;i++){
|
||||||
|
if (list_monsters[i].health > 0 ){
|
||||||
|
if ((missile.x == list_monsters[i].x)&&(missile.y == list_monsters[i].y))
|
||||||
|
{
|
||||||
|
list_monsters[i].health = list_monsters[i].health -1;
|
||||||
|
// Est ce que cette ligne va marcher sachant que je transmets l'adresse dans la queue ?
|
||||||
|
missile.valide = 0;
|
||||||
|
if (list_monsters[i].health == 0){
|
||||||
|
//TODO explosion du plaisir ?
|
||||||
|
number_monsters = number_monsters -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BSP_LCD_DrawBitmap(list_monsters[i].x, list_monsters[i].y, &list_monsters[i].pbmp);
|
||||||
|
// On alterne le deplacement des méchants comme dans le vrai jeux
|
||||||
|
//TODO est ce que ca va posé un décalage entre l'affichage et la hitboxe ?
|
||||||
|
list_monsters[i].x = list_monsters[i].x + deplacement*2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deplacement = -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vTaskDelayUntil(&xLastWakeTime, xPeriodeTache);
|
vTaskDelayUntil(&xLastWakeTime, xPeriodeTache);
|
||||||
}
|
}
|
||||||
/* USER CODE END f_block_enemie */
|
/* USER CODE END f_block_enemie */
|
||||||
|
@ -1708,6 +1779,11 @@ void f_projectile(void const * argument)
|
||||||
// Si le missile appartient au joueur :
|
// Si le missile appartient au joueur :
|
||||||
if (liste_missile[i].equipe == 0)
|
if (liste_missile[i].equipe == 0)
|
||||||
{
|
{
|
||||||
|
if (liste_missile[i].x >= Limit_ennemis_x)
|
||||||
|
{
|
||||||
|
xQueueSend(Queue_EHandle, &liste_missile+indice,0);
|
||||||
|
// TODO Une petite animation d'explosion ?
|
||||||
|
}
|
||||||
|
|
||||||
if ((liste_missile[i].x > 1)&&(liste_missile[i].x < LCD_HEIGHT-1)&&(liste_missile[i].y < LCD_WIDTH-1)&&(liste_missile[i].y > 1))
|
if ((liste_missile[i].x > 1)&&(liste_missile[i].x < LCD_HEIGHT-1)&&(liste_missile[i].y < LCD_WIDTH-1)&&(liste_missile[i].y > 1))
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
|
@ -1,30 +1,30 @@
|
||||||
main.c:166:5:main 280 static
|
main.c:185:5:main 280 static
|
||||||
main.c:341:6:SystemClock_Config 216 static
|
main.c:360:6:SystemClock_Config 216 static
|
||||||
main.c:417:13:MX_ADC1_Init 24 static
|
main.c:436:13:MX_ADC1_Init 24 static
|
||||||
main.c:467:13:MX_ADC3_Init 24 static
|
main.c:486:13:MX_ADC3_Init 24 static
|
||||||
main.c:517:13:MX_CRC_Init 8 static
|
main.c:536:13:MX_CRC_Init 8 static
|
||||||
main.c:548:13:MX_DAC_Init 16 static
|
main.c:567:13:MX_DAC_Init 16 static
|
||||||
main.c:586:13:MX_DMA2D_Init 8 static
|
main.c:605:13:MX_DMA2D_Init 8 static
|
||||||
main.c:623:13:MX_I2C1_Init 8 static
|
main.c:642:13:MX_I2C1_Init 8 static
|
||||||
main.c:669:13:MX_I2C3_Init 8 static
|
main.c:688:13:MX_I2C3_Init 8 static
|
||||||
main.c:715:13:MX_LTDC_Init 64 static
|
main.c:734:13:MX_LTDC_Init 64 static
|
||||||
main.c:777:13:MX_RNG_Init 8 static
|
main.c:796:13:MX_RNG_Init 8 static
|
||||||
main.c:803:13:MX_RTC_Init 80 static
|
main.c:822:13:MX_RTC_Init 80 static
|
||||||
main.c:895:13:MX_SPI2_Init 8 static
|
main.c:914:13:MX_SPI2_Init 8 static
|
||||||
main.c:935:13:MX_TIM1_Init 40 static
|
main.c:954:13:MX_TIM1_Init 40 static
|
||||||
main.c:982:13:MX_TIM2_Init 40 static
|
main.c:1001:13:MX_TIM2_Init 40 static
|
||||||
main.c:1027:13:MX_TIM3_Init 88 static
|
main.c:1046:13:MX_TIM3_Init 88 static
|
||||||
main.c:1093:13:MX_TIM5_Init 40 static
|
main.c:1112:13:MX_TIM5_Init 40 static
|
||||||
main.c:1138:13:MX_TIM8_Init 112 static
|
main.c:1157:13:MX_TIM8_Init 112 static
|
||||||
main.c:1217:13:MX_UART7_Init 8 static
|
main.c:1236:13:MX_UART7_Init 8 static
|
||||||
main.c:1252:13:MX_USART1_UART_Init 8 static
|
main.c:1271:13:MX_USART1_UART_Init 8 static
|
||||||
main.c:1287:13:MX_USART6_UART_Init 8 static
|
main.c:1306:13:MX_USART6_UART_Init 8 static
|
||||||
main.c:1318:13:MX_FMC_Init 40 static
|
main.c:1337:13:MX_FMC_Init 40 static
|
||||||
main.c:1369:13:MX_GPIO_Init 72 static
|
main.c:1388:13:MX_GPIO_Init 72 static
|
||||||
main.c:1546:5:envoie_score 16 static
|
main.c:1565:5:envoie_score 16 static
|
||||||
main.c:1562:6:f_GameMaster 24 static
|
main.c:1581:6:f_GameMaster 32 static
|
||||||
main.c:1590:6:f_Joueur_1 80 static
|
main.c:1628:6:f_Joueur_1 80 static
|
||||||
main.c:1661:6:f_block_enemie 24 static
|
main.c:1699:6:f_block_enemie 1016 static
|
||||||
main.c:1681:6:f_projectile 384 static
|
main.c:1752:6:f_projectile 384 static
|
||||||
main.c:1766:6:HAL_TIM_PeriodElapsedCallback 16 static
|
main.c:1842:6:HAL_TIM_PeriodElapsedCallback 16 static
|
||||||
main.c:1783:6:Error_Handler 4 static,ignoring_inline_asm
|
main.c:1859:6:Error_Handler 4 static,ignoring_inline_asm
|
||||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue