GammelJAN 6 years ago
parent 9743c78f2d
commit fbd4ed68cf

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

@ -65,11 +65,13 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
int playerSkin;
boolean checkDoor;
boolean checkDie;
@Override
public void create(){
checkDoor = false;
checkDoor = true;
checkDie = true;
playerSkin = 0;
isPaused = false;
@ -325,10 +327,10 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
// Render methode zum rendern der einzelnen Sprites wird aufgerufen
if(gs != null){
gs.render(batch, d.getPlayer(), d.getCurrentEntities(), tileX, tileY, level, roomPosX, roomPosY);
hc.updateHud(batch, d.getPlayer());
d.getPlayer().updateItems();
if(gs != null){;
d.getPlayer().updateItems();
gs.render(batch, d.getPlayer(), d.getCurrentEntities(), tileX, tileY, level, roomPosX, roomPosY);
hc.updateHud(batch, d.getPlayer());
}
}
@ -418,6 +420,11 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
}
}
if(d.getPlayer().getHp() <= 0 && checkDie){
gs.stop();
create(); //TODO
}
d.getPlayer().updateDirection();
}
@ -492,9 +499,8 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
roomPosY = roomAmount / 2;
}
else{ // Dungeon Exit
es = new EndScreen();
gs.stop();
entityMovement.stop();
create();
return;
}
@ -513,9 +519,6 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
}
}
public void attack(Entity attacker, Entity[] e){
}
public ArrayList<ItemContainer> playerPickUp(){

@ -309,7 +309,7 @@ public class DungeonGenerator {
Entity temp;
int id = (int) (Math.random() * 7);
int id = (int) (Math.random() * 8);
switch(id){
case 0:
temp = new Archer(xPos, yPos, lvl);
@ -332,6 +332,9 @@ public class DungeonGenerator {
case 6:
temp = new Icearcher(xPos, yPos, lvl);
break;
case 7:
temp = new Firearcher(xPos, yPos, lvl);
break;
default:
temp = null;
}

@ -32,8 +32,8 @@ public abstract class Entity {
}
public boolean attack(Entity e){
if(e.getHp() - this.dmg <= 1){
e.setHp(1);
if(e.getHp() - this.dmg <= 0){
e.setHp(0);
return true;
}
else{

@ -0,0 +1,99 @@
package com.dungeoncrawler.model.entities;
import com.dungeoncrawler.StaticMath;
import com.dungeoncrawler.model.Entity;
public class Firearcher extends Entity{
int counter;
final int minRange;
final int maxRange;
final int attackSpeed;
public Firearcher(float xPos, float yPos, int lvl) {
super(xPos, yPos, lvl);
this.maxhp = 85*lvl;
this.hp = this.maxhp;
this.direction = 1;
this.dmg = 9*lvl;
this.id = 13;
this.type = 1;
minRange = 84;
maxRange = 184;
attackSpeed = 40;
counter = 0;
// TODO: Sinnvolle Werte finden
direction = 2;
}
@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 >= minRange && distance <= maxRange && counter % attackSpeed == 0){
return true;
}
else{
movementX = (int) (3 * Math.cos(alpha));
movementY = (int) (3 * Math.sin(alpha));
if(distance < minRange){
movementX *= -1;
movementY *= -1;
}
else if(distance >= minRange && distance <= maxRange){
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, 14, 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;
}
}

@ -381,6 +381,14 @@ public class GameScreen {
tx[0] = new Texture("sprites/icearrow.png");
entitySprites[i] = new EntitySprite(tx, 24, 5);
break;
case 13:
tx[0] = new Texture("sprites/firearcher.png");
entitySprites[i] = new EntitySprite(tx, 64, 64);
break;
case 14:
tx[0] = new Texture("sprites/firearrow.png");
entitySprites[i] = new EntitySprite(tx, 24, 5);
break;
}
entitySprites[i].update((int) e.getxPos() + 32, (int) e.getyPos() + 32);
@ -425,6 +433,7 @@ public class GameScreen {
public void cleanUp(){
music.dispose();
animations.clear();
}
public void startLoadingScreen(){
@ -459,6 +468,7 @@ public class GameScreen {
}
public void stop(){
cleanUp();
animations.stop();
animatePlayer.stop();
camera.zoom = 1600;

Loading…
Cancel
Save