bestes Game ever - Raytracing incoming

master
GammelJan 6 years ago
parent 163f5e3f2f
commit 8234a4909e

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

@ -309,7 +309,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(keycode == Input.Keys.E){
if(v != null){}
if(m != null){
d.setCurrentEntities(m.playerAttack(d.getCurrentEntities(), d.getPlayer()));
d.setCurrentEntities(m.playerAttack(d.getCurrentEntities(), d.getPlayer(), batch));
}
}

@ -66,19 +66,19 @@ public abstract class Entity {
}
public int direction(){ // returns direction the entity is facing depending on its movement
if(movementX < 0f){ // TIS IS SHIT - NEED REWORK
return 3;
if(movementX == -3f){ // TIS IS SHIT - NEED REWORK
facing = 3;
}
else if(movementX < 3f){
return 1;
else if(movementX == 3f){
facing = 1;
}
else if(movementY > 3f){
return 0;
else if(movementY == 3f){
facing = 0;
}
else if(movementY < -3f){
return 2;
else if(movementY == -3f){
facing = 2;
}
return -1;
return facing;
}

@ -234,15 +234,16 @@ public class GameScreen {
public Entity[] playerAttack(Entity e[], Player p){
public Entity[] playerAttack(Entity e[], Player p, SpriteBatch batch){
if(p.direction() == 0){
Texture verticalAttack = new Texture("sprites/AttackVert.png");
Sprite verticalAttackSprite = new Sprite(verticalAttack);
verticalAttackSprite.setX(p.getxPos()-2f);
verticalAttackSprite.setY(p.getyPos()-2f);
Texture attackTexture = new Texture("sprites/AttackHori.png");
Sprite attackSprite = new Sprite(attackTexture);
attackSprite.setX(p.getxPos() - 8f);
attackSprite.setY(p.getyPos() + 32f);
for(int i = 0; i< e.length ; i++){
if(e[i] != null){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), verticalAttackSprite.getBoundingRectangle())){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), attackSprite.getBoundingRectangle())){
if(e[i] != null){
if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null;
@ -256,13 +257,13 @@ public class GameScreen {
}
}
else if(p.direction() == 1){
Texture horizontalAttack = new Texture("sprites/AttackHori.png");
Sprite horizontalAttackSprite = new Sprite(horizontalAttack);
horizontalAttackSprite.setX(p.getxPos()-2f);
horizontalAttackSprite.setY(p.getyPos()-2f);
Texture attackTexture = new Texture("sprites/AttackVert.png");
Sprite attackSprite = new Sprite(attackTexture);
attackSprite.setX(p.getxPos()+ 32f);
attackSprite.setY(p.getyPos()- 2f);
for(int i = 0; i< e.length ; i++){
if(entitySprites[i] != null){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), horizontalAttackSprite.getBoundingRectangle())){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), attackSprite.getBoundingRectangle())){
if(e[i] != null){
if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null;
@ -276,13 +277,13 @@ public class GameScreen {
}
}
else if(p.direction() == 2){
Texture verticalAttack = new Texture("sprites/AttackVert.png");
Sprite verticalAttackSprite = new Sprite(verticalAttack);
verticalAttackSprite.setX(p.getxPos()-2f);
verticalAttackSprite.setY(p.getyPos() - 24f-2f);
Texture attackTexture = new Texture("sprites/AttackHori.png");
Sprite attackSprite = new Sprite(attackTexture);
attackSprite.setX(p.getxPos() - 8f);
attackSprite.setY(p.getyPos());
for(int i = 0; i<e.length ; i++){
if(entitySprites[i] != null){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), verticalAttackSprite.getBoundingRectangle())){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), attackSprite.getBoundingRectangle())){
if(e[i] != null){
if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null;
@ -296,13 +297,13 @@ public class GameScreen {
}
}
else if(p.direction() == 3){
Texture horizontalAttack = new Texture("sprites/AttackHori.png");
Sprite horizontalAttackSprite = new Sprite(horizontalAttack);
horizontalAttackSprite.setX(p.getxPos() - 24f-2f);
horizontalAttackSprite.setY(p.getyPos() -2f);
Texture attackTexture = new Texture("sprites/AttackVert.png");
Sprite attackSprite = new Sprite(attackTexture);
attackSprite.setX(p.getxPos() - 32f);
attackSprite.setY(p.getyPos() - 8f);
for(int i = 0; i < e.length ; i++){
if(entitySprites[i] != null){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), horizontalAttackSprite.getBoundingRectangle())){
if(Intersector.overlaps(entitySprites[i].getBoundingRectangle(), attackSprite.getBoundingRectangle())){
if(e[i] != null){
if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null;

Loading…
Cancel
Save