Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Display.class
Binary file not shown.
337 changes: 204 additions & 133 deletions Display.java

Large diffs are not rendered by default.

Binary file modified Driver.class
Binary file not shown.
90 changes: 46 additions & 44 deletions Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,51 @@
import sun.audio.*;
public class Driver
{
public static void main(String[] args)
{
playMusicInALoop("CoolBeats/Spectre.wav");
JFrame frame = new JFrame("Yeet Fighter");
frame.setSize(965, 640);
frame.setLocation(200,100);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Display disp = new Display();
frame.add(disp);
frame.setVisible(true);

Platform plat = new Platform(550);
Fighter fighters[] = new Fighter[2];
while(disp.getMode() == 0)
{}

fighters = disp.loadGame(plat);

int fps = 60;
double timePerTick = 1000000000 / fps;
double delta = 0;
long now;
long lastTime = System.nanoTime();



while (fighters[0].getHealth() > 0 && fighters[1].getHealth() > 0)
{
now = System.nanoTime();
delta += (now - lastTime) / timePerTick;
lastTime = now;

if(delta >= 1){
boolean ins[][] = disp.getInputs();
fighters = disp.update(fighters,plat,ins);
disp.draw(fighters);
delta--;
}
}
disp.endGame(fighters);
}
public static void playMusic(String filename){
public static void main(String[] args)
{
playMusicInALoop("CoolBeats/Spectre.wav");
JFrame frame = new JFrame("Yeet Fighter");
frame.setSize(965, 640);
frame.setLocation(200,100);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Display disp = new Display();
frame.add(disp);
frame.setVisible(true);

Fighter f1;
Fighter f2;
Platform plat = new Platform(550);
Fighter fighters[] = new Fighter[2];
int m = 0;
while(disp.getMode() == 0)
{}
fighters = disp.loadGame(plat);

int fps = 60;
double timePerTick = 1000000000 / fps;
double delta = 0;
long now;
long lastTime = System.nanoTime();



while (fighters[0].getHealth() > 0 && fighters[1].getHealth() > 0)
{
now = System.nanoTime();
delta += (now - lastTime) / timePerTick;
lastTime = now;

if(delta >= 1){
boolean ins[][] = disp.getInputs();
fighters = disp.update(fighters,plat,ins);
disp.draw(fighters);
delta--;
}
}
disp.endGame(fighters);
}
public static void playMusic(String filename){
InputStream music;
try{
System.out.println("Playing Audio Once");
Expand All @@ -71,5 +73,5 @@ public static void playMusicInALoop(String filename){
System.out.println(e);
playMusic(filename);
}
}
}
}
Binary file modified Fighter$AirDirection.class
Binary file not shown.
Binary file modified Fighter$AirDown.class
Binary file not shown.
Binary file modified Fighter$AirNeutral.class
Binary file not shown.
Binary file modified Fighter$Attack.class
Binary file not shown.
Binary file modified Fighter$BasicDirection.class
Binary file not shown.
Binary file modified Fighter$BasicNeutral.class
Binary file not shown.
Binary file modified Fighter$BasicUp.class
Binary file not shown.
Binary file modified Fighter.class
Binary file not shown.
87 changes: 37 additions & 50 deletions Fighter.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class Fighter
boolean right = false;
int attacking = 0;
int attackT = 0;
boolean blocking;
int blocking = 0;
int blockT = 0;
Fighter.Attack attack;


Expand Down Expand Up @@ -84,14 +85,17 @@ public int getAttacking()
{
return this.attacking;
}
public boolean getBlocking()

public void setBlocking(int a)
{
return this.blocking;
this.blocking = a;
}
public void setBlocking(boolean r)

public int getBlocking()
{
this.blocking = r;
return this.blocking;
}

public void setRight(boolean r)
{
this.right = r;
Expand All @@ -112,6 +116,16 @@ public int getAttackT()
return this.attackT;
}

public void setBlockT(int a)
{
this.blockT = a;
}

public int getBlockT()
{
return this.blockT;
}




Expand All @@ -121,6 +135,7 @@ public int getAttackT()

public abstract class Attack
{

double[] pos = new double[2];
int[] size = new int[2];
double damage;
Expand All @@ -130,7 +145,6 @@ public abstract class Attack

public double[] getKnockBack()
{

return this.knockback;
}

Expand Down Expand Up @@ -190,7 +204,7 @@ public class AirDirection extends Attack
setSize(120,10);
setDamage(50);
setKnockBack(120,-10);
setTime(30);
setTime(20);
}
}
public class AirDown extends Attack
Expand All @@ -208,66 +222,39 @@ public class AirNeutral extends Attack
AirNeutral(){
setPos(20,20);
setSize(50,50);
setDamage(100);
setDamage(110);
setKnockBack(40,-10);
setTime(25);
}
}
public class BasicDirection extends Attack
{
BasicDirection(){

if (blocking) {
setPos(10,10);
setSize(150,10);
setDamage(10);
setKnockBack(15,-10);
setTime(20);
} else {
setPos(10,10);
setSize(150,10);
setDamage(40);
setKnockBack(40,-10);
setTime(20);
}
setPos(10,10);
setSize(150,10);
setDamage(40);
setKnockBack(40,-10);
setTime(20);
}
}
public class BasicNeutral extends Attack
{
BasicNeutral(){
if (blocking) {
setPos(10,10);
setSize(70,30);
setDamage(50);
setKnockBack(30,-30);
setTime(30);
} else {
setPos(10,10);
setSize(70,30);
setDamage(150);
setKnockBack(60,-60);
setTime(30);
}

setPos(10,10);
setSize(70,30);
setDamage(150);
setKnockBack(60,-60);
setTime(30);
}
}
public class BasicUp extends Attack
{
BasicUp(){
if (blocking) {
setPos(20,-10);
setSize(10,20);
setDamage(50);
setKnockBack(0,-70);
setTime(50);
} else {
setPos(20,-10);
setSize(10,20);
setDamage(200);
setKnockBack(0,-200);
setTime(50);
}

setPos(20,-10);
setSize(10,10);
setDamage(200);
setKnockBack(4,-200);
setTime(50);
}
}
}
Binary file modified Platform.class
Binary file not shown.