summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 524d5ab)
raw | patch | inline | side by side (parent: 524d5ab)
author | fred-boy <fred-boy@protonmail.com> | |
Sat, 21 Apr 2018 17:24:32 +0000 (00:24 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Sat, 21 Apr 2018 17:24:32 +0000 (00:24 +0700) |
core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java | patch | blob | history | |
core/src/ru/deadsoftware/cavecraft/game/GameProc.java | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java
index 2fdc29bca17b88dd066b8ef1ebd8840fc0cab6cb..b20575a7034b927ee201e3c56bda7d91a449ae77 100644 (file)
private boolean checkJump(Rectangle rect, int dir) {
int bl = 0;
+ if (rect.x<0) rect.x-=16;
switch (dir) {
case 0:
bl = gameProc.world.getForeMap(
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java
index 6c532ace6a77c6a6537d7b5b0196f44c3e7d08fc..f3ea4ac131f79be3bfacd01cdac8449f7bfde00c 100644 (file)
}
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--;
+ }
+ if (player.position.x<0) cursorX--;
} else if (!CaveGame.TOUCH){
cursorX = (int)(Gdx.input.getX()*
(renderer.camera.viewportWidth/GameScreen.getWidth())+renderer.camera.position.x)/16;
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+8<player.position.x+player.texWidth/2)
+ player.dir=0;
+ if (cursorX*16+8>player.position.x+player.texWidth/2)
+ player.dir=1;
+ }
}
public void update(float delta) {