diff --git a/core/src/ru/deadsoftware/cavecraft/game/objects/Player.java b/core/src/ru/deadsoftware/cavecraft/game/objects/Player.java
index 5810eb55a047e86b8977341e32256c3ecd491b3c..93f68b5d43243e09c11251fb3d19f018d7218a8a 100644 (file)
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import ru.deadsoftware.cavecraft.game.GameItems;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import ru.deadsoftware.cavecraft.game.GameItems;
-import ru.deadsoftware.cavecraft.game.GameWorld;
import ru.deadsoftware.cavecraft.game.mobs.Mob;
import ru.deadsoftware.cavecraft.misc.Assets;
import java.io.Serializable;
import ru.deadsoftware.cavecraft.game.mobs.Mob;
import ru.deadsoftware.cavecraft.misc.Assets;
import java.io.Serializable;
+import static ru.deadsoftware.cavecraft.GameScreen.GP;
+
public class Player extends Mob implements Serializable {
public int[] inv;
public class Player extends Mob implements Serializable {
public int[] inv;
public int gameMode;
public boolean swim;
public int gameMode;
public boolean swim;
- public Player(GameWorld world, int gameMode) {
+ public Player(int gameMode) {
super(0, 0, 4, 30, 1, true);
this.gameMode = gameMode;
inv = new int[9];
super(0, 0, 4, 30, 1, true);
this.gameMode = gameMode;
inv = new int[9];
- pos = getSpawnPoint(world).cpy();
+ pos = getSpawnPoint().cpy();
swim = false;
}
swim = false;
}
- public void respawn(GameWorld world) {
- pos.set(getSpawnPoint(world));
+ public void respawn() {
+ pos.set(getSpawnPoint());
mov.setZero();
}
mov.setZero();
}
- private Vector2 getSpawnPoint(GameWorld world) {
+ private Vector2 getSpawnPoint() {
int x = 0, y;
int x = 0, y;
- for (y = 0; y < world.getHeight(); y++) {
- if (y == world.getHeight() - 1) {
+ for (y = 0; y < GP.world.getHeight(); y++) {
+ if (y == GP.world.getHeight() - 1) {
y = 60;
y = 60;
- world.setForeMap(x, y, 1);
+ GP.world.setForeMap(x, y, 1);
break;
}
break;
}
- if (world.getForeMap(x, y) > 0 && GameItems.getBlock(world.getForeMap(x, y)).hasCollision()) break;
+ if (GP.world.getForeMap(x, y) > 0 && GameItems.getBlock(GP.world.getForeMap(x, y)).hasCollision()) break;
}
return new Vector2(x * 16 + 8 - (float) getWidth() / 2, (float) y * 16 - getHeight());
}
}
return new Vector2(x * 16 + 8 - (float) getWidth() / 2, (float) y * 16 - getHeight());
}