summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6d02313)
raw | patch | inline | side by side (parent: 6d02313)
author | fred-boy <fred-boy@protonmail.com> | |
Sun, 22 Apr 2018 17:34:28 +0000 (00:34 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Sun, 22 Apr 2018 17:34:28 +0000 (00:34 +0700) |
diff --git a/core/src/ru/deadsoftware/cavecraft/GameScreen.java b/core/src/ru/deadsoftware/cavecraft/GameScreen.java
index accd1e59cc6ffd25fac1a3f47ae4fd8170e74eca..52c3dcf5c8f2dbf1cedd7952d97fefe8a2648e82 100644 (file)
public GameScreen() {
Assets.load();
Items.load();
- gameProc = new GameProc();
menuRenderer = new MenuRenderer(CaveGame.TOUCH?320:480);
renderer = menuRenderer;
Gdx.input.setInputProcessor(new InputHandlerMenu(menuRenderer));
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java
index 07587e688129906f76e67401b01f8afd15b01778..3c2e9ec718f1653526f93b70edf30dda8928054b 100644 (file)
if (pl.position.x+pl.texWidth/2<0) pl.position.x+=gameProc.world.getWidth()*16;
if (pl.position.x+pl.texWidth/2>gameProc.world.getWidth()*16) pl.position.x-=gameProc.world.getWidth()*16;
if (pl.position.y > gameProc.world.getHeight()*16) {
- pl.position = gameProc.world.getSpawnPoint().cpy();
+ pl.position = gameProc.world.getSpawnPoint(0).cpy();
}
if (CaveGame.TOUCH && checkJump(pl.getRect(), pl.dir) && !pl.flyMode && pl.canJump && !pl.moveX.equals(Vector2.Zero)) {
pl.moveY.add(0, -8);
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java
index b100ddc77251572ddee3e4e54d8cde36ce5e2542..dfe4d6bdd306f6a6c139a1a52f00d19283705bc2 100644 (file)
480*((float)GameScreen.getHeight()/GameScreen.getWidth()));
}
physics = new GamePhysics(this);
- player = new Player(world.getSpawnPoint());
+ player = new Player(world.getSpawnPoint(0));
mobs = new Array<Mob>();
for (int i=0; i<world.getWidth(); i+=64) {
- mobs.add(new Pig(i*16, 0, world));
+ mobs.add(new Pig(i*16, (int)world.getSpawnPoint(i).y, world));
}
if (!CaveGame.TOUCH) ctrlMode = 1;
}
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
index daa00c004af21ce8356aeec57d0f276d18865376..064eca58ffa72052a0b6afd0695aea1772c159c2 100644 (file)
}
}
- public Vector2 getSpawnPoint() {
- float x=0, y=0;
+ public Vector2 getSpawnPoint(int x) {
+ int y=0;
+ while (true) {
+ y++;
+ if (getForeMap(x,y)>0 && Items.BLOCKS.getValueAt(getForeMap(x,y)).collision) break;
+ }
x = x*16 + 4;
- y *= 16;
+ y = y*16 - 32;
return new Vector2(x,y);
}
diff --git a/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java b/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java
index 482db61499fe5b5e1b6a902c14f65a944526e09b..c8cbc288a252b50adc40841a7761aec2b97deb08 100644 (file)
spriteBatch.begin();
for (int x=0; x<=getWidth()/16; x++)
for (int y=0; y<=getHeight()/16; y++) {
- if (y == 0) spriteBatch.draw(Items.BLOCKS.get("grass").getTexture(), x * 16, y * 16);
- else spriteBatch.draw(Items.BLOCKS.get("dirt").getTexture(), x * 16, y * 16);
+ spriteBatch.draw(Items.BLOCKS.get("dirt").getTexture(), x * 16, y * 16);
spriteBatch.draw(Assets.shade,x*16,y*16);
}
spriteBatch.draw(Assets.gameLogo, getWidth()/2-Assets.gameLogo.getWidth()/2, 0);