parent
034ce9f712
commit
9f1170c959
@ -0,0 +1,57 @@
|
||||
package THE_VOID;
|
||||
|
||||
/*
|
||||
if(xPlayer == xPos){ //PLAYER auf X-Achse von Archer
|
||||
if(yPlayer == yPos){} // //PLAYER pos = Archer pos
|
||||
else if(yPlayer > yPos){movementY = 1f;} // //PLAYER ueber Archer
|
||||
else if(yPlayer < yPos){movementY = -1f;} // //PLAYER unter Archer
|
||||
} //
|
||||
else if(yPlayer == yPos){ //PLAYER auf Y-Achse von Archer
|
||||
if(xPlayer == xPos){} // //PLAYER pos = Archer pos
|
||||
else if(xPlayer > xPos){movementX = 1f;} // //PLAYER rechts von Archer
|
||||
else if(xPlayer < xPos){movementX = -1f;} // //PLAYER links von Archer
|
||||
} //
|
||||
else if(xPlayer > xPos){ //PLAYER rechts von Archer
|
||||
if(yPlayer > yPos){ // //PLAYER ist im Quadrant I
|
||||
if((yPlayer - yPos) > (xPlayer - xPos)){ // // //Weg zu PLAYER x kuerzer als zu PLAYER y
|
||||
movementX = 1f; // // //
|
||||
} // // //
|
||||
else{ // // //Weg zu PLAYER y kuerzer als zu PLAYER x
|
||||
movementY = 1f; // //
|
||||
} // //
|
||||
} // //
|
||||
else if(yPlayer < yPos){ // //PLAYER ist im Quadrant II
|
||||
if((yPos - yPlayer) > (xPlayer - xPos)){ // //Weg zu PLAYER x kuerzer als zu PLAYER y
|
||||
movementX = 1f; // //
|
||||
} // //
|
||||
else{ // //Weg zu PLAYER y kuerzer als zu PLAYER y
|
||||
movementY = -1f; //
|
||||
} //
|
||||
} //
|
||||
} //
|
||||
else if(xPlayer < xPos){ //PLAYER links von Archer
|
||||
if(yPlayer < yPos){ // //PLAYER ist im Quadrant III
|
||||
if((yPlayer - yPos) > (xPlayer - xPos)){ // // //Weg zu PLAYER x kuerzer als zu PLAYER y
|
||||
movementX = -1f; // // //
|
||||
} // // //
|
||||
else{ // // //Weg zu PLAYER y kuerzer als zu PLAYER x
|
||||
movementY = -1f; // //
|
||||
} // //
|
||||
} // //
|
||||
else if(yPlayer > yPos){ // //PLAYER ist im Quadrant IV
|
||||
if((yPlayer - yPos) > (xPos - xPlayer)){ // //Weg zu PLAYER x kuerzer als zu PLAYER y
|
||||
movementX = -1; // //
|
||||
} // //
|
||||
else{ // //Weg zu PLAYER y kuerzer als zu PLAYER x
|
||||
movementY = 1; //
|
||||
} ////////////
|
||||
}
|
||||
}
|
||||
|
||||
if(yPos + movementY < 0){
|
||||
|
||||
}
|
||||
else if(xPos + movementX < 0){
|
||||
|
||||
}*/
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.model.Entity;
|
||||
import com.badlogic.gdx.utils.Timer;
|
||||
|
||||
|
||||
public class Arrow extends Entity{
|
||||
Timer toben;
|
||||
Timer tunten;
|
||||
Timer trechts;
|
||||
Timer tlinks;
|
||||
float xStart;
|
||||
float yStart;
|
||||
int direction;
|
||||
|
||||
public Arrow(float xPos, float yPos, int lvl, int direction){
|
||||
super(xPos, yPos, lvl);
|
||||
xStart = xPos;
|
||||
yStart = yPos;
|
||||
Timer toben = new Timer();
|
||||
Timer tunten = new Timer();
|
||||
Timer trechts = new Timer();
|
||||
Timer tlinks = new Timer();
|
||||
this.direction = direction;
|
||||
this.dmg = 3*lvl;
|
||||
this.id = 2;
|
||||
|
||||
toben.scheduleTask(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
setyPos(getyPos() + 3f);
|
||||
}
|
||||
},0,0.1f);
|
||||
toben.stop();
|
||||
tunten.scheduleTask(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
setyPos(getyPos() - 3f);
|
||||
}
|
||||
},0,0.1f);
|
||||
tunten.stop();
|
||||
trechts.scheduleTask(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
setxPos(getxPos() + 3f);
|
||||
}
|
||||
},0,0.1f);
|
||||
trechts.stop();
|
||||
tlinks.scheduleTask(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
setyPos(getxPos() - 3f);
|
||||
}
|
||||
},0,0.1f);
|
||||
tlinks.stop();
|
||||
switch(direction){
|
||||
case 0:
|
||||
toben.start();
|
||||
break;
|
||||
case 1:
|
||||
trechts.start();
|
||||
break;
|
||||
case 2:
|
||||
tunten.start();
|
||||
break;
|
||||
case 3:
|
||||
tlinks.start();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public float getxStart(){
|
||||
return xStart;
|
||||
}
|
||||
public float getyStart(){
|
||||
return yStart;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue