booster quasi fonctionnel

affichage seulement visible a travers un autre booster.
ne se ramasse pas encore.
This commit is contained in:
Frederic Leger
2023-12-15 23:02:20 -05:00
parent 570bef266c
commit 2364fb9c1f
15 changed files with 285 additions and 192 deletions

View File

@@ -131,6 +131,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="booster.h" />
<ClInclude Include="array2d.h" />
<ClInclude Include="array3d.h" />
<ClInclude Include="blockinfo.h" />
@@ -147,6 +148,7 @@
<ClInclude Include="world.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="booster.cpp" />
<ClCompile Include="blockinfo.cpp" />
<ClCompile Include="boostinfo.cpp" />
<ClCompile Include="bullet.cpp" />

View File

@@ -54,6 +54,9 @@
<ClInclude Include="transformation.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="booster.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="boostinfo.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
@@ -83,6 +86,9 @@
<ClCompile Include="transformation.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="booster.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="boostinfo.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>

38
SQCSim-common/booster.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include "booster.h"
Booster::Booster()
{
}
Booster::Booster(Vector3f tpos, BOOST_TYPE ttype)
{
pos = tpos;
type = ttype;
available = true;
}
Booster::~Booster()
{
}
Vector3f Booster::GetPosition()
{
return pos;
}
BOOST_TYPE Booster::GetType()
{
return type;
}
bool Booster::GetAvailability()
{
return available;
}
void Booster::SetAvailability(bool value)
{
available = value;
}

20
SQCSim-common/booster.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef BOOSTER_H__
#define BOOSTER_H__
#include "define.h"
#include "vector3.h"
class Booster {
public:
Booster();
Booster(Vector3f tpos, BOOST_TYPE ttype);
~Booster();
Vector3f GetPosition();
BOOST_TYPE GetType();
bool GetAvailability();
void SetAvailability(bool value);
private:
Vector3f pos;
BOOST_TYPE type;
bool available;
};
#endif

View File

@@ -31,7 +31,7 @@
#define TEXTURE_SIZE 512
#define MAX_BULLETS 512
#define NB_BOOST 1
#define NB_BOOST 2
#define TIME_SPEED_BOOST 10 //secondes
#define TIME_DAMAGE_BOOST 10 //secondes
#define TIME_INVINCIBLE_BOOST 4 //secondes

View File

@@ -216,7 +216,8 @@ void Player::TakeBooster(Booster booster_table[])
{
for (int i = 0; i < sizeof(booster_table); i++)
{
if (abs((m_position.x + m_position.y + m_position.z) - (booster_table[i].GetPosition().x + booster_table[i].GetPosition().y + booster_table[i].GetPosition().z)) <= 0.5f && booster_table[i].GetAvailability() == true)
Vector3f pos = booster_table[i].GetPosition();
if (abs((m_position.x + m_position.y + m_position.z) - (pos.x + pos.y +pos.z)) <= 0.5f && booster_table[i].GetAvailability() == true)
{
GetBooster(booster_table[i].GetType());
booster_table[i].SetAvailability(false);

View File

@@ -4,7 +4,7 @@
#include <cmath>
#include "transformation.h"
#include "vector3.h"
#include "../SQCSim2021/booster.h"
#include "booster.h"
#include "define.h"