|
|
|
|
@ -117,8 +117,15 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
if(gs != null){
|
|
|
|
|
|
|
|
|
|
if(gs.player.getAttackState() == 2){
|
|
|
|
|
/*if(d.getPlayer().isToDelete() && checkDie){
|
|
|
|
|
if(gs.player.getDie() == 0){
|
|
|
|
|
gs.player.setDie(1);
|
|
|
|
|
}
|
|
|
|
|
else if(gs.player.getDie() == 2){
|
|
|
|
|
// Ist Tot
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else*/ if(gs.player.getAttackState() == 2){
|
|
|
|
|
playerAttack(d.getCurrentEntities(), d.getPlayer(), d.getPlayer().getDirection());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -136,7 +143,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
int y = (int) temp.getyPos();
|
|
|
|
|
|
|
|
|
|
boolean attacks = d.getCurrentEntities()[i].move((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos());
|
|
|
|
|
|
|
|
|
|
if(d.getPlayer().isToDelete()){
|
|
|
|
|
attacks = false;
|
|
|
|
|
}
|
|
|
|
|
// Attacke wird gestartet, wenn noch keine laueft
|
|
|
|
|
if(attacks && gs.entitySprites[i].getAttackState() == 0){
|
|
|
|
|
gs.entitySprites[i].startAttack();
|
|
|
|
|
@ -156,7 +165,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
d.getCurrentEntities()[i].attack(d.getPlayer());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(d.getCurrentEntities()[i].getType() == 0){
|
|
|
|
|
if(d.getCurrentEntities()[i].getType() == 0 && !d.getPlayer().isToDelete()){
|
|
|
|
|
switch(gs.entitySprites[i].getAttackState()){
|
|
|
|
|
case 0:
|
|
|
|
|
gs.entitySprites[i].startAttack();
|
|
|
|
|
@ -437,8 +446,16 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(d.getPlayer().getHp() <= 0 && checkDie){
|
|
|
|
|
gs.stop();
|
|
|
|
|
create(); //TODO
|
|
|
|
|
//gs.stop();
|
|
|
|
|
//create(); //TODO
|
|
|
|
|
d.getPlayer().setHp(1);
|
|
|
|
|
if(gs.player.getDie() == 0){
|
|
|
|
|
gs.player.setDie(1);
|
|
|
|
|
d.getPlayer().setToDelete(true);
|
|
|
|
|
}
|
|
|
|
|
else if(gs.player.getDie() == 2){
|
|
|
|
|
// Ist Tot
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
d.getPlayer().updateDirection();
|
|
|
|
|
@ -610,7 +627,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
if(keycode == Input.Keys.A){
|
|
|
|
|
if(mm != null){
|
|
|
|
|
}
|
|
|
|
|
if(gs != null){
|
|
|
|
|
if(gs != null && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.getPlayer().setMovementX(-3f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -618,7 +635,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
if(keycode == Input.Keys.D){
|
|
|
|
|
if(mm != null){
|
|
|
|
|
}
|
|
|
|
|
if(gs != null){
|
|
|
|
|
if(gs != null && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.getPlayer().setMovementX(+3f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -626,7 +643,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
if(keycode == Input.Keys.S){
|
|
|
|
|
if(mm != null){
|
|
|
|
|
}
|
|
|
|
|
if(gs != null){
|
|
|
|
|
if(gs != null && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.getPlayer().setMovementY(-3f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -634,14 +651,14 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
if(keycode == Input.Keys.W){
|
|
|
|
|
if(mm != null){
|
|
|
|
|
}
|
|
|
|
|
if(gs != null){
|
|
|
|
|
if(gs != null && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.getPlayer().setMovementY(3f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.SPACE){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.setCurrentEntities(playerAttack(d.getCurrentEntities(), d.getPlayer(), 0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -650,7 +667,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.F){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
if(!d.getPlayer().inventoryFull()){
|
|
|
|
|
ArrayList<ItemContainer> garbage = playerPickUp();
|
|
|
|
|
|
|
|
|
|
@ -663,7 +680,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.R){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.getPlayer().getInv().equipItem();
|
|
|
|
|
d.getPlayer().updateItems();
|
|
|
|
|
}
|
|
|
|
|
@ -672,7 +689,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.Q){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
if(d.getPlayer().getInv().getItem(d.getPlayer().getInv().getSelected()) != null){
|
|
|
|
|
d.getCurrentRoom().spawnItem((int)d.getPlayer().getxPos(), (int)d.getPlayer().getyPos(), d.getPlayer().getInv().getItem(d.getPlayer().getInv().getSelected()));
|
|
|
|
|
gs.getM().getMaps()[level][roomPosX][roomPosY].addItem(48, 48,(int)d.getPlayer().getxPos(), (int)d.getPlayer().getyPos(), d.getPlayer().getInv().getItem(d.getPlayer().getInv().getSelected()));
|
|
|
|
|
@ -683,7 +700,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.E){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
d.getPlayer().useItem(d.getPlayer().getInv().getSelected());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -699,7 +716,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.LEFT){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() - 1, (int) d.getPlayer().getyPos());
|
|
|
|
|
|
|
|
|
|
for(int k = 5; k < d.getCurrentEntities().length; k++){
|
|
|
|
|
@ -715,7 +732,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
if(keycode == Input.Keys.UP){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() + 1);
|
|
|
|
|
|
|
|
|
|
for(int k = 5; k < d.getCurrentEntities().length; k++){
|
|
|
|
|
@ -730,7 +747,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
}
|
|
|
|
|
if(keycode == Input.Keys.RIGHT){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() + 1, (int) d.getPlayer().getyPos());
|
|
|
|
|
|
|
|
|
|
for(int k = 5; k < d.getCurrentEntities().length; k++){
|
|
|
|
|
@ -745,7 +762,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
}
|
|
|
|
|
if(keycode == Input.Keys.DOWN){
|
|
|
|
|
if(mm != null){}
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false){
|
|
|
|
|
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
|
|
|
|
|
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() - 1);
|
|
|
|
|
|
|
|
|
|
for(int k = 5; k < d.getCurrentEntities().length; k++){
|
|
|
|
|
|