DEADSOFTWARE

fd6d0fe748622debb40ff4f5db865388c57f36f8
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / GameProc.java
1 package ru.deadsoftware.cavecraft.game;
3 import com.badlogic.gdx.utils.Array;
4 import com.badlogic.gdx.utils.TimeUtils;
5 import ru.deadsoftware.cavecraft.game.mobs.Human;
6 import ru.deadsoftware.cavecraft.game.mobs.Mob;
7 import ru.deadsoftware.cavecraft.game.objects.Player;
9 public class GameProc {
11 public static double RUN_TIME = 0;
13 public Player player;
15 public Array<Mob> mobs;
17 public GameWorld world;
18 public GameRenderer renderer;
19 public GamePhysics physics;
21 public int cursorX, cursorY;
22 public int invSlot;
23 public int ctrlMode;
25 public boolean isTouchDown = false;
26 public int touchDownX, touchDownY;
27 public long touchDownTime;
29 public GameProc() {
30 world = new GameWorld(512,256);
31 renderer = new GameRenderer(this);
32 physics = new GamePhysics(this);
33 player = new Player();
34 mobs = new Array<Mob>();
36 }
38 public void resetRenderer() {
39 renderer = new GameRenderer(this);
40 }
42 public void update(float delta) {
43 RUN_TIME += delta;
45 physics.update(delta);
47 if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) {
48 world.placeToBackground(cursorX,cursorY,
49 player.inventory[invSlot]);
50 isTouchDown = false;
51 }
52 }
54 }