correction de la dificulté
This commit is contained in:
parent
0a2fd06876
commit
9b5fb92e86
2 changed files with 108 additions and 55 deletions
67
Biblio/UML/class.puml
Normal file
67
Biblio/UML/class.puml
Normal file
|
@ -0,0 +1,67 @@
|
|||
@startuml
|
||||
class Joueur {
|
||||
+ int32_t x
|
||||
+ int32_t y
|
||||
+ int8_t dx
|
||||
+ int8_t dy
|
||||
+ int8_t health
|
||||
+ Missile missile
|
||||
---
|
||||
modelise le joueur
|
||||
}
|
||||
|
||||
class Missile{
|
||||
+ int16_t x
|
||||
+ int16_t y
|
||||
+ int8_t dx
|
||||
+ int8_t dy
|
||||
+ Camps_missile equipe
|
||||
+ uint8_t damage
|
||||
+ uint8_t valide
|
||||
---
|
||||
modelise les missiles.
|
||||
}
|
||||
|
||||
class Monster{
|
||||
+ int32_t x
|
||||
+ int32_t y
|
||||
+ int16_t health
|
||||
+ Missile missile
|
||||
---
|
||||
modelise les monstres.
|
||||
}
|
||||
|
||||
class Collision{
|
||||
uint8_t idx1
|
||||
uint8_t idx2
|
||||
uint8_t damage
|
||||
---
|
||||
décrit les colision entre missile et monstre.
|
||||
}
|
||||
|
||||
enum Camps_missile{
|
||||
MISSILE_AMI
|
||||
MISSILE_ENNEMI
|
||||
---
|
||||
décrit le camps du missile.
|
||||
}
|
||||
|
||||
enum End_type{
|
||||
END_TABLEAU_VIDE
|
||||
END_MORT_JOUEUR
|
||||
---
|
||||
décrit le type de fin de la partie.
|
||||
}
|
||||
|
||||
enum Sens_ennemie{
|
||||
DROITE
|
||||
GAUCHE
|
||||
---
|
||||
décrit le sens de déplacement actuel des ennemis.
|
||||
}
|
||||
|
||||
Joueur *-- Missile : décrit le missile de base du joueur.
|
||||
|
||||
Monster *-- Missile : décrit le missile de base des monstres.
|
||||
Missile *-- Camps_missile : décrit le missile de base des monstres.
|
||||
@enduml
|
|
@ -127,6 +127,12 @@ enum End_type
|
|||
END_MORT_JOUEUR
|
||||
};
|
||||
|
||||
enum Sens_ennemie
|
||||
{
|
||||
DROITE,
|
||||
GAUCHE
|
||||
};
|
||||
|
||||
const uint16_t joueur_width = 20;
|
||||
const uint16_t joueur_height = 20;
|
||||
|
||||
|
@ -398,8 +404,7 @@ void SystemClock_Config(void)
|
|||
}
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
|
@ -470,7 +475,6 @@ static void MX_ADC1_Init(void)
|
|||
/* USER CODE BEGIN ADC1_Init 2 */
|
||||
|
||||
/* USER CODE END ADC1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,7 +524,6 @@ static void MX_ADC3_Init(void)
|
|||
/* USER CODE BEGIN ADC3_Init 2 */
|
||||
|
||||
/* USER CODE END ADC3_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -551,7 +554,6 @@ static void MX_CRC_Init(void)
|
|||
/* USER CODE BEGIN CRC_Init 2 */
|
||||
|
||||
/* USER CODE END CRC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -589,7 +591,6 @@ static void MX_DAC_Init(void)
|
|||
/* USER CODE BEGIN DAC_Init 2 */
|
||||
|
||||
/* USER CODE END DAC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -626,7 +627,6 @@ static void MX_DMA2D_Init(void)
|
|||
/* USER CODE BEGIN DMA2D_Init 2 */
|
||||
|
||||
/* USER CODE END DMA2D_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -688,7 +688,6 @@ static void MX_LTDC_Init(void)
|
|||
/* USER CODE BEGIN LTDC_Init 2 */
|
||||
|
||||
/* USER CODE END LTDC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -714,7 +713,6 @@ static void MX_RNG_Init(void)
|
|||
/* USER CODE BEGIN RNG_Init 2 */
|
||||
|
||||
/* USER CODE END RNG_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -761,7 +759,6 @@ static void MX_TIM1_Init(void)
|
|||
/* USER CODE BEGIN TIM1_Init 2 */
|
||||
|
||||
/* USER CODE END TIM1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -806,7 +803,6 @@ static void MX_TIM2_Init(void)
|
|||
/* USER CODE BEGIN TIM2_Init 2 */
|
||||
|
||||
/* USER CODE END TIM2_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -872,7 +868,6 @@ static void MX_TIM3_Init(void)
|
|||
|
||||
/* USER CODE END TIM3_Init 2 */
|
||||
HAL_TIM_MspPostInit(&htim3);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -917,7 +912,6 @@ static void MX_TIM5_Init(void)
|
|||
/* USER CODE BEGIN TIM5_Init 2 */
|
||||
|
||||
/* USER CODE END TIM5_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -996,7 +990,6 @@ static void MX_TIM8_Init(void)
|
|||
|
||||
/* USER CODE END TIM8_Init 2 */
|
||||
HAL_TIM_MspPostInit(&htim8);
|
||||
|
||||
}
|
||||
|
||||
/* FMC initialization function */
|
||||
|
@ -1087,8 +1080,7 @@ static void MX_GPIO_Init(void)
|
|||
HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOH, LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin
|
||||
|LED2_Pin|LED18_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOH, LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET);
|
||||
|
@ -1109,8 +1101,7 @@ static void MX_GPIO_Init(void)
|
|||
|
||||
/*Configure GPIO pins : ULPI_D7_Pin ULPI_D6_Pin ULPI_D5_Pin ULPI_D2_Pin
|
||||
ULPI_D1_Pin ULPI_D4_Pin */
|
||||
GPIO_InitStruct.Pin = ULPI_D7_Pin|ULPI_D6_Pin|ULPI_D5_Pin|ULPI_D2_Pin
|
||||
|ULPI_D1_Pin|ULPI_D4_Pin;
|
||||
GPIO_InitStruct.Pin = ULPI_D7_Pin | ULPI_D6_Pin | ULPI_D5_Pin | ULPI_D2_Pin | ULPI_D1_Pin | ULPI_D4_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
|
@ -1199,8 +1190,7 @@ static void MX_GPIO_Init(void)
|
|||
|
||||
/*Configure GPIO pins : LED13_Pin LED17_Pin LED11_Pin LED12_Pin
|
||||
LED2_Pin LED18_Pin */
|
||||
GPIO_InitStruct.Pin = LED13_Pin|LED17_Pin|LED11_Pin|LED12_Pin
|
||||
|LED2_Pin|LED18_Pin;
|
||||
GPIO_InitStruct.Pin = LED13_Pin | LED17_Pin | LED11_Pin | LED12_Pin | LED2_Pin | LED18_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
@ -1296,7 +1286,6 @@ static void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
@ -1555,11 +1544,7 @@ void f_Joueur_1(void const * argument)
|
|||
void f_block_enemie(void const *argument)
|
||||
{
|
||||
/* USER CODE BEGIN f_block_enemie */
|
||||
enum Sens_ennemie
|
||||
{
|
||||
DROITE,
|
||||
GAUCHE
|
||||
};
|
||||
|
||||
TickType_t xLastWakeTime;
|
||||
xLastWakeTime = xTaskGetTickCount();
|
||||
const TickType_t xPeriodeTache = 200 / portTICK_PERIOD_MS; // Toute les demi secondes
|
||||
|
@ -1642,7 +1627,7 @@ void f_block_enemie(void const * argument)
|
|||
{
|
||||
if (Table_ennemis[idx1][idx2].health > 0)
|
||||
{
|
||||
if (proba_bernoulli(1, 32))
|
||||
if (proba_bernoulli(wave, 32))
|
||||
{
|
||||
missile.x = Table_ennemis[idx1][idx2].x + monstre_width / 2;
|
||||
missile.y = Table_ennemis[idx1][idx2].y + monstre_height;
|
||||
|
@ -1781,7 +1766,8 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
|||
/* USER CODE BEGIN Callback 0 */
|
||||
|
||||
/* USER CODE END Callback 0 */
|
||||
if (htim->Instance == TIM6) {
|
||||
if (htim->Instance == TIM6)
|
||||
{
|
||||
HAL_IncTick();
|
||||
}
|
||||
/* USER CODE BEGIN Callback 1 */
|
||||
|
|
Loading…
Reference in a new issue