diff --git a/GamePlay/Frames/Frame.java b/GamePlay/Frames/Frame.java index 4808daf..177603d 100644 --- a/GamePlay/Frames/Frame.java +++ b/GamePlay/Frames/Frame.java @@ -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 passHitBox; + private ArrayList actHitBox; + private ArrayList passThrowHitBox; + private ArrayList actThrowHitBox; + private Push_HitBox pushHitBox; public Frame() { - //TODO : to implement + this.move_y = 0.0; + this.move_x = 0.0; + this.passHitBox = new ArrayList(); + this.actHitBox = new ArrayList(); + this.passThrowHitBox = new ArrayList(); + this.actThrowHitBox = new ArrayList(); + this.pushHitBox = new Push_HitBox(); } + + public Frame(Double move_y, Double move_x, ArrayList passHitBox, ArrayList actHitBox, + ArrayList passThrowHitBox, ArrayList 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 passHitBox, ArrayList actHitBox) { + this.move_y = move_y; + this.move_x = move_x; + this.passHitBox = passHitBox; + this.actHitBox = actHitBox; + this.passThrowHitBox = new ArrayList(); + this.actThrowHitBox = new ArrayList(); + this.pushHitBox = new Push_HitBox(); + } + } diff --git a/GamePlay/Hitboxes/HitBox.java b/GamePlay/Hitboxes/HitBox.java index 3971c62..ae2e01f 100644 --- a/GamePlay/Hitboxes/HitBox.java +++ b/GamePlay/Hitboxes/HitBox.java @@ -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; } } diff --git a/GamePlay/Hitboxes/Push_HitBox.java b/GamePlay/Hitboxes/Push_HitBox.java index 1fab532..28d05b8 100644 --- a/GamePlay/Hitboxes/Push_HitBox.java +++ b/GamePlay/Hitboxes/Push_HitBox.java @@ -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); + } }