diff --git a/src/gameplay/entities/Entity.java b/src/gameplay/entities/Entity.java index 743e9b6..e8260dd 100644 --- a/src/gameplay/entities/Entity.java +++ b/src/gameplay/entities/Entity.java @@ -14,7 +14,7 @@ public class Entity { private int posx; private int posy; - private nextFrameBuffer frames; + private ArrayList frames; /** * base constructor of the entity class @@ -22,7 +22,7 @@ public class Entity { public Entity() { this.posx = 0; this.posy = 0; - this.frames = new nextFrameBuffer(); + this.frames = new ArrayList(); } /** @@ -34,8 +34,8 @@ public class Entity { public Entity(int posx, int posy, Frame f) { this.posx = posx; this.posy = posy; - this.frames = new nextFrameBuffer(); - this.frames.setCurrentFrame(f); + this.frames = new ArrayList<>(); + this.frames.add(f); } public void setPos(int x, int y) { @@ -44,28 +44,30 @@ public class Entity { } public void setCurrentFrame(Frame f) { - this.frames.setCurrentFrame(f); + this.frames.set(0,f); } public int getPosX() {return this.posx;} public int getPosY() {return this.posy;} - public Frame getCurrentframe() {return this.frames.getCurrentFrame();} + public Frame getCurrentframe() {return this.frames.get(0);} - public nextFrameBuffer getFrames() { + public ArrayList getFrames() { return this.frames; } - public void setFrames(nextFrameBuffer nextFrames) { + public void setFrames(ArrayList nextFrames) { this.frames = nextFrames; } public void clearNextFrames() { - this.frames.emptyQueue(); + Frame f = this.getCurrentframe(); + this.frames.clear(); + this.frames.add(f); } - public void goToNextFrames() { this.frames.goToNext();} + public void goToNextFrames() { this.frames.remove(0);} /** * adds frames to the character queue. @@ -74,7 +76,7 @@ public class Entity { */ public void addNextFrames(Frame[] f) { for(int i = 0; i < f.length; i++) { - this.frames.addFrameToQueue(f[i]); + this.frames.add(f[i]); } } @@ -85,9 +87,17 @@ public class Entity { */ public void addNextFramesList(ArrayList f) { for(int i = 0; i < f.size(); i++) { - this.frames.addFrameToQueue(f.get(i)); + this.frames.add(f.get(i)); } } + /** + * Adds a single Frame to the character's list of next frames + * @param f the frame to add at the end of the frames list + */ + public void addSingleFrame(Frame f) { + this.frames.add(f); + } + } diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index cd4a951..35601e3 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -514,14 +514,19 @@ public class match { || (!atk.isSpecial() && c.getCurrentframe().isNormalCancellable())); if(attackIsPossible) { if(c.getStatus() == Status.JUMPING) { - nextFrameBuffer nJumpFb = new nextFrameBuffer(); - nJumpFb.clone(c.getFrames()); - nJumpFb.changeFramesExceptForMove(atk.getFrame()); - c.setFrames(nJumpFb); + c.clearNextFrames(); + for(int i = 0; (i < c.getFrames().size() - 1) || (i < atk.getFrame().size()); i++) { + Frame jumpf = c.getFrames().get(i+1); + jumpf.cloneWithoutMovement(atk.getFrame().get(i)); + c.addSingleFrame(jumpf); + } + c.setAttackPartsArray(atk.getParts()); + } + else { + c.clearNextFrames(); + c.addNextFramesList(atk.getFrame()); + c.setAttackPartsArray(atk.getParts()); } - c.clearNextFrames(); - c.addNextFramesList(atk.getFrame()); - c.setAttackPartsArray(atk.getParts()); actionSet = true; } atkCount++;