mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
Ajout gestionTerrain + Ajout Sol solide
This commit is contained in:
@ -1,11 +1,72 @@
|
||||
#include "GestionTerrain.h"
|
||||
#include <TileMap.hpp>
|
||||
#include <ResourceLoader.hpp>
|
||||
#include <Sprite.hpp>
|
||||
#include <Texture.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
GestionTerrain::GestionTerrain()
|
||||
{
|
||||
Godot::print("Constructeur");
|
||||
}
|
||||
|
||||
GestionTerrain::~GestionTerrain()
|
||||
{
|
||||
}
|
||||
|
||||
void GestionTerrain::_register_methods()
|
||||
{
|
||||
Godot::print("Register");
|
||||
register_method("_process", &GestionTerrain::_process);
|
||||
register_method("_init", &GestionTerrain::_init);
|
||||
register_method("_ready", &GestionTerrain::_ready);
|
||||
}
|
||||
|
||||
void GestionTerrain::_process()
|
||||
{
|
||||
Godot::print("Je suis le sol");
|
||||
}
|
||||
|
||||
void GestionTerrain::_init()
|
||||
{
|
||||
}
|
||||
|
||||
void GestionTerrain::_ready()
|
||||
{
|
||||
}
|
||||
|
||||
void GestionTerrain::AjoutMur(int sizeX, int sizeY, int posX, int posY)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GestionTerrain::AjoutSolSolide(int sizeX, int sizeY, int posX, int posY)
|
||||
{
|
||||
Godot::print("Ajout sol solide");
|
||||
Transform2D t;
|
||||
Vector2 v;
|
||||
Size2 s;
|
||||
|
||||
//setup de la size
|
||||
s.x = sizeX;
|
||||
s.y = sizeY;
|
||||
v.x = posX;
|
||||
v.y = posY;
|
||||
t.set_origin(v);
|
||||
t.scale(s);
|
||||
|
||||
StaticBody2D* m = StaticBody2D::_new();
|
||||
|
||||
Sprite* sprite = Sprite::_new();
|
||||
|
||||
Ref<Texture> texture_ptr = ResourceLoader::get_singleton()->load("res://sol.png");
|
||||
sprite->set_texture(texture_ptr);
|
||||
|
||||
m->add_child(sprite);
|
||||
m->set_transform(t);
|
||||
|
||||
add_child(m);
|
||||
}
|
||||
|
||||
void GestionTerrain::AjoutSolTraversable(int sizeX, int sizeY, int posX, int posY)
|
||||
|
Reference in New Issue
Block a user