mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
ajustement godot
This commit is contained in:
@ -1,25 +1,71 @@
|
||||
#include "GestionPlayer.h"
|
||||
|
||||
void GestionPlayer::droit()
|
||||
{
|
||||
#include "GestionPlayer.h"
|
||||
|
||||
|
||||
|
||||
using namespace godot;
|
||||
|
||||
void Player::_register_methods() {
|
||||
register_method((char*)"_process", &Player::_process);
|
||||
}
|
||||
|
||||
void GestionPlayer::gauche()
|
||||
{
|
||||
void Player::_init() {}
|
||||
|
||||
Player::Player() {
|
||||
velocity = Vector2(0, 0);
|
||||
}
|
||||
|
||||
void GestionPlayer::bas()
|
||||
Player::~Player() {}
|
||||
|
||||
void Player::_process(float delta)
|
||||
{
|
||||
|
||||
UpdateMotionFromInput();
|
||||
|
||||
velocity = move_and_slide(velocity, FLOOR);
|
||||
}
|
||||
|
||||
void GestionPlayer::saut()
|
||||
void Player::UpdateMotionFromInput()
|
||||
{
|
||||
velocity = Vector2(0, 0);
|
||||
FLOOR = Vector2(0, -1);
|
||||
|
||||
|
||||
Input* i = Input::get_singleton();
|
||||
|
||||
if (i->is_action_pressed("ui_left"))
|
||||
{
|
||||
|
||||
velocity.x -= speed;
|
||||
void play(String anim = "run", bool backwards = false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
else if (i->is_action_pressed("ui_right"))
|
||||
velocity.x += speed;
|
||||
else
|
||||
velocity.x = 0.0;
|
||||
|
||||
if (i->is_action_pressed("ui_select")) {
|
||||
if (on_ground == true) {
|
||||
velocity.y = power_jump;
|
||||
on_ground = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (is_on_floor()) {
|
||||
on_ground = true;
|
||||
velocity.y += 0;
|
||||
}
|
||||
else {
|
||||
on_ground = false;
|
||||
velocity.y += gravity;
|
||||
}
|
||||
}
|
||||
|
||||
void GestionPlayer::idle()
|
||||
{
|
||||
}
|
||||
|
||||
void GestionPlayer::attack()
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user