DEADSOFTWARE

Better collision, disable auto jump
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / GameProc.java
1 package ru.deadsoftware.cavecraft.game;
3 import com.badlogic.gdx.math.RandomXS128;
4 import com.badlogic.gdx.utils.Array;
5 import com.badlogic.gdx.utils.TimeUtils;
6 import ru.deadsoftware.cavecraft.game.mobs.Human;
7 import ru.deadsoftware.cavecraft.game.mobs.Mob;
8 import ru.deadsoftware.cavecraft.game.objects.Player;
10 public class GameProc {
12 public static double RUN_TIME = 0;
14 public Player player;
16 public Array<Mob> mobs;
18 public GameWorld world;
19 public GameRenderer renderer;
20 public GamePhysics physics;
22 public int cursorX, cursorY;
23 public int invSlot;
24 public int ctrlMode;
26 public boolean isTouchDown = false;
27 public int touchDownX, touchDownY;
28 public long touchDownTime;
30 public GameProc() {
31 world = new GameWorld(4096,256);
32 renderer = new GameRenderer(this);
33 physics = new GamePhysics(this);
34 player = new Player(world.getWidth()/2*16+4, 0);
35 mobs = new Array<Mob>();
37 }
39 public void resetRenderer() {
40 renderer = new GameRenderer(this);
41 }
43 public void update(float delta) {
44 RUN_TIME += delta;
46 physics.update(delta);
48 if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) {
49 world.placeToBackground(cursorX,cursorY,
50 player.inventory[invSlot]);
51 isTouchDown = false;
52 }
53 }
55 }