Added handling of jump arc during jump attacks.
This commit is contained in:
parent
2edf441b95
commit
7dd455740f
@ -225,4 +225,22 @@ public class Frame {
|
||||
public int[] getSprite() {
|
||||
return sprite;
|
||||
}
|
||||
|
||||
/**
|
||||
* This becomes a clone of a given frame, except for the movement data.
|
||||
* Usueful for jump attack
|
||||
* @param f the frame to clone
|
||||
*/
|
||||
public void cloneWithoutMovement(Frame f) {
|
||||
this.cloneArray(f); //Il faut cloner individuellement chaque hitbox des differentes listes pour ne pas garder les pointeurs
|
||||
Push_HitBox phb = f.getPushHitBox();
|
||||
this.setPushHitBox(new Push_HitBox(phb.getPosX(), phb.getPosY(), phb.getSize_x(), phb.getSize_y()));
|
||||
this.normalCancellable = f.isNormalCancellable();
|
||||
this.specialCancellable = f.isSpecialCancellable();
|
||||
this.jumpCancellable = f.jumpCancellable;
|
||||
this.moveCancellable = f.isMoveCancellable();
|
||||
this.isDashCancellable = f.isDashCancellable;
|
||||
this.lastFrameOfHit = f.islastFrameOfHit();
|
||||
this.setSpriteWrap(f.sprite[0], f.sprite[1], f.sprite[2], f.sprite[3]);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package gameplay.frames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This will handle the next frames to be played by each entity.
|
||||
* @author Victor Azra
|
||||
@ -76,4 +78,25 @@ public class nextFrameBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the same amount of frames from f in this, as the amount originally present, but keepsoriginal move data
|
||||
* @param f frames array to copy
|
||||
*/
|
||||
public void changeFramesExceptForMove(ArrayList<Frame> f) {
|
||||
int i = 0;
|
||||
boolean goOn = true;
|
||||
nextFrameBuffer fb = new nextFrameBuffer();
|
||||
fb.clone(this);
|
||||
this.emptyQueue();
|
||||
try{fb.goToNext();} catch(IndexOutOfBoundsException e) {goOn = false;}
|
||||
while(goOn && i < f.size()) {
|
||||
try{
|
||||
fb.current.cloneWithoutMovement(f.get(i));
|
||||
this.addFrameToQueue(fb.current);
|
||||
fb.goToNext();
|
||||
i++;
|
||||
} catch(IndexOutOfBoundsException e) { goOn = false;}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import gameplay.actions.Throw;
|
||||
import gameplay.actions.ThrowPart;
|
||||
import gameplay.entities.Status;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.frames.nextFrameBuffer;
|
||||
import gameplay.hitboxes.*;
|
||||
import gameplay.input.InputBuffer;
|
||||
import gameplay.entities.Character;
|
||||
@ -464,6 +465,12 @@ public class match {
|
||||
&& ((atk.isSpecial() && c.getCurrentframe().isSpecialCancellable())
|
||||
|| (!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();
|
||||
c.addNextFramesList(atk.getFrame());
|
||||
c.setAttackPartsArray(atk.getParts());
|
||||
|
Loading…
x
Reference in New Issue
Block a user