mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
Update
This commit is contained in:
@ -1,59 +1,46 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Godot.hpp>
|
||||
#include <KinematicBody2D.hpp>
|
||||
#include <Input.hpp>
|
||||
|
||||
namespace godot {
|
||||
class GestionPlayer : public KinematicBody2D
|
||||
{
|
||||
|
||||
// Godot structure
|
||||
private:
|
||||
GODOT_CLASS(GestionPlayer, KinematicBody2D)
|
||||
public:
|
||||
static void _register_methods();
|
||||
void _init();
|
||||
void _process(float delta);
|
||||
|
||||
GestionPlayer();
|
||||
~GestionPlayer();
|
||||
#include <CircleShape2D.hpp>
|
||||
#include <CollisionShape2D.hpp>
|
||||
#include <Sprite.hpp>
|
||||
|
||||
|
||||
// Gameplay variables
|
||||
public:
|
||||
|
||||
const int speed = 100;
|
||||
const int gravity = 90;
|
||||
const int power_jump = -2500;
|
||||
bool on_ground = false;
|
||||
bool right;
|
||||
bool left;
|
||||
bool jump;
|
||||
#include "Player.h"
|
||||
|
||||
private:
|
||||
Vector2 velocity;
|
||||
Vector2 FLOOR;
|
||||
using namespace godot;
|
||||
|
||||
class GestionPlayer : public KinematicBody2D
|
||||
{
|
||||
public:
|
||||
Sprite* sprite_player_ptr;
|
||||
CollisionShape2D* collision_player_ptr;
|
||||
|
||||
Ref<Resource> texture_player_ptr;
|
||||
Ref<CircleShape2D> shape_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;
|
||||
|
||||
// Gameplay methods
|
||||
public:
|
||||
void UpdateMotionFromInput();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
void traitementInput();
|
||||
|
||||
void droit();
|
||||
void gauche();
|
||||
void bas();
|
||||
void saut();
|
||||
void idle();
|
||||
void attack();
|
||||
};
|
Reference in New Issue
Block a user