summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9f89992)
raw | patch | inline | side by side (parent: 9f89992)
author | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 12:52:33 +0000 (19:52 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 12:52:33 +0000 (19:52 +0700) |
diff --git a/android/assets/json/menu_new_game_buttons.json b/android/assets/json/menu_new_game_buttons.json
index c61adc3d36f8310355683f53d179402b6d56ddd0..ca4c4042bfa178fe69579c238ebdc8bf7f7c41f2 100644 (file)
"label": "Creative"
},
"survival": {
- "label": "Survival",
- "type": 0
+ "label": "Survival"
},
"back": {
"label": "Back"
diff --git a/core/src/ru/deadsoftware/cavedroid/CaveGame.java b/core/src/ru/deadsoftware/cavedroid/CaveGame.java
index 53d4310bcd08a6c6dd5f5dead75f2b6f5713eab2..4fa6b0e972871687ea9ed154d0733f5b0f7bdb48 100644 (file)
mMainConfig.setAssetsPackPath(mAssetsPackPath);
}
- public void newGame() {
+ public void newGame(int gameMode) {
GameScreen gameScreen = mMainComponent.getGameScreen();
- gameScreen.newGame();
+ gameScreen.newGame(gameMode);
setScreen(gameScreen);
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameProc.java b/core/src/ru/deadsoftware/cavedroid/game/GameProc.java
index d5a1a95ad3745072fe0f2758905eb8d28cc9cf0c..f063f7a19a856c1f0d4b06e28f924f14574ced22 100644 (file)
package ru.deadsoftware.cavedroid.game;
import com.badlogic.gdx.utils.Disposable;
+import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.world.GameWorld;
import javax.inject.Inject;
private final GamePhysics mGamePhysics;
private final GameInput mGameInput;
private final GameRenderer mGameRenderer;
+ private final MobsController mMobsController;
@Inject
public GameProc(GameWorld gameWorld,
GamePhysics gamePhysics,
GameInput gameInput,
- GameRenderer gameRenderer) {
+ GameRenderer gameRenderer,
+ MobsController mobsController
+ ) {
mGameWorld = gameWorld;
mGamePhysics = gamePhysics;
mGameInput = gameInput;
mGameRenderer = gameRenderer;
+ mMobsController = mobsController;
+ }
+
+ public void setPlayerGameMode(int gameMode) {
+ mMobsController.getPlayer().gameMode = gameMode;
}
public void update(float delta) {
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
index b555f6bde14fc927d6e4de3d965de81bdf5a9887..09878f501d1224304633243a69b80fafc0fe34bc 100644 (file)
@GameScope
public class GameRenderer extends Renderer {
+ private static final String TAG = "GameRenderer";
+
private final MainConfig mMainConfig;
private final GameInput mGameInput;
private final GameWorld mGameWorld;
if (mGameInput.getBlockDamage() > 0) {
int index = 10 * mGameInput.getBlockDamage() / GameItems.getBlock(bl).getHp();
String key = "break_" + index;
+
+ if (index > 10 || index < 0) {
+ return;
+ }
+
spriter.draw(textureRegions.get(key), mGameInput.getCurX() * 16 - getCamX(),
mGameInput.getCurY() * 16 - getCamY());
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameScreen.java b/core/src/ru/deadsoftware/cavedroid/game/GameScreen.java
index 4a7d6131f87cd78dce442950e25e9babf840a79e..e2c83bcab66e079ce73cf09b7261fe07297542cc 100644 (file)
mMainConfig = mainConfig;
}
- public void newGame() {
+ public void newGame(int gameMode) {
if (mGameProc != null) {
mGameProc.dispose();
}
mGameProc = gameComponent.getGameProc();
mGameInputProcessor = gameComponent.getGameInputProcessor();
+ mGameProc.setPlayerGameMode(gameMode);
+
Gdx.input.setInputProcessor(gameComponent.getGameInputProcessor());
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java
index ebdd9c0dbed6281204809267f6ed0997f270925b..34232f705e7e3fdf4303b6db6ecd16488de2c061 100644 (file)
public final int[] inventory;
public int slot;
- public final int gameMode;
+ public int gameMode;
public boolean swim;
public float headRotation = 0f;
public Player() {
super(0, 0, 4, 30, randomDir(), Type.MOB, MAX_HEALTH);
- this.gameMode = 1;
inventory = new int[9];
swim = false;
}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/MenuProc.java b/core/src/ru/deadsoftware/cavedroid/menu/MenuProc.java
index 2b645207cd010c0f197694457abb59bbe6556f0b..6accb5726147700119cb351f1d327d7760df4937 100644 (file)
public class Input {
private void startNewGame(int gameMode) {
- mMainConfig.getCaveGame().newGame();
+ mMainConfig.getCaveGame().newGame(gameMode);
}
public void newGameClicked() {