fix some type problems in HitBox

This commit is contained in:
Rémi Rativel 2021-06-09 18:16:45 +02:00
parent bcc822e093
commit f25769390a

View File

@ -2,10 +2,10 @@ package gameplay.hitboxes;
public class HitBox {
private Double position_x;
private Double position_y;
private Double size_x;
private Double size_y;
private double position_x;
private double position_y;
private double size_x;
private double size_y;
public HitBox() {
this.position_x = 0.0;
@ -22,37 +22,6 @@ public class HitBox {
this.position_y = position_y;
}
public HitBox(Double position_x, Double position_y, Double size_x, Double size_y) {
if(position_x < 0.0) {
position_x = 0.0;
}else if(position_x > 1.0) {
position_x = 1.0;
}
this.position_x = position_x;
if(position_y < 0.0) {
position_y = 0.0;
}else if(position_y > 1.0) {
position_y = 1.0;
}
this.position_y = position_y;
if(size_x < 0.0) {
size_x = 0.0;
}else if(size_x > 1.0) {
size_x = 1.0;
}
this.size_x = size_x;
if(size_y < 0.0) {
size_y = 0.0;
}else if(size_y > 1.0) {
size_y = 1.0;
}
this.size_y = size_y;
}
/*
* @param hb an Hitbox