Hitbox reverse pour taille 4

This commit is contained in:
Antoine 2021-06-17 22:43:51 +02:00
parent ef1a8d5583
commit ff16ea1ae9
5 changed files with 17 additions and 15 deletions

View File

@ -2,20 +2,22 @@ package engine.object;
import engine.math.Vector3f;
import static org.lwjgl.glfw.GLFW.glfwGetTime;
public class Hitbox extends ObjectGl{
/**
* Create a rectangle shape, use setTextureWrap to correctly align the texture with the model
*
* @param z depth of your model the larger it is the more it will be "close" to the camera
* @param w height of the rectangle
* @param h width of the rectangle
* @param size scaling factor of the rectangle, the model could not show up because this value is too small or too large, a good compromise is between 2 and 15
* @param color set to null if you don't want a Color on your model
*/
public Hitbox(float z, float w, float h, float size, Vector3f color) {
super(z, w, h, size, null, color);
this.setShader("shaders/ObjectGlColor/vert.glsl", "shaders/StylishShaders/HitboxFrag.glsl");
}
protected void uniformInjection(){
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
this.shader.setUniformMat4f("projection", projection);
this.shader.setUniformMat4f("view", view);
this.shader.setUniformMat4f("transform", this.transform);
}
}

View File

@ -4,7 +4,7 @@ public class Active_HitBox extends HitBox {
public Active_HitBox() {
super();
}
public Active_HitBox(float posX, float posY, float sizeX, float sizeY) {
public Active_HitBox(float posX, float posY, float sizeX, float sizeY) {
super(posX, posY, sizeX, sizeY);
}
}

View File

@ -99,7 +99,7 @@ public class HitBox {
}
public void reverseHorizontally() {
this.position_x = 0 - position_x;
this.size_x = 0 - this.size_x;
this.position_x = 138*4 - position_x; //Il faut la largeur de la sprite
this.size_x = -this.size_x;
}
}

View File

@ -4,7 +4,7 @@ public class Passive_HitBox extends HitBox {
public Passive_HitBox() {
super();
}
public Passive_HitBox(float posX, float posY, float sizeX, float sizeY) {
public Passive_HitBox(float posX, float posY, float sizeX, float sizeY) {
super(posX, posY, sizeX, sizeY);
}
}

View File

@ -5,7 +5,7 @@ public class Push_HitBox extends HitBox {
public Push_HitBox() {
super();
}
public Push_HitBox(float posX, float posY, float sizeX, float sizeY) {
public Push_HitBox(float posX, float posY, float sizeX, float sizeY) {
super(posX, posY, sizeX, sizeY);
}
}