Corrected classpath, new (and clearer) package arrangement.
This commit is contained in:
57
src/gameplay/frames/Frame.java
Normal file
57
src/gameplay/frames/Frame.java
Normal file
@ -0,0 +1,57 @@
|
||||
package gameplay.frames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import gameplay.hitboxes.*;
|
||||
|
||||
/**
|
||||
* Main class for frames
|
||||
* @author Victor Azra
|
||||
*
|
||||
*/
|
||||
public class Frame {
|
||||
|
||||
private Double move_y;
|
||||
private Double move_x;
|
||||
private ArrayList<Passive_HitBox> passHitBox;
|
||||
private ArrayList<Active_HitBox> actHitBox;
|
||||
private ArrayList<Passive_throw_HitBox> passThrowHitBox;
|
||||
private ArrayList<Active_throw_Hitbox> actThrowHitBox;
|
||||
private Push_HitBox pushHitBox;
|
||||
|
||||
public Frame() {
|
||||
this.move_y = 0.0;
|
||||
this.move_x = 0.0;
|
||||
this.passHitBox = new ArrayList<Passive_HitBox>();
|
||||
this.actHitBox = new ArrayList<Active_HitBox>();
|
||||
this.passThrowHitBox = new ArrayList<Passive_throw_HitBox>();
|
||||
this.actThrowHitBox = new ArrayList<Active_throw_Hitbox>();
|
||||
this.pushHitBox = new Push_HitBox();
|
||||
}
|
||||
|
||||
public Frame(Double move_y, Double move_x, ArrayList<Passive_HitBox> passHitBox, ArrayList<Active_HitBox> actHitBox,
|
||||
ArrayList<Passive_throw_HitBox> passThrowHitBox, ArrayList<Active_throw_Hitbox> 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<Passive_HitBox> passHitBox, ArrayList<Active_HitBox> actHitBox) {
|
||||
this.move_y = move_y;
|
||||
this.move_x = move_x;
|
||||
this.passHitBox = passHitBox;
|
||||
this.actHitBox = actHitBox;
|
||||
this.passThrowHitBox = new ArrayList<Passive_throw_HitBox>();
|
||||
this.actThrowHitBox = new ArrayList<Active_throw_Hitbox>();
|
||||
this.pushHitBox = new Push_HitBox();
|
||||
}
|
||||
|
||||
}
|
70
src/gameplay/frames/nextFrameBuffer.java
Normal file
70
src/gameplay/frames/nextFrameBuffer.java
Normal file
@ -0,0 +1,70 @@
|
||||
package gameplay.frames;
|
||||
|
||||
/**
|
||||
* This will handle the next frames to be played by each entity.
|
||||
* @author Victor Azra
|
||||
*/
|
||||
public class nextFrameBuffer {
|
||||
|
||||
private Frame current;
|
||||
private nextFrameBuffer next;
|
||||
|
||||
/**
|
||||
* creates a new framebuffer, empty for now
|
||||
*/
|
||||
public nextFrameBuffer() {
|
||||
this.current = null;
|
||||
this.next = null;
|
||||
}
|
||||
|
||||
public void setCurrentFrame(Frame f) {
|
||||
this.current = f;
|
||||
}
|
||||
|
||||
public void clone(nextFrameBuffer f) {
|
||||
this.current = f.current;
|
||||
this.next = f.next;
|
||||
}
|
||||
|
||||
public void setNext(nextFrameBuffer f) {
|
||||
this.next.clone(f);
|
||||
}
|
||||
|
||||
public void emptyQueue() {
|
||||
this.next = null;
|
||||
}
|
||||
|
||||
public void empty() {
|
||||
this.current = null;
|
||||
this.next = null;
|
||||
}
|
||||
|
||||
public void goToNext() {
|
||||
this.current = this.next.current;
|
||||
this.next = this.next.next;
|
||||
}
|
||||
|
||||
public Frame getCurrentFrame() {
|
||||
return this.current;
|
||||
}
|
||||
|
||||
public Frame getNextframe() {
|
||||
return this.next.current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a frame at the end of the buffer
|
||||
* @param f the frame to add at the end
|
||||
*/
|
||||
public void addFrameToQueue(Frame f) {
|
||||
if(this.current == null) {
|
||||
this.current = f;
|
||||
} else if(this.next == null){
|
||||
nextFrameBuffer fb = new nextFrameBuffer();
|
||||
fb.current = f;
|
||||
this.next = fb;
|
||||
} else {
|
||||
this.next.addFrameToQueue(f);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user