reparation dash plus supression des warning

This commit is contained in:
Estrela Allan p1923381 2020-05-04 15:02:08 +02:00
parent dfe4bd0ae5
commit 6d4576bf8c
4 changed files with 25 additions and 12 deletions

View File

@ -113,13 +113,17 @@ void GestionPlayer::traitementInput()
Input* i = Input::get_singleton();
// move in X directions
p.velocity.x = 0.0f; // rest x, keyboard action will change this
if (i->is_action_pressed("ui_left"))
playerState.Flags.left = true;
if (i->is_action_pressed("ui_right"))
playerState.Flags.right = true;
if (i->is_action_pressed("dash"))
playerState.Flags.dash = true;
{
if (playerState.Flags.left || playerState.Flags.right)
{
playerState.Flags.dash = true;
}
}
if (i->is_action_pressed("attack"))
playerState.Flags.attack = true;
if (i->is_action_pressed("attack2"))
@ -275,8 +279,16 @@ void GestionPlayer::PlayerLogic_OnGround(float dt)
else if (playerState.Flags.dash)
{
sprite_player_ptr->play("dash");
p.velocity.x = -speed;
p.velocity.x =+ 1000.0f;
if (playerState.Flags.left)
{
p.velocity.x = -speed * 2.0f;
sprite_player_ptr->set_flip_h(true);
}
else if (playerState.Flags.right)
{
p.velocity.x = +speed * 2.0f;
sprite_player_ptr->set_flip_h(false);
}
playerState.Flags.isInBlockingAnimation = true;
playerState.Flags.dash = false;
}
@ -304,6 +316,7 @@ void GestionPlayer::PlayerLogic_OnGround(float dt)
}
else
{
p.velocity.x = 0.0f; // rest x, keyboard action will change this
sprite_player_ptr->play("Idle");
}
}

View File

@ -35,12 +35,12 @@ void GestionTerrain::_ready()
{
}
void GestionTerrain::AjoutMur(int sizeX, int sizeY, int posX, int posY)
void GestionTerrain::AjoutMur(float sizeX, float sizeY, float posX, float posY)
{
}
void GestionTerrain::AjoutSolSolide(int sizeX, int sizeY, int posX, int posY)
void GestionTerrain::AjoutSolSolide(float sizeX, float sizeY, float posX, float posY)
{
Godot::print("Ajout sol solide");
Transform2D t;
@ -69,7 +69,7 @@ void GestionTerrain::AjoutSolSolide(int sizeX, int sizeY, int posX, int posY)
elems_terrains.push_back(m);
}
void GestionTerrain::AjoutSolTraversable(int sizeX, int sizeY, int posX, int posY)
void GestionTerrain::AjoutSolTraversable(float sizeX, float sizeY, float posX, float posY)
{
}

View File

@ -25,9 +25,9 @@ public:
void _ready();
private:
void AjoutMur(int sizeX, int sizeY, int posX, int posY);
void AjoutSolSolide(int sizeX, int sizeY, int posX, int posY);
void AjoutSolTraversable(int sizeX, int sizeY, int posX, int posY);
void AjoutMur(float sizeX, float sizeY, float posX, float posY);
void AjoutSolSolide(float sizeX, float sizeY, float posX, float posY);
void AjoutSolTraversable(float sizeX, float sizeY, float posX, float posY);
void SuppressionTout();

View File

@ -214,8 +214,8 @@ struct Vector2 {
inline Vector2 snapped(const Vector2 &p_by) const {
return Vector2(
p_by.x != 0 ? ::floor(x / p_by.x + 0.5) * p_by.x : x,
p_by.y != 0 ? ::floor(y / p_by.y + 0.5) * p_by.y : y);
p_by.x != 0.0f ? ::floor(x / p_by.x + 0.5f) * p_by.x : x,
p_by.y != 0.0f ? ::floor(y / p_by.y + 0.5f) * p_by.y : y);
}
inline real_t aspect() const { return width / height; }