bug weg - eZ

master
GammelJan 6 years ago
parent 84dd02d0bf
commit d7b3c537f8

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 49 KiB

@ -391,7 +391,6 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
roomPosY += 1;
d.getPlayer().setxPos((roomX / 2)* 48);
d.getPlayer().setyPos(48);
d.getPlayer().updateStats(level);
gs.startLoadingScreen();
}
@ -430,6 +429,8 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
d.getPlayer().deleteKey();
d.getPlayer().updateStats(level + 1);
gs.startLoadingScreen();
level++;
@ -512,10 +513,18 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(e[i].getHp() - p.getDmg() <= 0){
e[i].setHp(0);
e[i].setToDelete(true);
System.out.println("TOTTOTTOT");
}
else{
System.out.println(e[i].getHp());
System.out.println("-");
System.out.println(p.getDmg());
System.out.println("=");
System.out.println(e[i].getHp() - p.getDmg());
e[i].setHp(e[i].getHp() - p.getDmg());
System.out.println("HIT");
}
}
}

@ -308,7 +308,7 @@ public class DungeonGenerator {
Entity temp;
int id = (int) (Math.random() * 3);
int id = (int) (Math.random() * 4);
switch(id){
case 0:
temp = new Archer(xPos, yPos, lvl);
@ -322,6 +322,10 @@ public class DungeonGenerator {
temp = new Wizard(xPos, yPos, lvl);
break;
case 3:
temp = new Firewizard(xPos, yPos, lvl);
break;
default:
temp = null;
}

@ -37,6 +37,7 @@ public abstract class Entity {
return true;
}
else{
e.setHp(e.getHp() - this.dmg);
return false;
}

@ -0,0 +1,100 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.dungeoncrawler.model.entities;
import com.dungeoncrawler.StaticMath;
import com.dungeoncrawler.model.Entity;
/**
*
* @author jonathan
*/
public class Firewizard extends Entity{
int counter;
public Firewizard(float xPos, float yPos, int lvl) {
super(xPos, yPos, lvl);
this.maxhp = 80*lvl;
this.hp = this.maxhp;
this.direction = 1;
this.dmg = 25*lvl;
this.id = 6;
this.type = 1;
counter = 0;
// TODO: Sinnvolle Werte finden
direction = 1;
}
@Override
public boolean move(int xPosPlayer, int yPosPlayer) {
if(!isToDelete()){
double alpha = StaticMath.calculateAngle((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer);
int distance = (int) StaticMath.calculateDistance((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer, alpha);
if(distance >= 104 && distance <= 184 && counter % 40 == 0){
return true;
}
else{
movementX = (int) (3 * Math.cos(alpha));
movementY = (int) (3 * Math.sin(alpha));
if(distance < 124){
movementX *= -1;
movementY *= -1;
}
else if(distance >= 124 && distance <= 164){
movementX = 0;
movementY = 0;
}
xPos += movementX;
yPos += movementY;
}
if(alpha >= Math.PI / -2 && alpha <= Math.PI / 2){
setDirection(1);
}
else{
setDirection(0);
}
counter++;
}
return false;
}
@Override
public Entity shoot(int xPosPlayer, int yPosPlayer){
Projectile a = null;
if(!isToDelete()){
double alpha = StaticMath.calculateAngle((int) this.xPos, (int) this.yPos, xPosPlayer, yPosPlayer);
a = new Projectile(this.xPos + 32, this.yPos + 32, this.lvl,(int) this.dmg, 7, true);
int tempX = (int) (6 * Math.cos(alpha));
int tempY = (int) (6 * Math.sin(alpha));
a.setMovementX(tempX);
a.setMovementY(tempY);
a.setAngle(alpha);
if((alpha >= 0 && alpha <= Math.PI / 2) || (alpha <= 2 * Math.PI && alpha >= 2 * Math.PI - Math.PI / 2)){
setDirection(1);
}
else{
setDirection(0);
}
}
return a;
}
}

@ -288,6 +288,15 @@ public class GameScreen {
tx[0] = new Texture("sprites/laser.png");
entitySprites[i] = new EntitySprite(tx, 36, 15);
break;
case 6:
tx[0] = new Texture("sprites/firewizard.png");
entitySprites[i] = new EntitySprite(tx, 64, 64);
break;
case 7:
tx[0] = new Texture("sprites/firespell.png");
entitySprites[i] = new EntitySprite(tx, 16, 16);
}
entitySprites[i].update((int) e.getxPos() + 32, (int) e.getyPos() + 32);

Loading…
Cancel
Save