Example #1
0
  @Override
  public void onTouch(int x, int y, int x2, int y2) {
    // TODO Auto-generated method stub
    super.onTouch(x, y, x2, y2);

    final int x3 = x * Terrain.chunkWidth + x2;
    final int y3 = y * Terrain.chunkHeight + y2;

    home =
        new MessageBoxButton("Home") {

          @Override
          public void onClicked(int... args) {
            // TODO Auto-generated method stub
            MapRenderer.CurrentRenderer.SpawnPos.set(x3, y3);
            Terrain.CurrentTerrain.SaveFlag = true;
          }
        };

    MessageBox.CreateMessageBox(
        "", "Would you like to save or set this tent as your home?", 30, 250, 64, 0.1f, save, home);
  }
Example #2
0
  @Override
  public void OnUse(Bob bob, float x, float y, float dist) {
    // TODO Auto-generated method stub
    super.OnUse(bob, x, y, dist);

    if (flag) {

      int X = (int) x / Terrain.CurrentTerrain.chunkWidth;
      int Y = (int) y / Terrain.CurrentTerrain.chunkHeight;
      int x2 = (int) x % Terrain.CurrentTerrain.chunkWidth;
      int y2 = (int) x % Terrain.CurrentTerrain.chunkWidth;

      if (parentinv.owner.firstUse()) {

        if (Terrain.CurrentTerrain.CreateBlock(parentinv.owner, (int) x, (int) y, InvObjID))
          Bob.CurrentBob.inventory.AddToBag(name, -1, true);
      }
      // Terrain.CurrentTerrain.light.floodStack.add(new Vector3(x,y,0));

      flag = false;
    }
  }