spell added

master
Jonathan Hager 6 years ago
parent e630982b95
commit ea29bee208

@ -88,7 +88,7 @@ public class Archer extends Entity{
@Override
public Entity shoot(int xPosPlayer, int yPosPlayer){
Arrow a = null;
Projectile a = null;
if(!isToDelete()){
float deltaX = xPosPlayer - (int) xPos;
@ -114,7 +114,7 @@ public class Archer extends Entity{
alpha = 2*Math.PI - alpha;
}
}
a = new Arrow(this.xPos + 32, this.yPos + 32, this.lvl, 0);
a = new Projectile(this.xPos + 32, this.yPos + 32, this.lvl, 2);
movementX = (int) (6 * Math.cos(alpha));
movementY = (int) (6 * Math.sin(alpha));

@ -8,19 +8,18 @@ package com.dungeoncrawler.model.entities;
import com.dungeoncrawler.model.Entity;
public class Arrow extends Entity{
public class Projectile extends Entity{
float xStart;
float yStart;
int direction;
int lifetime;
public Arrow(float xPos, float yPos, int lvl, int direction){
public Projectile(float xPos, float yPos, int lvl, int id){
super(xPos, yPos, lvl);
xStart = xPos;
yStart = yPos;
this.direction = direction;
this.dmg = 3*lvl;
this.id = 2;
this.id = id;
type = 2;
this.lifetime = 0;
}

@ -96,7 +96,7 @@ public class Wizard extends Entity{
@Override
public Entity shoot(int xPosPlayer, int yPosPlayer){
Arrow a = null;
Projectile a = null;
if(!isToDelete()){
float deltaX = xPosPlayer - (int) xPos;
@ -122,7 +122,7 @@ public class Wizard extends Entity{
alpha = 2*Math.PI - alpha;
}
}
a = new Arrow(this.xPos + 32, this.yPos + 32, this.lvl, 0);
a = new Projectile(this.xPos + 32, this.yPos + 32, this.lvl, 4);
movementX = (int) (6 * Math.cos(alpha));
movementY = (int) (6 * Math.sin(alpha));

@ -271,11 +271,16 @@ public class GameScreen {
tx[0] = new Texture("sprites/wizard.png");
entitySprites[i] = new EntitySprite(tx, 64, 64);
break;
case 4:
tx[0] = new Texture("sprites/spell.png");
entitySprites[i] = new EntitySprite(tx, 32, 32);
break;
}
entitySprites[i].update((int) e.getxPos() + 32, (int) e.getyPos() + 32);
if(e.getId() == 2){
if(e.getType() == 2){
entitySprites[i].getSprites()[0].setRotation((float) Math.toDegrees(e.getAngle()));
}

Loading…
Cancel
Save