mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
modif ennemie et tentative de mouvement
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -113,6 +113,7 @@ void GestionPlayer::bas()
|
|||||||
|
|
||||||
void GestionPlayer::saut()
|
void GestionPlayer::saut()
|
||||||
{
|
{
|
||||||
|
|
||||||
p.velocity.y = power_jump;
|
p.velocity.y = power_jump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,18 @@
|
|||||||
#include "MobsAgressif.h"
|
#include "MobsAgressif.h"
|
||||||
#include <Godot.hpp>
|
#include <Godot.hpp>
|
||||||
#include <KinematicBody2D.hpp>
|
#include <KinematicBody2D.hpp>
|
||||||
|
#include <CircleShape2D.hpp>
|
||||||
|
#include <CollisionShape2D.hpp>
|
||||||
|
#include <Sprite.hpp>
|
||||||
|
#include <Vector2.hpp>
|
||||||
|
|
||||||
class MobsCorpACorp :
|
class MobsCorpACorp :
|
||||||
public MobsAgressif
|
public MobsAgressif
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
godot::Vector2 velocity;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int rangeDegat;
|
int rangeDegat;
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <Input.hpp>
|
#include <Input.hpp>
|
||||||
#include <ResourceLoader.hpp>
|
#include <ResourceLoader.hpp>
|
||||||
#include <Texture.hpp>
|
#include <Texture.hpp>
|
||||||
|
#include "MobsCorpACorp.h"
|
||||||
|
|
||||||
MobsCorpACorpIA::MobsCorpACorpIA()
|
MobsCorpACorpIA::MobsCorpACorpIA()
|
||||||
{
|
{
|
||||||
@ -28,6 +29,7 @@ void MobsCorpACorpIA::_register_methods()
|
|||||||
|
|
||||||
void MobsCorpACorpIA::_process(float delta)
|
void MobsCorpACorpIA::_process(float delta)
|
||||||
{
|
{
|
||||||
|
m.velocity = move_and_slide(m.velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MobsCorpACorpIA::_init()
|
void MobsCorpACorpIA::_init()
|
||||||
@ -51,19 +53,7 @@ void MobsCorpACorpIA::_ready()
|
|||||||
|
|
||||||
void MobsCorpACorpIA::setupMobsCorpACorp()
|
void MobsCorpACorpIA::setupMobsCorpACorp()
|
||||||
{
|
{
|
||||||
Transform2D t;
|
|
||||||
Vector2 v;
|
|
||||||
Size2 s;
|
|
||||||
|
|
||||||
//setup de la size
|
|
||||||
s.x = 1;
|
|
||||||
s.y = 1;
|
|
||||||
v.x = 500;
|
|
||||||
v.y = 10;
|
|
||||||
t.set_origin(v);
|
|
||||||
t.scale(s);
|
|
||||||
|
|
||||||
set_transform(t);
|
|
||||||
|
|
||||||
//Setup du shape
|
//Setup du shape
|
||||||
Godot::print("SetUp de Shape Mobs");
|
Godot::print("SetUp de Shape Mobs");
|
||||||
@ -83,3 +73,27 @@ void MobsCorpACorpIA::setupMobsCorpACorp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MobsCorpACorpIA::setPosition(int x, int y)
|
||||||
|
{
|
||||||
|
Transform2D t;
|
||||||
|
Vector2 v;
|
||||||
|
Size2 s;
|
||||||
|
|
||||||
|
//setup de la size
|
||||||
|
s.x = 1;
|
||||||
|
s.y = 1;
|
||||||
|
v.x = x;
|
||||||
|
v.y = y;
|
||||||
|
t.set_origin(v);
|
||||||
|
t.scale(s);
|
||||||
|
|
||||||
|
set_transform(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MobsCorpACorpIA::mouvement()
|
||||||
|
{
|
||||||
|
m.velocity = Vector2(0, 0);
|
||||||
|
m.velocity.y += gravity;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <CollisionShape2D.hpp>
|
#include <CollisionShape2D.hpp>
|
||||||
#include <Sprite.hpp>
|
#include <Sprite.hpp>
|
||||||
#include "MobsCorpACorp.h"
|
#include "MobsCorpACorp.h"
|
||||||
|
#include <Node2D.hpp>
|
||||||
|
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
@ -33,11 +35,13 @@ public:
|
|||||||
|
|
||||||
void createMobsCorpACorp();
|
void createMobsCorpACorp();
|
||||||
void setupMobsCorpACorp();
|
void setupMobsCorpACorp();
|
||||||
|
void mouvement();
|
||||||
|
void setPosition(int x, int y);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Action();
|
void Action();
|
||||||
|
const int gravity = 90;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
Vector2 velocity;
|
|
||||||
Vector2 FLOOR;
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user