parent
c464608dbc
commit
1deb26474a
@ -0,0 +1,8 @@
|
|||||||
|
package com.trs.main;
|
||||||
|
|
||||||
|
public class Enemy extends FightObject{
|
||||||
|
|
||||||
|
public Enemy(AnimatedSprite sprite, Stats stats, int id) {
|
||||||
|
super(sprite, stats, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.trs.main;
|
||||||
|
|
||||||
|
public abstract class FightObject {
|
||||||
|
protected AnimatedSprite sprite;
|
||||||
|
protected Stats stats;
|
||||||
|
protected int id;
|
||||||
|
|
||||||
|
public FightObject(AnimatedSprite sprite, Stats stats, int id) {
|
||||||
|
this.sprite = sprite;
|
||||||
|
this.stats = stats;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.trs.main;
|
||||||
|
|
||||||
|
public class FightPlayer extends FightObject{
|
||||||
|
|
||||||
|
public FightPlayer(AnimatedSprite sprite, Stats stats, int id) {
|
||||||
|
super(sprite, stats, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.trs.main;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
|
public class FightScreen {
|
||||||
|
|
||||||
|
Batch batch;
|
||||||
|
FightObject[] objects;
|
||||||
|
Rectangle[] collisionRects;
|
||||||
|
|
||||||
|
// 0: player turn, 1: enemy turn, 2: fight ends
|
||||||
|
int state = 0;
|
||||||
|
|
||||||
|
public FightScreen(Batch batch, FightObject[] objects, Rectangle[] collisionRects) {
|
||||||
|
this.batch = batch;
|
||||||
|
this.objects = objects;
|
||||||
|
this.collisionRects = collisionRects;
|
||||||
|
|
||||||
|
for(int j = 0; j < objects.length-1; j++){
|
||||||
|
for(int i = objects.length-1; i >= 0; i--){
|
||||||
|
if(i > 0 && objects[i].stats.getInit() > objects[i-1].stats.getInit()){
|
||||||
|
FightObject temp = objects[i-1];
|
||||||
|
objects[i-1] = objects[i];
|
||||||
|
objects[i] = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void act(float deltatime) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
batch.begin();
|
||||||
|
|
||||||
|
for(FightObject object : objects) {
|
||||||
|
object.sprite.draw(batch);
|
||||||
|
}
|
||||||
|
|
||||||
|
batch.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.trs.main;
|
||||||
|
|
||||||
|
public class Stats {
|
||||||
|
private int level;
|
||||||
|
private int hp;
|
||||||
|
private int def;
|
||||||
|
private int atk;
|
||||||
|
private int init;
|
||||||
|
|
||||||
|
public Stats() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHp() {
|
||||||
|
return hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHp(int hp) {
|
||||||
|
this.hp = hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDef() {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDef(int def) {
|
||||||
|
this.def = def;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAtk() {
|
||||||
|
return atk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAtk(int atk) {
|
||||||
|
this.atk = atk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInit() {
|
||||||
|
return init;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInit(int init) {
|
||||||
|
this.init = init;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue