DEADSOFTWARE

c2fca908a889f7dff2591e2239fee7df1b64b609
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GameProc.java
1 package ru.deadsoftware.cavedroid.game;
3 import com.badlogic.gdx.Gdx;
4 import com.badlogic.gdx.Input;
5 import com.badlogic.gdx.utils.Disposable;
6 import com.badlogic.gdx.utils.TimeUtils;
7 import ru.deadsoftware.cavedroid.CaveGame;
8 import ru.deadsoftware.cavedroid.GameScreen;
9 import ru.deadsoftware.cavedroid.game.mobs.FallingGravel;
10 import ru.deadsoftware.cavedroid.game.mobs.FallingSand;
11 import ru.deadsoftware.cavedroid.game.mobs.Mob;
12 import ru.deadsoftware.cavedroid.game.mobs.Pig;
13 import ru.deadsoftware.cavedroid.game.objects.Drop;
14 import ru.deadsoftware.cavedroid.game.objects.Player;
15 import ru.deadsoftware.cavedroid.misc.AppState;
16 import ru.deadsoftware.cavedroid.misc.Assets;
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.Random;
22 public class GameProc implements Serializable, Disposable {
24 static boolean DO_UPD = false;
25 static int UPD_X = -1, UPD_Y = -1;
27 private transient Thread fluidThread;
29 public transient GameWorld world;
30 public transient GameRenderer renderer;
31 public transient GamePhysics physics;
33 public Player player;
34 public ArrayList<Mob> mobs;
35 public ArrayList<Drop> drops;
38 public boolean isTouchDown, isKeyDown;
39 public int ctrlMode, touchDownX, touchDownY, touchDownBtn, keyDownCode;
40 public long touchDownTime;
42 int curX, curY;
43 int creativeScroll, maxCreativeScroll;
44 int blockDmg = 0;
46 public void initGame(int gameMode) {
47 world = new GameWorld();
48 world.generate(1024, 256);
49 player = new Player(gameMode);
50 drops = new ArrayList<>();
51 mobs = new ArrayList<>();
52 for (int i = 0; i < 16; i++) {
53 mobs.add(new Pig(i * 256, 196 * 16));
54 }
55 physics = new GamePhysics();
56 if (CaveGame.TOUCH) {
57 renderer = new GameRenderer(320,
58 320 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
59 } else {
60 ctrlMode = 1;
61 renderer = new GameRenderer(480,
62 480 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
63 }
64 maxCreativeScroll = GameItems.getItemsSize() / 8;
66 fluidThread = new Thread(() -> {
67 while (!fluidThread.isInterrupted()) {
68 fluidUpdater();
69 }
70 });
72 fluidThread.start();
74 GameSaver.save(this);
75 }
77 public void resetRenderer() {
78 if (CaveGame.TOUCH) {
79 renderer = new GameRenderer(320,
80 320 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
81 } else {
82 renderer = new GameRenderer(480,
83 480 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
84 }
85 }
87 private boolean isAutoselectable(int x, int y) {
88 return (world.getForeMap(x, y) > 0 &&
89 GameItems.getBlock(world.getForeMap(x, y)).hasCollision());
90 }
92 private void moveCursor() {
93 int pastX = curX, pastY = curY;
94 if (ctrlMode == 0 && CaveGame.TOUCH) {
95 curX = player.getMapX();
96 if (player.getDir() == 0) curX--;
97 else curX++;
98 curY = (int) (player.pos.y + player.getWidth()) / 16;
99 if (!isAutoselectable(curX, curY)) {
100 curY++;
102 if (!isAutoselectable(curX, curY)) {
103 curY++;
105 if (!isAutoselectable(curX, curY)) {
106 if (player.getDir() == 0) curX++;
107 else curX--;
109 } else if (!CaveGame.TOUCH) {
110 curX = (int) (Gdx.input.getX() *
111 (renderer.getWidth() / GameScreen.getWidth()) + renderer.getCamX()) / 16;
112 curY = (int) (Gdx.input.getY() *
113 (renderer.getHeight() / GameScreen.getHeight()) + renderer.getCamY()) / 16;
114 if ((Gdx.input.getX() *
115 (renderer.getWidth() / GameScreen.getWidth()) + renderer.getCamX()) < 0)
116 curX--;
118 if (pastX != curX || pastY != curY) blockDmg = 0;
121 private void checkCursorBounds() {
122 if (curY < 0) curY = 0;
123 if (curY >= world.getHeight()) curY = world.getHeight() - 1;
124 if (ctrlMode == 1) {
125 if (curX * 16 + 8 < player.pos.x + player.getWidth() / 2)
126 player.setDir(0);
127 if (curX * 16 + 8 > player.pos.x + player.getWidth() / 2)
128 player.setDir(1);
132 private void updateFluids(int x, int y) {
133 if (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y) != 8) {
134 if (world.getForeMap(x, y) == 60) {
135 if (!GameItems.isWater(world.getForeMap(x, y - 1)))
136 world.setForeMap(x, y, world.getForeMap(x, y) + 1);
137 } else if ((!GameItems.isWater(world.getForeMap(x - 1, y)) ||
138 (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) &&
139 (!GameItems.isWater(world.getForeMap(x + 1, y)) ||
140 (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) {
141 world.setForeMap(x, y, world.getForeMap(x, y) + 1);
143 if (world.getForeMap(x, y) > 63) world.setForeMap(x, y, 0);
146 if (world.getForeMap(x, y) == 8 || world.getForeMap(x, y) == 60) {
147 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
148 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
149 world.setForeMap(x, y + 1, 60);
150 updateBlock(x, y + 2);
151 } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
152 if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
153 else world.setForeMap(x, y + 1, 68);
154 } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
155 if (world.getForeMap(x + 1, y) == 0 ||
156 (!GameItems.getBlock(world.getForeMap(x + 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
157 (GameItems.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 61)) {
158 world.setForeMap(x + 1, y, 61);
159 updateBlock(x + 1, y + 1);
160 } else if (GameItems.isLava(world.getForeMap(x + 1, y))) {
161 if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4);
162 else world.setForeMap(x + 1, y, 68);
163 } else if (world.getForeMap(x + 1, y) == 61 && (world.getForeMap(x + 2, y) == 8 || world.getForeMap(x + 2, y) == 60))
164 world.setForeMap(x + 1, y, 8);
166 if (world.getForeMap(x - 1, y) == 0 ||
167 (!GameItems.getBlock(world.getForeMap(x - 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
168 (GameItems.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 61)) {
169 world.setForeMap(x - 1, y, 61);
170 updateBlock(x - 1, y + 1);
171 } else if (GameItems.isLava(world.getForeMap(x - 1, y))) {
172 if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4);
173 else world.setForeMap(x - 1, y, 68);
174 } else if (world.getForeMap(x - 1, y) == 61 && (world.getForeMap(x - 2, y) == 8 || world.getForeMap(x - 2, y) == 60))
175 world.setForeMap(x - 1, y, 8);
177 return;
179 if (world.getForeMap(x, y) == 61) {
180 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
181 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
182 world.setForeMap(x, y + 1, 60);
183 updateBlock(x, y + 2);
184 } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
185 if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
186 else world.setForeMap(x, y + 1, 68);
187 } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
188 if (world.getForeMap(x + 1, y) == 0 ||
189 (!GameItems.getBlock(world.getForeMap(x + 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
190 (GameItems.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) {
191 world.setForeMap(x + 1, y, 62);
192 updateBlock(x + 1, y + 1);
193 } else if (GameItems.isLava(world.getForeMap(x + 1, y))) {
194 if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4);
195 else world.setForeMap(x + 1, y, 68);
198 if (world.getForeMap(x - 1, y) == 0 ||
199 (!GameItems.getBlock(world.getForeMap(x - 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
200 (GameItems.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) {
201 world.setForeMap(x - 1, y, 62);
202 updateBlock(x - 1, y + 1);
203 } else if (GameItems.isLava(world.getForeMap(x - 1, y))) {
204 if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4);
205 else world.setForeMap(x - 1, y, 68);
208 return;
210 if (world.getForeMap(x, y) == 62) {
211 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
212 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
213 world.setForeMap(x, y + 1, 60);
214 updateBlock(x, y + 2);
215 } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
216 if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
217 else world.setForeMap(x, y + 1, 68);
218 } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
219 if (world.getForeMap(x + 1, y) == 0 ||
220 (!GameItems.getBlock(world.getForeMap(x + 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x + 1, y)))) {
221 world.setForeMap(x + 1, y, 63);
222 updateBlock(x + 1, y + 1);
223 } else if (GameItems.isLava(world.getForeMap(x + 1, y))) {
224 if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4);
225 else world.setForeMap(x + 1, y, 68);
228 if (world.getForeMap(x - 1, y) == 0 ||
229 (!GameItems.getBlock(world.getForeMap(x - 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x - 1, y)))) {
230 world.setForeMap(x - 1, y, 63);
231 updateBlock(x - 1, y + 1);
232 } else if (GameItems.isLava(world.getForeMap(x - 1, y))) {
233 if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4);
234 else world.setForeMap(x - 1, y, 68);
237 return;
239 if (world.getForeMap(x, y) == 63) {
240 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) ||
241 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
242 world.setForeMap(x, y + 1, 60);
243 updateBlock(x, y + 2);
244 } else if (GameItems.isLava(world.getForeMap(x, y + 1))) {
245 if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4);
246 else world.setForeMap(x, y + 1, 68);
248 return;
251 if (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y) != 9) {
252 if (world.getForeMap(x, y) == 64) {
253 if (!GameItems.isLava(world.getForeMap(x, y - 1)))
254 world.setForeMap(x, y, world.getForeMap(x, y) + 1);
255 } else if ((!GameItems.isLava(world.getForeMap(x, y - 1))) &&
256 (!GameItems.isLava(world.getForeMap(x - 1, y)) ||
257 (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) &&
258 (!GameItems.isLava(world.getForeMap(x + 1, y)) ||
259 (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) {
260 world.setForeMap(x, y, world.getForeMap(x, y) + 1);
262 if (world.getForeMap(x, y) > 67) world.setForeMap(x, y, 0);
265 if (world.getForeMap(x, y) == 9 || world.getForeMap(x, y) == 64) {
266 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
267 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
268 world.setForeMap(x, y + 1, 64);
269 updateBlock(x, y + 2);
270 } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
271 world.setForeMap(x, y + 1, 1);
272 } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
273 if (world.getForeMap(x + 1, y) == 0 ||
274 (!GameItems.getBlock(world.getForeMap(x + 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
275 (GameItems.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) {
276 world.setForeMap(x + 1, y, 65);
277 updateBlock(x + 1, y + 1);
278 } else if (GameItems.isWater(world.getForeMap(x + 1, y))) {
279 world.setForeMap(x + 1, y, 1);
282 if (world.getForeMap(x - 1, y) == 0 ||
283 (!GameItems.getBlock(world.getForeMap(x - 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
284 (GameItems.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) {
285 world.setForeMap(x - 1, y, 65);
286 updateBlock(x - 1, y + 1);
287 } else if (GameItems.isWater(world.getForeMap(x - 1, y))) {
288 world.setForeMap(x - 1, y, 1);
291 return;
293 if (world.getForeMap(x, y) == 65) {
294 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
295 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
296 world.setForeMap(x, y + 1, 64);
297 updateBlock(x, y + 2);
298 } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
299 world.setForeMap(x, y + 1, 1);
300 } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
301 if (world.getForeMap(x + 1, y) == 0 ||
302 (!GameItems.getBlock(world.getForeMap(x + 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x + 1, y))) ||
303 (GameItems.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) {
304 world.setForeMap(x + 1, y, 66);
305 updateBlock(x + 1, y + 1);
306 } else if (GameItems.isWater(world.getForeMap(x + 1, y))) {
307 world.setForeMap(x + 1, y, 1);
310 if (world.getForeMap(x - 1, y) == 0 ||
311 (!GameItems.getBlock(world.getForeMap(x - 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x - 1, y))) ||
312 (GameItems.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) {
313 world.setForeMap(x - 1, y, 66);
314 updateBlock(x - 1, y + 1);
315 } else if (GameItems.isWater(world.getForeMap(x - 1, y))) {
316 world.setForeMap(x - 1, y, 1);
319 return;
321 if (world.getForeMap(x, y) == 66) {
322 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
323 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
324 world.setForeMap(x, y + 1, 64);
325 updateBlock(x, y + 2);
326 } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
327 world.setForeMap(x, y + 1, 1);
328 } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
329 if (world.getForeMap(x + 1, y) == 0 ||
330 (!GameItems.getBlock(world.getForeMap(x + 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x + 1, y)))) {
331 world.setForeMap(x + 1, y, 67);
332 updateBlock(x + 1, y + 1);
333 } else if (GameItems.isWater(world.getForeMap(x + 1, y))) {
334 world.setForeMap(x + 1, y, 1);
337 if (world.getForeMap(x - 1, y) == 0 ||
338 (!GameItems.getBlock(world.getForeMap(x - 1, y)).hasCollision() && !GameItems.isFluid(world.getForeMap(x - 1, y)))) {
339 world.setForeMap(x - 1, y, 67);
340 updateBlock(x - 1, y + 1);
341 } else if (GameItems.isWater(world.getForeMap(x - 1, y))) {
342 world.setForeMap(x - 1, y, 1);
345 return;
347 if (world.getForeMap(x, y) == 67) {
348 if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) ||
349 (!GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision() && !GameItems.isFluid(world.getForeMap(x, y + 1)))) {
350 world.setForeMap(x, y + 1, 64);
351 updateBlock(x, y + 2);
352 } else if (GameItems.isWater(world.getForeMap(x, y + 1))) {
353 world.setForeMap(x, y + 1, 1);
358 private void updateBlock(int x, int y) {
359 if (world.getForeMap(x, y) == 10) {
360 if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
361 world.setForeMap(x, y, 0);
362 mobs.add(new FallingSand(x * 16, y * 16));
363 updateBlock(x, y - 1);
367 if (world.getForeMap(x, y) == 11) {
368 if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
369 world.setForeMap(x, y, 0);
370 mobs.add(new FallingGravel(x * 16, y * 16));
371 updateBlock(x, y - 1);
375 if (world.getForeMap(x, y) > 0 && GameItems.getBlock(world.getForeMap(x, y)).requiresBlock()) {
376 if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).hasCollision()) {
377 world.destroyForeMap(x, y);
378 updateBlock(x, y - 1);
382 if (world.getForeMap(x, y) == 2) {
383 if (world.getForeMap(x, y - 1) > 0 && (GameItems.getBlock(world.getForeMap(x, y - 1)).hasCollision() ||
384 GameItems.isFluid(world.getForeMap(x, y - 1)))) {
385 world.setForeMap(x, y, 3);
390 private void fluidUpdater() {
391 for (int y = 0; y < world.getHeight(); y++) {
392 for (int x = (int) renderer.getCamX() / 16 - 1;
393 x < (int) (renderer.getCamX() + renderer.getWidth()) / 16 + 1; x++) {
394 updateFluids(x, y);
399 void useItem(int x, int y, int id, boolean bg) {
400 if (id > 0) {
401 if (GameItems.getItem(id).isBlock()) {
402 if (!bg) world.placeToForeground(x, y, GameItems.getBlockIdByItemId(id));
403 else world.placeToBackground(x, y, GameItems.getBlockIdByItemId(id));
404 } else {
405 switch (id) {
406 case 65:
407 world.placeToForeground(x, y, 8);
408 player.inv[player.invSlot] = 64;
409 break;
410 case 66:
411 world.placeToForeground(x, y, 9);
412 player.inv[player.invSlot] = 64;
413 break;
419 public void update(float delta) {
420 if (DO_UPD) {
421 for (int y = UPD_Y; y < UPD_Y + 16; y++)
422 for (int x = UPD_X; x < UPD_X + 16; x++) {
423 updateBlock(x, y);
425 DO_UPD = false;
428 physics.update(delta);
429 moveCursor();
430 checkCursorBounds();
432 if (isTouchDown && touchDownBtn == Input.Buttons.LEFT) {
433 if ((world.getForeMap(curX, curY) > 0 && GameItems.getBlock(world.getForeMap(curX, curY)).getHp() >= 0) ||
434 (world.getForeMap(curX, curY) == 0 &&
435 world.getBackMap(curX, curY) > 0 &&
436 GameItems.getBlock(world.getBackMap(curX, curY)).getHp() >= 0)) {
437 if (player.gameMode == 0) {
438 blockDmg++;
439 if (world.getForeMap(curX, curY) > 0) {
440 if (blockDmg >= GameItems.getBlock(world.getForeMap(curX, curY)).getHp()) {
441 world.destroyForeMap(curX, curY);
442 blockDmg = 0;
444 } else if (world.getBackMap(curX, curY) > 0) {
445 if (blockDmg >= GameItems.getBlock(world.getBackMap(curX, curY)).getHp()) {
446 world.destroyBackMap(curX, curY);
447 blockDmg = 0;
450 } else {
451 if (world.getForeMap(curX, curY) > 0) world.placeToForeground(curX, curY, 0);
452 else if (world.getBackMap(curX, curY) > 0) world.placeToBackground(curX, curY, 0);
453 isTouchDown = false;
458 if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) {
459 if (touchDownBtn == Input.Buttons.RIGHT) {
460 useItem(curX, curY, player.inv[player.invSlot], true);
461 isTouchDown = false;
462 } else if (touchDownY < Assets.invBar.getRegionHeight() &&
463 touchDownX > renderer.getWidth() / 2 - (float) Assets.invBar.getRegionWidth() / 2 &&
464 touchDownX < renderer.getWidth() / 2 + (float) Assets.invBar.getRegionWidth() / 2) {
465 CaveGame.STATE = AppState.GAME_CREATIVE_INV;
466 isTouchDown = false;
471 @Override
472 public void dispose() {
473 fluidThread.interrupt();