diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
index c32bbd9358f297088f28c43572154652520b919c..97d05cb2d41f5767cd88482f27c238453da61f41 100644 (file)
package ru.deadsoftware.cavecraft.game;
import com.badlogic.gdx.Gdx;
package ru.deadsoftware.cavecraft.game;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.math.Vector2;
import ru.deadsoftware.cavecraft.Items;
public class GameWorld {
import ru.deadsoftware.cavecraft.Items;
public class GameWorld {
setBackMap(x,y,value);
}
setBackMap(x,y,value);
}
+ public Vector2 getSpawnPoint() {
+ float x=0, y=0;
+ boolean found = false;
+ x = getWidth()/2;
+ while (!found) {
+ for (int i = 0; i < getHeight(); i++) {
+ if (getForeMap((int)x, i)>0 &&
+ Items.BLOCKS.getValueAt(getForeMap((int)x, i)).collision) {
+ y = i-3;
+ found = true;
+ break;
+ }
+ }
+ if (!found) x--;
+ }
+ x = x*16 + 4;
+ y *= 16;
+ return new Vector2(x,y);
+ }
+
}
}