mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
71 lines
1.2 KiB
C++
71 lines
1.2 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(float dt);
|
|
|
|
void setPosition(int x, int y);
|
|
|
|
private:
|
|
void droit();
|
|
void gauche();
|
|
void bas();
|
|
void saut();
|
|
void dash();
|
|
void idle();
|
|
void attack();
|
|
void bigattack();
|
|
void animation();
|
|
void block();
|
|
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;
|
|
bool right;
|
|
bool left;
|
|
bool jump;
|
|
|
|
|
|
private:
|
|
Vector2 velocity;
|
|
Vector2 FLOOR;
|
|
}; |