|
|
|
@ -103,7 +103,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
if(m != null){
|
|
|
|
if(m != null){
|
|
|
|
m.updateEntitySprite(d.getCurrentEntities());
|
|
|
|
//m.updateEntitySprite(d.getCurrentEntities());
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < d.getCurrentEntities().length; i++){
|
|
|
|
for(int i = 0; i < d.getCurrentEntities().length; i++){
|
|
|
|
if(d.getCurrentEntities()[i] != null){
|
|
|
|
if(d.getCurrentEntities()[i] != null){
|
|
|
|
@ -116,14 +116,19 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
int x = (int) temp.getxPos();
|
|
|
|
int x = (int) temp.getxPos();
|
|
|
|
int y = (int) temp.getyPos();
|
|
|
|
int y = (int) temp.getyPos();
|
|
|
|
|
|
|
|
|
|
|
|
Entity test = d.getCurrentEntities()[i].move((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos());
|
|
|
|
Entity arrow = d.getCurrentEntities()[i].move((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos());
|
|
|
|
Sprite tempObject = m.entitySprites[i];
|
|
|
|
Sprite tempObject = m.entitySprites[i];
|
|
|
|
tempObject.setPosition(temp.getxPos(), temp.getyPos());
|
|
|
|
tempObject.setPosition(temp.getxPos(), temp.getyPos());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean overlaps = false;
|
|
|
|
boolean overlaps = false;
|
|
|
|
|
|
|
|
boolean delete = false;
|
|
|
|
if(Intersector.overlaps(tempObject.getBoundingRectangle(), playerSprite)){
|
|
|
|
if(Intersector.overlaps(tempObject.getBoundingRectangle(), playerSprite)){
|
|
|
|
overlaps = true;
|
|
|
|
overlaps = true;
|
|
|
|
|
|
|
|
if(d.getCurrentEntities()[i].getId() == 2){
|
|
|
|
|
|
|
|
d.getCurrentEntities()[i].attack(d.getPlayer());
|
|
|
|
|
|
|
|
delete = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
for(RectangleMapObject rectangleObject : mapObjects.getByType(RectangleMapObject.class)){
|
|
|
|
for(RectangleMapObject rectangleObject : mapObjects.getByType(RectangleMapObject.class)){
|
|
|
|
@ -131,6 +136,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
|
|
if(Intersector.overlaps(tempObject.getBoundingRectangle(), rectangle)){
|
|
|
|
if(Intersector.overlaps(tempObject.getBoundingRectangle(), rectangle)){
|
|
|
|
overlaps = true;
|
|
|
|
overlaps = true;
|
|
|
|
|
|
|
|
delete = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -159,17 +165,24 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
|
|
|
|
|
|
|
|
|
|
|
|
m.entitySprites[i] = tempObject;
|
|
|
|
m.entitySprites[i] = tempObject;
|
|
|
|
|
|
|
|
|
|
|
|
if(test != null){
|
|
|
|
if(arrow != null){
|
|
|
|
for(int k = 5; k < d.getCurrentEntities().length; k++){
|
|
|
|
for(int k = 5; k < d.getCurrentEntities().length; k++){
|
|
|
|
if(d.getCurrentEntities()[k] == null){
|
|
|
|
if(d.getCurrentEntities()[k] == null){
|
|
|
|
d.getCurrentEntities()[k] = test;
|
|
|
|
d.getCurrentEntities()[k] = arrow;
|
|
|
|
m.updateEntitySprite(d.getCurrentEntities());
|
|
|
|
m.updateEntitySprite(d.getCurrentEntities());
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(delete && d.getCurrentEntities()[i].getId() == 2){
|
|
|
|
|
|
|
|
d.getCurrentEntities()[i] = null;
|
|
|
|
|
|
|
|
m.updateEntitySprite(d.getCurrentEntities());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},0, 0.03f);
|
|
|
|
},0, 0.03f);
|
|
|
|
|
|
|
|
|
|
|
|
|