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(keycode == Input.Keys.E){
if(v != null){} if(v != null){}
if(m != 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 public int direction(){ // returns direction the entity is facing depending on its movement
if(movementX < 0f){ // TIS IS SHIT - NEED REWORK if(movementX == -3f){ // TIS IS SHIT - NEED REWORK
return 3; facing = 3;
} }
else if(movementX < 3f){ else if(movementX == 3f){
return 1; facing = 1;
} }
else if(movementY > 3f){ else if(movementY == 3f){
return 0; facing = 0;
} }
else if(movementY < -3f){ else if(movementY == -3f){
return 2; 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){ if(p.direction() == 0){
Texture verticalAttack = new Texture("sprites/AttackVert.png"); Texture attackTexture = new Texture("sprites/AttackHori.png");
Sprite verticalAttackSprite = new Sprite(verticalAttack); Sprite attackSprite = new Sprite(attackTexture);
verticalAttackSprite.setX(p.getxPos()-2f); attackSprite.setX(p.getxPos() - 8f);
verticalAttackSprite.setY(p.getyPos()-2f); attackSprite.setY(p.getyPos() + 32f);
for(int i = 0; i< e.length ; i++){ for(int i = 0; i< e.length ; i++){
if(e[i] != null){ 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] != null){
if(e[i].getHp() - p.getDmg() <= 0){ if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null; e[i] = null;
@ -256,13 +257,13 @@ public class GameScreen {
} }
} }
else if(p.direction() == 1){ else if(p.direction() == 1){
Texture horizontalAttack = new Texture("sprites/AttackHori.png"); Texture attackTexture = new Texture("sprites/AttackVert.png");
Sprite horizontalAttackSprite = new Sprite(horizontalAttack); Sprite attackSprite = new Sprite(attackTexture);
horizontalAttackSprite.setX(p.getxPos()-2f); attackSprite.setX(p.getxPos()+ 32f);
horizontalAttackSprite.setY(p.getyPos()-2f); attackSprite.setY(p.getyPos()- 2f);
for(int i = 0; i< e.length ; i++){ for(int i = 0; i< e.length ; i++){
if(entitySprites[i] != null){ 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] != null){
if(e[i].getHp() - p.getDmg() <= 0){ if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null; e[i] = null;
@ -276,13 +277,13 @@ public class GameScreen {
} }
} }
else if(p.direction() == 2){ else if(p.direction() == 2){
Texture verticalAttack = new Texture("sprites/AttackVert.png"); Texture attackTexture = new Texture("sprites/AttackHori.png");
Sprite verticalAttackSprite = new Sprite(verticalAttack); Sprite attackSprite = new Sprite(attackTexture);
verticalAttackSprite.setX(p.getxPos()-2f); attackSprite.setX(p.getxPos() - 8f);
verticalAttackSprite.setY(p.getyPos() - 24f-2f); attackSprite.setY(p.getyPos());
for(int i = 0; i<e.length ; i++){ for(int i = 0; i<e.length ; i++){
if(entitySprites[i] != null){ 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] != null){
if(e[i].getHp() - p.getDmg() <= 0){ if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null; e[i] = null;
@ -296,13 +297,13 @@ public class GameScreen {
} }
} }
else if(p.direction() == 3){ else if(p.direction() == 3){
Texture horizontalAttack = new Texture("sprites/AttackHori.png"); Texture attackTexture = new Texture("sprites/AttackVert.png");
Sprite horizontalAttackSprite = new Sprite(horizontalAttack); Sprite attackSprite = new Sprite(attackTexture);
horizontalAttackSprite.setX(p.getxPos() - 24f-2f); attackSprite.setX(p.getxPos() - 32f);
horizontalAttackSprite.setY(p.getyPos() -2f); attackSprite.setY(p.getyPos() - 8f);
for(int i = 0; i < e.length ; i++){ for(int i = 0; i < e.length ; i++){
if(entitySprites[i] != null){ 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] != null){
if(e[i].getHp() - p.getDmg() <= 0){ if(e[i].getHp() - p.getDmg() <= 0){
e[i] = null; e[i] = null;

Loading…
Cancel
Save