X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGameProc.java;h=b100ddc77251572ddee3e4e54d8cde36ce5e2542;hb=792296717939ac50df33865ae3acbb010e812ad1;hp=6c532ace6a77c6a6537d7b5b0196f44c3e7d08fc;hpb=524d5abc0b76b25a4cf2b31e6ba4f41a107a5ab6;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java index 6c532ac..b100ddc 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java @@ -32,7 +32,13 @@ public class GameProc { public GameProc() { world = new GameWorld(1024,256); - renderer = new GameRenderer(this); + if (CaveGame.TOUCH) { + renderer = new GameRenderer(this,320, + 320*((float)GameScreen.getHeight()/GameScreen.getWidth())); + } else { + renderer = new GameRenderer(this,480, + 480*((float)GameScreen.getHeight()/GameScreen.getWidth())); + } physics = new GamePhysics(this); player = new Player(world.getSpawnPoint()); mobs = new Array(); @@ -43,7 +49,13 @@ public class GameProc { } public void resetRenderer() { - renderer = new GameRenderer(this); + if (CaveGame.TOUCH) { + renderer = new GameRenderer(this,320, + 320*((float)GameScreen.getHeight()/GameScreen.getWidth())); + } else { + renderer = new GameRenderer(this,480, + 480*((float)GameScreen.getHeight()/GameScreen.getWidth())); + } } private boolean isAutoselectable(int x, int y) { @@ -52,25 +64,20 @@ public class GameProc { } private void moveCursor() { - if (ctrlMode==0 && CaveGame.TOUCH) { - if (player.canJump) { - cursorX = (int) (player.position.x + player.texWidth / 2) / 16; - if (player.dir == 0) cursorX--; + if (ctrlMode == 0 && CaveGame.TOUCH) { + cursorX = (int) (player.position.x + player.texWidth / 2) / 16; + if (player.dir == 0) cursorX--; else cursorX++; - cursorY = (int) (player.position.y + player.texWidth) / 16; - if (!isAutoselectable(cursorX, cursorY)) { - cursorY++; - } - if (!isAutoselectable(cursorX, cursorY)) { - cursorY++; - } - if (!isAutoselectable(cursorX, cursorY)) { - if (player.dir == 0) cursorX++; - else cursorX--; - } - } else { - cursorX = (int) (player.position.x + player.texWidth / 2) / 16; - cursorY = (int) (player.position.y + player.height+8)/16; + cursorY = (int) (player.position.y + player.texWidth) / 16; + if (!isAutoselectable(cursorX, cursorY)) { + cursorY++; + } + if (!isAutoselectable(cursorX, cursorY)) { + cursorY++; + } + if (!isAutoselectable(cursorX, cursorY)) { + if (player.dir == 0) cursorX++; + else cursorX--; } } else if (!CaveGame.TOUCH){ cursorX = (int)(Gdx.input.getX()* @@ -86,10 +93,12 @@ public class GameProc { private void checkCursorBounds() { if (cursorY < 0) cursorY = 0; if (cursorY >= world.getHeight()) cursorY = world.getHeight()-1; - if (cursorX<(player.position.x+player.texWidth/2)/16) - player.dir=0; - if (cursorX>(player.position.x+player.texWidth/2)/16) - player.dir=1; + if (ctrlMode==1) { + if (cursorX*16+8player.position.x+player.texWidth/2) + player.dir=1; + } } public void update(float delta) {