Mouvement de notre joueur (tj probleme de saut)

This commit is contained in:
Estrela Allan p1923381
2020-03-28 12:53:53 +01:00
parent 6bbe742b01
commit 15bfb3f6a9
8 changed files with 44 additions and 47 deletions

View File

@ -1,24 +1,26 @@
#include "GestionPlayer.h"
#include <AnimatedSprite.hpp>
#include <Node2D.hpp>
#include "GestionPlayer.h"
using namespace godot;
void Player::_register_methods() {
register_method((char*)"_process", &Player::_process);
void GestionPlayer::_register_methods() {
register_method((char*)"_process", &GestionPlayer::_process);
}
void Player::_init() {}
void GestionPlayer::_init() {}
Player::Player() {
GestionPlayer::GestionPlayer() {
velocity = Vector2(0, 0);
}
Player::~Player() {}
GestionPlayer::~GestionPlayer() {}
void Player::_process(float delta)
void GestionPlayer::_process(float delta)
{
UpdateMotionFromInput();
@ -26,7 +28,7 @@ void Player::_process(float delta)
velocity = move_and_slide(velocity, FLOOR);
}
void Player::UpdateMotionFromInput()
void GestionPlayer::UpdateMotionFromInput()
{
velocity = Vector2(0, 0);
FLOOR = Vector2(0, -1);
@ -36,11 +38,7 @@ void Player::UpdateMotionFromInput()
if (i->is_action_pressed("ui_left"))
{
velocity.x -= speed;
void play(String anim = "run", bool backwards = false);
}