mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
reparation dash plus supression des warning
This commit is contained in:
parent
dfe4bd0ae5
commit
6d4576bf8c
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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; }
|
||||
|
Loading…
Reference in New Issue
Block a user