change dsome things inmatch, added the start of amain function.

This commit is contained in:
no 2021-06-01 21:02:11 +02:00
parent f4b7d5752d
commit 2fd3dc61d9
4 changed files with 134 additions and 1 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/bin/
/.idea/
/.project
/jeu-de-combat.iml

View File

@ -14,5 +14,9 @@ public class Attack {
* {{DOWN},{DOWN,RIGHT},{RIGHT},{A}}
*/
private static Button[][] command;
/**
* The different sections of the attack
*/
private attackPart[] parts;
}

View File

@ -0,0 +1,114 @@
package gameplay.actions;
import gameplay.frames.Frame;
/**
* This class represent one section (generally one isolated hit) of an attack.
*/
public class attackPart {
private int damage, chipDamage, hitstun, blockstun;
private double knockbackOnHit, knockbackOnBlock;
private Frame[] frames;
private boolean hasHit;
/**
* Constructor with most parameters for an attack part, generally a hit
* @param damage the damage dealt to the enemy if the attack part connects
* @param chipDamage the damage dealt to the enemy if the attack part is blocked
* @param hitstun the amount of frames where the enemy is in hitstun if the attack part connects
* @param blockstun the amount of frames where the enemy is in blockstun if the attack part is blocked
* @param knockbackOnHit the distance the enemy gets moved back if hit
* @param knockbackOnBlock the distance the enemy gets moved back if blocked
* @param frames the array of frames for the part
*/
public attackPart(int damage, int chipDamage, int hitstun, int blockstun, double knockbackOnHit, double knockbackOnBlock, Frame[] frames) {
this.damage = damage;
this.chipDamage = chipDamage;
this.hitstun = hitstun;
this.blockstun = blockstun;
this.knockbackOnHit = knockbackOnHit;
this.knockbackOnHit = knockbackOnBlock;
this.frames = frames;
this.hasHit = false;
}
/**
* Constructor for an attack part with only a frames array as parameter.
* Generally for a move startup or recovery.
* @param frames the array of frames for the part
*/
public attackPart(Frame[] frames) {
this.frames = frames;
this.damage = 0;
this.chipDamage = 0;
this.hitstun = 0;
this.blockstun = 0;
this.knockbackOnHit = 0.0;
this.knockbackOnBlock = 0.0;
this.hasHit = false;
}
public boolean hasHit() {
return hasHit;
}
public void setHasHit(boolean hasHit) {
this.hasHit = hasHit;
}
public int getDamage() {
return this.damage;
}
public void setDamage(int damage) {
this.damage = damage;
}
public int getChipDamage() {
return this.chipDamage;
}
public void setChipDamage(int chipDamage) {
this.chipDamage = chipDamage;
}
public int getHitstun() {
return hitstun;
}
public void setHitstun(int hitstun) {
this.hitstun = hitstun;
}
public int getBlockstun() {
return blockstun;
}
public void setBlockstun(int blockstun) {
this.blockstun = blockstun;
}
public double getKnockbackOnHit() {
return knockbackOnHit;
}
public void setKnockbackOnHit(double knockback) {
this.knockbackOnHit = knockback;
}
public Frame[] getFrames() {
return frames;
}
public void setFrames(Frame[] frames) {
this.frames = frames;
}
public double getKnockbackOnBlock() {
return knockbackOnBlock;
}
public void setKnockbackOnBlock(double knockbackOnBlock) {
this.knockbackOnBlock = knockbackOnBlock;
}
}

View File

@ -3,6 +3,7 @@ package gameplay.match;
import gameplay.input.InputBuffer;
import gameplay.entities.*;
import gameplay.entities.Character;
import engine.Engine;
/**
* Main class that describes the base structure of the match, with characters, timer and such
@ -37,6 +38,19 @@ public class match {
this.roundsWonP1 = 0;
this.roundsWonP2 = 0;
}
/**
* Main function of a match. Contains the main gameplay loop.
* @param args arguments
*/
public static void main(String args[]) {
Character p1 = new Character(); //TODO : change to not a blank
Character p2 = new Character(); //TODO : same as above
match match = new match(p1,p2);
}
}