This commit is contained in:
no 2021-05-27 15:29:51 +02:00
commit 6ac7b22a02
3 changed files with 58 additions and 9 deletions

View File

@ -1,4 +1,7 @@
package Frames;
import java.util.ArrayList;
import Hitboxes.*;
/**
* Main class for frames
* @author Victor Azra
@ -6,9 +9,47 @@ package Frames;
*/
public class Frame {
//TODO: to implement
private Double move_y;
private Double move_x;
private ArrayList<Passive_HitBox> passHitBox;
private ArrayList<Active_HitBox> actHitBox;
private ArrayList<Passive_throw_HitBox> passThrowHitBox;
private ArrayList<Active_throw_Hitbox> actThrowHitBox;
private Push_HitBox pushHitBox;
public Frame() {
//TODO : to implement
this.move_y = 0.0;
this.move_x = 0.0;
this.passHitBox = new ArrayList<Passive_HitBox>();
this.actHitBox = new ArrayList<Active_HitBox>();
this.passThrowHitBox = new ArrayList<Passive_throw_HitBox>();
this.actThrowHitBox = new ArrayList<Active_throw_Hitbox>();
this.pushHitBox = new Push_HitBox();
}
public Frame(Double move_y, Double move_x, ArrayList<Passive_HitBox> passHitBox, ArrayList<Active_HitBox> actHitBox,
ArrayList<Passive_throw_HitBox> passThrowHitBox, ArrayList<Active_throw_Hitbox> actThrowHitBox,
Push_HitBox pushHitBox) {
this.move_y = move_y;
this.move_x = move_x;
this.passHitBox = passHitBox;
this.actHitBox = actHitBox;
this.passThrowHitBox = passThrowHitBox;
this.actThrowHitBox = actThrowHitBox;
this.pushHitBox = pushHitBox;
}
/*
* Mainly use for projectiles
*/
public Frame(Double move_y, Double move_x, ArrayList<Passive_HitBox> passHitBox, ArrayList<Active_HitBox> actHitBox) {
this.move_y = move_y;
this.move_x = move_x;
this.passHitBox = passHitBox;
this.actHitBox = actHitBox;
this.passThrowHitBox = new ArrayList<Passive_throw_HitBox>();
this.actThrowHitBox = new ArrayList<Active_throw_Hitbox>();
this.pushHitBox = new Push_HitBox();
}
}

View File

@ -22,7 +22,7 @@ public class HitBox {
this.position_y = position_y;
}
public HitBox(double position_x, double position_y, double size_x, double size_y) {
public HitBox(Double position_x, Double position_y, Double size_x, Double size_y) {
if(position_x < 0.0) {
position_x = 0.0;
@ -70,12 +70,12 @@ public class HitBox {
/*
* HitBox overlap horizontally
*/
if(this.position_x <= hb.position_x) { //this is at left of hb
if(hb.position_x <= horizontal1) {
if(this.position_x < hb.position_x) { //this is at left of hb
if(hb.position_x < horizontal1) {
horiz = true;
}
}else {//this is at left of hb
if(this.position_x <= horizontal2) {
if(this.position_x < horizontal2) {
horiz = true;
}
}
@ -83,12 +83,12 @@ public class HitBox {
/*
* HitBox overlap vertically
*/
if(this.position_y <= hb.position_y) { //this is at top of hb
if(hb.position_y <= vertical1) {
if(this.position_y < hb.position_y) { //this is at top of hb
if(hb.position_y < vertical1) {
ver = true;
}
}else {//this is at left of hb
if(this.position_x <= vertical2) {
if(this.position_x < vertical2) {
ver = true;
}
}

View File

@ -1,5 +1,13 @@
package Hitboxes;
public class Push_HitBox extends HitBox {
public Push_HitBox() {
super();
}
public Push_HitBox(Double position_x, Double position_y, Double size_x, Double size_y) {
super(position_x, position_y, size_x, size_y);
}
}