before pos refactor
This commit is contained in:
parent
1d9e03af7a
commit
8e1f740c95
13
src/AuraBubble.java
Normal file
13
src/AuraBubble.java
Normal file
@ -0,0 +1,13 @@
|
||||
public class AuraBubble {
|
||||
Fenster window;
|
||||
float x, y;
|
||||
public AuraBubble(Fenster window, float x, float y) {
|
||||
this.window = window;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
window.circle(x, y, 50);
|
||||
}
|
||||
}
|
||||
70
src/AuraFight.java
Normal file
70
src/AuraFight.java
Normal file
@ -0,0 +1,70 @@
|
||||
public class AuraFight extends Bubble{
|
||||
Player player;
|
||||
Enemy enemy;
|
||||
|
||||
float player_x = 200;
|
||||
float player_y = 500;
|
||||
|
||||
float enemy_x = 600;
|
||||
float enemy_y = 300;
|
||||
|
||||
boolean pos_set = false;
|
||||
|
||||
Skill running_move;
|
||||
|
||||
AuraFight(Fenster window, Player player, Enemy enemy) {
|
||||
super(window);
|
||||
System.out.println(player);
|
||||
this.player = player;
|
||||
this.enemy = enemy;
|
||||
this.opened = true;
|
||||
}
|
||||
|
||||
void drawPlayer() {
|
||||
if (!pos_set) {
|
||||
player.real_x = player_x;
|
||||
player.real_y = player_y;
|
||||
pos_set = true;
|
||||
}
|
||||
player.textsize = 150;
|
||||
player.draw(0, 0);
|
||||
|
||||
window.ui.healthBar(player_x, player_y-100, player.health, player.maxHealth);
|
||||
}
|
||||
|
||||
void drawEnemy() {
|
||||
window.textSize(150);
|
||||
window.fill(enemy.color);
|
||||
window.text(enemy.type, enemy_x, enemy_y);
|
||||
|
||||
window.ui.healthBar(enemy_x, enemy_y-100, enemy.health, enemy.maxHealth);
|
||||
}
|
||||
|
||||
public void attack() {
|
||||
running_move = player.skill;
|
||||
running_move.use(enemy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void draw() {
|
||||
if (opened) {
|
||||
window.fill(255);
|
||||
window.rectMode(window.CENTER);
|
||||
window.rect(window.width/2, window.height/2, 700, 500);
|
||||
drawPlayer();
|
||||
drawEnemy();
|
||||
window.fill(0);
|
||||
}
|
||||
if (running_move != null) {
|
||||
//System.out.println("move is running");
|
||||
running_move.draw();
|
||||
}
|
||||
if (enemy.health <= 0 && opened) {
|
||||
window.inFight = false;
|
||||
window.inGame = true;
|
||||
player.experience += 20;
|
||||
opened = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,9 @@ public class Character implements Drawable {
|
||||
boolean collidable;
|
||||
float x, y;
|
||||
float real_x, real_y;
|
||||
int experience = 0;
|
||||
int level = 1;
|
||||
float damage_mult = (float) (1 + level * 0.4);
|
||||
int textsize = 20;
|
||||
|
||||
Character (Fenster window, String type) {
|
||||
|
||||
@ -33,7 +33,7 @@ public class Fight extends Bubble {
|
||||
player.textsize = 150;
|
||||
player.draw(0, 0);
|
||||
|
||||
window.ui.healthBar(player_x, player_y-60, player.health, player.maxHealth);
|
||||
window.ui.healthBar(player_x, player_y-100, player.health, player.maxHealth);
|
||||
}
|
||||
|
||||
void drawEnemy() {
|
||||
@ -41,11 +41,10 @@ public class Fight extends Bubble {
|
||||
window.fill(enemy.color);
|
||||
window.text(enemy.type, enemy_x, enemy_y);
|
||||
|
||||
window.ui.healthBar(enemy_x, enemy_y-60, enemy.health, enemy.maxHealth);
|
||||
window.ui.healthBar(enemy_x, enemy_y-100, enemy.health, enemy.maxHealth);
|
||||
}
|
||||
|
||||
public void attack() {
|
||||
|
||||
running_move = player.skill;
|
||||
running_move.use(enemy);
|
||||
}
|
||||
@ -53,7 +52,6 @@ public class Fight extends Bubble {
|
||||
|
||||
|
||||
public void draw() {
|
||||
|
||||
if (opened) {
|
||||
window.fill(255);
|
||||
window.rectMode(window.CENTER);
|
||||
@ -66,9 +64,11 @@ public class Fight extends Bubble {
|
||||
//System.out.println("move is running");
|
||||
running_move.draw();
|
||||
}
|
||||
if (enemy.health <= 0) {
|
||||
if (enemy.health <= 0 && opened) {
|
||||
window.inFight = false;
|
||||
window.inGame = true;
|
||||
player.experience += 20;
|
||||
opened = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ public class Player extends Fightable implements Health {
|
||||
int x, y;
|
||||
int health;
|
||||
int maxHealth = 20;
|
||||
|
||||
List<Skill> skills = new ArrayList<Skill>();
|
||||
Skill skill = new Tritt(window, this);
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ public class Tritt extends Skill {
|
||||
}
|
||||
public void use(Fightable target){
|
||||
System.out.println("using tritt");
|
||||
target.damage(power);
|
||||
target.damage((int) (power * user.damage_mult));
|
||||
this.target = target;
|
||||
animate();
|
||||
};
|
||||
|
||||
11
src/UI.java
11
src/UI.java
@ -2,9 +2,9 @@ import processing.core.PApplet;
|
||||
import processing.core.PShape;
|
||||
|
||||
public class UI {
|
||||
PApplet window;
|
||||
Fenster window;
|
||||
|
||||
UI(PApplet window) {
|
||||
UI(Fenster window) {
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
@ -23,8 +23,13 @@ public class UI {
|
||||
window.rect(x - barlength/2, y, healthLength, 5);
|
||||
}
|
||||
|
||||
public void exp(int exp) {
|
||||
window.text(exp, 50, 100);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
bottomBar(400, 700);
|
||||
|
||||
healthBar(50, 50, window.player.health, window.player.maxHealth);
|
||||
exp(window.player.experience);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user