This commit is contained in:
Makussu 2024-06-10 13:55:53 +02:00
parent 08d256e0cd
commit e2be0077d5
9 changed files with 55 additions and 16 deletions

View File

@ -10,10 +10,10 @@
*** DONE Zombies random spawn
*** TODO reales level
vllt https://limezu.itch.io/modernexteriors
** TODO Persistierung des Spielstandes (abspeichern)
** DONE Persistierung des Spielstandes (abspeichern)
*** DONE only 1 save or pick save
only one save
*** TODO dont show full intro when save exists
*** DONE dont show full intro when save exists
* Dokumentation
** TODO Kurze Präsentation (10 min) im letzten Labortermin (eine pro Gruppe)
** DONE JavaDoc-Dokumentation
@ -21,3 +21,8 @@ only one save
* Spaß
** level system
** Save points
** Zombies follow
** Something to do with levels
** Minimap of some sort
** Better start screen

View File

@ -9,9 +9,8 @@ public class Character implements Drawable {
int color;
boolean collidable;
Position pos;
int experience = 0;
int level = 1;
float damage_mult = (float) (1 + level * 0.4);
int textsize = 20;
Character (Fenster window, String type) {

View File

@ -112,11 +112,10 @@ public class Fenster extends PApplet {
gameScreen.draw();
fightScreen.draw();
deathScreen.draw();
popMatrix();
ui.draw();
deathScreen.draw();
if (gametitel) {
fill(color(49, 54, 63), gametitel_gamma);
rect(0, 0, 800, 800);

View File

@ -1,4 +1,7 @@
public abstract class Fightable extends Character {
int experience = 0;
int level = 1;
float damage_mult = (float) (1 + level * 0.4);
public Fightable(Fenster window) {
super(window);

View File

@ -9,8 +9,10 @@ import java.util.List;
*/
public class Player extends Fightable implements Health {
int health;
int maxHealth = 20;
List<Skill> skills = new ArrayList<Skill>();
Skill skill = new Tritt(window, this);
@ -46,4 +48,17 @@ public class Player extends Fightable implements Health {
health = maxHealth;
}
}
private void level_sync() {
level = experience/100;
}
public void draw() {
if (window.gameScreen.active()) {
pos.sync_grid();
}
level_sync();
window.fill(color);
window.textSize(textsize);
window.text(type, pos.get().x, pos.get().y);
}
}

View File

@ -3,8 +3,8 @@
*/
public class Skill {
Fenster window;
Character user;
Character target;
Fightable user;
Fightable target;
static int power = 5;
int numPoints = 10;

View File

@ -5,12 +5,19 @@ import processing.core.PApplet;
*/
public class Talkable extends Character implements Interactable{
Bubble bubble;
boolean healme = false;
Talkable (Fenster window, String type, int color, boolean collidable, Bubble bubble) {
super(window, type, color, collidable);
this.bubble = bubble;
}
Talkable (Fenster window, String type, int color, boolean collidable, Bubble bubble, boolean healme) {
super(window, type, color, collidable);
this.bubble = bubble;
this.healme = healme;
}
Talkable(Talkable another) {
super(another);
}
@ -21,8 +28,10 @@ public class Talkable extends Character implements Interactable{
public void interact() {
if(!this.bubble.toggle()) {
window.player.heal(20);
window.healEffect.play();
if (healme) {
window.player.heal(20);
window.healEffect.play();
}
}
}

View File

@ -11,6 +11,7 @@ public class Tiles implements Drawable {
Cell[][] tileMap;
float tilewidth;
Talkable old_dude;
Talkable item;
Random rand = new Random();
@ -31,7 +32,8 @@ public class Tiles implements Drawable {
}
void settings() {
old_dude = new Talkable(window, "T", window.color(20,20,200), true, new Bubble(window, Arrays.asList("Hey Junge!", "Was machst du hier unten?", "Lass mich dich heilen...")));
old_dude = new Talkable(window, "T", window.color(20,20,200), true, new Bubble(window, Arrays.asList("Hey Junge!", "Was machst du hier unten?", "Lass mich dich heilen...")), true);
item = new Talkable(window, "?", window.color(20,20,200), true, new Bubble(window, Arrays.asList("You found an item", "There is probably nothing", "you can do with it right now...")));
tileMap = new Cell[100][100];
for(int i = 0; i < tileMap.length; i++) {
@ -63,6 +65,8 @@ public class Tiles implements Drawable {
tileMap[30][30].character = old_dude;
tileMap[10][10].character = new Enemy(window);
tileMap[rand.nextInt(50)][rand.nextInt(50)].character = item;
}
/**

View File

@ -12,8 +12,12 @@ public class UI {
}
private void bottomBar(float x, float y) {
window.textSize(20);
window.fill(255);
window.rectMode(window.CENTER);
window.rect(x, 775, 300, 50);
exp(window.player.experience, window.player.level, x, 780);
healthBar(x, 760, window.player.health, window.player.maxHealth);
}
public void healthBar(float x, float y, int health, int maxHealth) {
@ -26,13 +30,14 @@ public class UI {
window.rect(x - barlength/2, y, healthLength, 5);
}
public void exp(int exp) {
window.text(exp, 50, 100);
public void exp(int exp, int level, float x, float y) {
window.fill(0);
window.text("exp " + exp + " level " + level, x, y);
}
public void draw() {
bottomBar(400, 700);
healthBar(50, 50, window.player.health, window.player.maxHealth);
exp(window.player.experience);
}
}