MEHR FPSSSS yay

This commit is contained in:
Asecave
2021-06-27 13:46:04 +02:00
parent eefbd17b26
commit 4b630769d5
6 changed files with 10 additions and 6 deletions

Binary file not shown.

View File

@@ -13,7 +13,7 @@ public class Main extends Game {
private HUD hud;
public Main() {
super(World.SCALE * 15, World.SCALE * 11);
super(World.SCALE * 15, World.SCALE * 11, 16);
instance = this;
// Welt initialisieren und Spieler hinzufügen

View File

@@ -9,7 +9,7 @@ import main.maps.TutorialMap;
*/
public class World extends Knoten {
public static final int SCALE_FACTOR = 4; // Der Basis Zoomfaktor
public static final int SCALE_FACTOR = 6; // Der Basis Zoomfaktor
public static final int SCALE = SCALE_FACTOR * Tile.getSize(); // Eine Gameunit ist so viele pixel lang
private Map currentMap; // Die Map die aktuell angezeigt werden soll.

View File

@@ -116,7 +116,11 @@ public abstract class Entity implements Ticker {
* Generiert einen vektor von diesm Entity zu einem anderen
*/
public Vektor vectorToEntity(Entity e) {
return new Vektor(e.posX - posX, e.posY - posY);
Vektor v = new Vektor(e.posX - posX, e.posY - posY);;
if (v.x == 0 && v.y == 0) {
return new Vektor(0.0000001f, 0.0000001f);
}
return v;
}
protected boolean lineOfSightClear(Entity e) {

View File

@@ -28,7 +28,7 @@ public class Snake extends LivingEntity {
actionFigur.neuerZustand(loader.getFigur(5), getDamageAnimationName());
loader.getFigur(3).animationsGeschwindigkeitSetzen(80);
loader.getFigur(5).animationsGeschwindigkeitSetzen(40);
loader.getFigur(5).animationsGeschwindigkeitSetzen(60);
}
@Override

View File

@@ -104,8 +104,8 @@ public class Player extends LivingEntity {
Vektor toE = vectorToEntity(le);
toE = toE.normiert();
if ((toE.x > 0 && !side) || (toE.x <= 0 && side)) {
le.setVelX(le.getVelX() + toE.x * 0.05f);
le.setVelY(le.getVelY() + toE.y * 0.05f);
le.setVelX(le.getVelX() + toE.x * 0.1f);
le.setVelY(le.getVelY() + toE.y * 0.1f);
le.takeDamage(0.1f, this);
}
}