changed entity nextframesbuffer to a simpler ArrayList
This commit is contained in:
parent
5e7e0e2f89
commit
2e67c94d40
@ -14,7 +14,7 @@ public class Entity {
|
|||||||
private int posx;
|
private int posx;
|
||||||
private int posy;
|
private int posy;
|
||||||
|
|
||||||
private nextFrameBuffer frames;
|
private ArrayList<Frame> frames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base constructor of the entity class
|
* base constructor of the entity class
|
||||||
@ -22,7 +22,7 @@ public class Entity {
|
|||||||
public Entity() {
|
public Entity() {
|
||||||
this.posx = 0;
|
this.posx = 0;
|
||||||
this.posy = 0;
|
this.posy = 0;
|
||||||
this.frames = new nextFrameBuffer();
|
this.frames = new ArrayList<Frame>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,8 +34,8 @@ public class Entity {
|
|||||||
public Entity(int posx, int posy, Frame f) {
|
public Entity(int posx, int posy, Frame f) {
|
||||||
this.posx = posx;
|
this.posx = posx;
|
||||||
this.posy = posy;
|
this.posy = posy;
|
||||||
this.frames = new nextFrameBuffer();
|
this.frames = new ArrayList<>();
|
||||||
this.frames.setCurrentFrame(f);
|
this.frames.add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPos(int x, int y) {
|
public void setPos(int x, int y) {
|
||||||
@ -44,28 +44,30 @@ public class Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentFrame(Frame f) {
|
public void setCurrentFrame(Frame f) {
|
||||||
this.frames.setCurrentFrame(f);
|
this.frames.set(0,f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPosX() {return this.posx;}
|
public int getPosX() {return this.posx;}
|
||||||
|
|
||||||
public int getPosY() {return this.posy;}
|
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<Frame> getFrames() {
|
||||||
return this.frames;
|
return this.frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrames(nextFrameBuffer nextFrames) {
|
public void setFrames(ArrayList<Frame> nextFrames) {
|
||||||
this.frames = nextFrames;
|
this.frames = nextFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearNextFrames() {
|
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.
|
* adds frames to the character queue.
|
||||||
@ -74,7 +76,7 @@ public class Entity {
|
|||||||
*/
|
*/
|
||||||
public void addNextFrames(Frame[] f) {
|
public void addNextFrames(Frame[] f) {
|
||||||
for(int i = 0; i < f.length; i++) {
|
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<Frame> f) {
|
public void addNextFramesList(ArrayList<Frame> f) {
|
||||||
for(int i = 0; i < f.size(); i++) {
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -514,14 +514,19 @@ public class match {
|
|||||||
|| (!atk.isSpecial() && c.getCurrentframe().isNormalCancellable()));
|
|| (!atk.isSpecial() && c.getCurrentframe().isNormalCancellable()));
|
||||||
if(attackIsPossible) {
|
if(attackIsPossible) {
|
||||||
if(c.getStatus() == Status.JUMPING) {
|
if(c.getStatus() == Status.JUMPING) {
|
||||||
nextFrameBuffer nJumpFb = new nextFrameBuffer();
|
c.clearNextFrames();
|
||||||
nJumpFb.clone(c.getFrames());
|
for(int i = 0; (i < c.getFrames().size() - 1) || (i < atk.getFrame().size()); i++) {
|
||||||
nJumpFb.changeFramesExceptForMove(atk.getFrame());
|
Frame jumpf = c.getFrames().get(i+1);
|
||||||
c.setFrames(nJumpFb);
|
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;
|
actionSet = true;
|
||||||
}
|
}
|
||||||
atkCount++;
|
atkCount++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user