mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
60 lines
869 B
C++
60 lines
869 B
C++
#pragma once
|
|
#include <CircleShape2D.hpp>
|
|
#include <CollisionShape2D.hpp>
|
|
#include <Sprite.hpp>
|
|
|
|
|
|
|
|
#include "Player.h"
|
|
|
|
using namespace godot;
|
|
|
|
class GestionPlayer : public KinematicBody2D
|
|
{
|
|
public:
|
|
Sprite* 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 idle();
|
|
void attack();
|
|
public:
|
|
const int speed = 100;
|
|
const int gravity = 90;
|
|
const int power_jump = -250;
|
|
bool on_ground = false;
|
|
bool right;
|
|
bool left;
|
|
bool jump;
|
|
|
|
|
|
private:
|
|
Vector2 velocity;
|
|
Vector2 FLOOR;
|
|
}; |