From f0aa2592fdf9a7a4d0b713961f00c88cd9ad9b2f Mon Sep 17 00:00:00 2001 From: keizaal Date: Thu, 27 May 2021 15:49:07 +0200 Subject: [PATCH 1/4] Started implementation of Frame --- GamePlay/Frames/Frame.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/GamePlay/Frames/Frame.java b/GamePlay/Frames/Frame.java index 4808daf..695e923 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,14 @@ 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; public Frame() { - //TODO : to implement + } } From 43146a3aab09268c5579f42201cf5a519d5ea211 Mon Sep 17 00:00:00 2001 From: keizaal Date: Thu, 27 May 2021 15:54:26 +0200 Subject: [PATCH 2/4] Changed hit function to be coherent with the attribut pushHitBox in Frame --- GamePlay/Frames/Frame.java | 1 + GamePlay/Hitboxes/HitBox.java | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GamePlay/Frames/Frame.java b/GamePlay/Frames/Frame.java index 695e923..756f9ea 100644 --- a/GamePlay/Frames/Frame.java +++ b/GamePlay/Frames/Frame.java @@ -15,6 +15,7 @@ public class Frame { private ArrayList actHitBox; private ArrayList passThrowHitBox; private ArrayList actThrowHitBox; + private Push_HitBox pushHitBox; public Frame() { diff --git a/GamePlay/Hitboxes/HitBox.java b/GamePlay/Hitboxes/HitBox.java index 3971c62..d0ac360 100644 --- a/GamePlay/Hitboxes/HitBox.java +++ b/GamePlay/Hitboxes/HitBox.java @@ -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; } } From 8789416057723f90665e8f4ff3b2ee9459f5bdd6 Mon Sep 17 00:00:00 2001 From: keizaal Date: Thu, 27 May 2021 16:22:08 +0200 Subject: [PATCH 3/4] Added constrructors for Frame and Push_HitBox --- GamePlay/Frames/Frame.java | 8 +++++++- GamePlay/Hitboxes/HitBox.java | 2 +- GamePlay/Hitboxes/Push_HitBox.java | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/GamePlay/Frames/Frame.java b/GamePlay/Frames/Frame.java index 756f9ea..b0c1e89 100644 --- a/GamePlay/Frames/Frame.java +++ b/GamePlay/Frames/Frame.java @@ -18,6 +18,12 @@ public class Frame { private Push_HitBox pushHitBox; public Frame() { - + move_y = 0.0; + move_x = 0.0; + passHitBox = new ArrayList(); + actHitBox = new ArrayList(); + passThrowHitBox = new ArrayList(); + actThrowHitBox = new ArrayList(); + pushHitBox = new Push_HitBox(); } } diff --git a/GamePlay/Hitboxes/HitBox.java b/GamePlay/Hitboxes/HitBox.java index d0ac360..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; 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); + } } From c9b788887b247d9cd1ad04b4a9ff308fb306246e Mon Sep 17 00:00:00 2001 From: keizaal Date: Thu, 27 May 2021 16:22:25 +0200 Subject: [PATCH 4/4] update Frame --- GamePlay/Frames/Frame.java | 40 +++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/GamePlay/Frames/Frame.java b/GamePlay/Frames/Frame.java index b0c1e89..177603d 100644 --- a/GamePlay/Frames/Frame.java +++ b/GamePlay/Frames/Frame.java @@ -18,12 +18,38 @@ public class Frame { private Push_HitBox pushHitBox; public Frame() { - move_y = 0.0; - move_x = 0.0; - passHitBox = new ArrayList(); - actHitBox = new ArrayList(); - passThrowHitBox = new ArrayList(); - actThrowHitBox = new ArrayList(); - pushHitBox = new Push_HitBox(); + 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(); + } + }