dungeonanddeamon/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.h
2020-05-02 16:10:48 +02:00

89 lines
1.4 KiB
C++

#pragma once
#include <CircleShape2D.hpp>
#include <CollisionShape2D.hpp>
#include <Sprite.hpp>
#include <AnimatedSprite.hpp>
#include "Player.h"
using namespace godot;
class GestionPlayer : public KinematicBody2D
{
public:
AnimatedSprite* sprite_player_ptr;
Ref<Resource> texture_player_ptr;
private:
GODOT_CLASS(GestionPlayer, KinematicBody2D)
public:
GestionPlayer();
void static _register_methods();
void _process(float delta);
void _init();
void _ready();
void createPlayer();
void setupPlayer();
public:
Player p;
public:
void traitementInput();
void setPosition(int x, int y);
private:
//void droit();
//void gauche();
//void bas();
//void saut();
//void dash();
//void idle();
//void attack();
//void bigattack();
//void block();
void PlayerLogic(float dt);
void PlayerLogic_OnGround(float dt);
void PlayerLogic_Jump(float dt);
void PlayerLogic_FreeFall(float dt);
public:
const float speed = 100.f;
float pv = 100;
const float GamePlayMultiplicator = 100.0f;
const float gravity = 9.8f * GamePlayMultiplicator;
const float power_jump = -5.0f * GamePlayMultiplicator;
bool on_ground = false;
bool on_roof = false;
bool on_left_wall = false;
bool on_right_wall = false;
struct S_PlayerState
{
bool right;
bool left;
bool jump;
bool dash;
bool idle;
bool attack;
bool bigattack;
bool block;
bool freefall;
} playerState;
private:
Vector2 velocity;
Vector2 FLOOR;
};