master
GammelJAN 6 years ago
parent f92f90aa20
commit 313c258614

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@ -313,7 +313,7 @@ public class DungeonGenerator {
Entity temp;
int id = (int) (Math.random() * 14);
int id = (int) (Math.random() * 16);
switch(id){
case 0:
temp = new Archer(xPos, yPos, lvl);
@ -363,6 +363,12 @@ public class DungeonGenerator {
case 13:
temp = new Darkwizard(xPos, yPos, lvl);
break;
case 14:
temp = new Darkswordsman(xPos, yPos, lvl);
break;
case 15:
temp = new Darkarcher(xPos, yPos, lvl);
break;
default:
temp = null;
}

@ -16,7 +16,7 @@ public abstract class Item {
protected int lvl;
protected int id;
protected int extraHp;
protected int movementBoost;
protected float movementBoost;
public Item(int lvl){
this.lvl = lvl;
@ -41,7 +41,7 @@ public abstract class Item {
public int getExtraHp(){
return this.extraHp;
}
public int getMovementBoost(){
public float getMovementBoost(){
return this.movementBoost;
}
/**

@ -0,0 +1,99 @@
package com.dungeoncrawler.model.entities;
import com.dungeoncrawler.StaticMath;
import com.dungeoncrawler.model.Entity;
public class Darkarcher extends Entity{
int counter;
final int minRange;
final int maxRange;
final int attackSpeed;
public Darkarcher(float xPos, float yPos, int lvl) {
super(xPos, yPos, lvl);
this.maxhp = 100*lvl;
this.hp = this.maxhp;
this.direction = 1;
this.dmg = 7*lvl;
this.id = 27;
this.type = 1;
minRange = 80;
maxRange = 240;
attackSpeed = 100;
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) (4 * Math.cos(alpha));
movementY = (int) (4 * 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, 28, 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;
}
}

@ -0,0 +1,39 @@
package com.dungeoncrawler.model.entities;
import com.dungeoncrawler.StaticMath;
import com.dungeoncrawler.model.Entity;
public class Darkswordsman extends Entity {
public Darkswordsman(float xPos, float yPos, int lvl) {
super(xPos, yPos, lvl);
this.maxhp = 120*lvl;
this.hp = this.maxhp;
this.direction = 1;
this.dmg = 12*lvl;
this.id = 26;
this.type = 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);
movementX = (int) (4 * Math.cos(alpha));
movementY = (int) (4 * Math.sin(alpha));
xPos += movementX;
yPos += movementY;
updateDirection();
}
return false;
}
}

@ -20,8 +20,8 @@ public class Player extends Entity {
int skin;
String gender;
int standartMovementSpeed;
int movementSpeed;
float standartMovementSpeed;
float movementSpeed;
public Player() {
super(200, 200, 1);
@ -70,6 +70,9 @@ public class Player extends Entity {
this.def = this.standartDef;
this.maxhp = this.standartMaxHp;
this.movementSpeed = this.standartMovementSpeed;
if(hp > maxhp){
hp = maxhp;
}
if(inv.getItem(0) != null && inv.getItem(1) == null){
this.dmg = this.standartDmg + inv.getItem(0).getDmg();
@ -100,7 +103,7 @@ public class Player extends Entity {
// nix lol weil key
break;
case 1:
if(hp == maxhp){
if(hp >= maxhp){
}
else{
@ -174,7 +177,7 @@ public class Player extends Entity {
public boolean inventoryFull(){
return inv.inventoryFull();
}
public int getMovementSpeed(){
public float getMovementSpeed(){
return movementSpeed;
}

@ -16,7 +16,7 @@ public class DmgAmulet extends Item {
public DmgAmulet(int lvl) {
super(lvl);
this.dmg = 8 * lvl;
this.movementBoost = 1;
this.movementBoost = 0.5f;
this.id = 3;
}

@ -404,6 +404,18 @@ public class GameScreen {
tx[0] = new Texture("sprites/spell/darkspell.png");
entitySprites[i] = new EntitySprite(tx, 16, 16);
break;
case 26:
tx[0] = new Texture("sprites/swordsman/darkswordsman_"+gender+".png");
entitySprites[i] = new EntitySprite(tx, 64, 64);
break;
case 27:
tx[0] = new Texture("sprites/archer/darkarcher_"+gender+".png");
entitySprites[i] = new EntitySprite(tx, 64, 64);
break;
case 28:
tx[0] = new Texture("sprites/projectile/darkarrow.png");
entitySprites[i] = new EntitySprite(tx, 24, 5);
break;
}
entitySprites[i].update((int) e.getxPos() + 32, (int) e.getyPos() + 32);

@ -128,6 +128,9 @@ public class HudContainer {
if(n > 1){
n = 1;
}
if(n <= 0){
n = 0.01f;
}
Texture playerHealthTexture = new Texture("sprites/playerHealthBar.png");
int newWidth = (int) (n * playerHealthTexture.getWidth());
TextureRegion[][] playerHealthRegion = TextureRegion.split(playerHealthTexture,newWidth, playerHealthTexture.getHeight());
@ -166,11 +169,11 @@ public class HudContainer {
break;
case 2:
selectedName = "Amulet ";
perk = "Damage: ";
selectedPerkValue = items[selected].getDmg();
perk = "Defense: ";
selectedPerkValue = items[selected].getDef();
break;
case 3:
selectedName = "Damage-Amulet ";
selectedName = "Amulet ";
perk = "Damage: ";
selectedPerkValue = items[selected].getDmg();
break;

Loading…
Cancel
Save