Beispiel #1
0
 @Override
 public boolean touchDown(int x, int y, int arg2, int arg3) {
   camera.unproject(mousePos.set(x, y, 0));
   if (backButton.contains(mousePos.x, mousePos.y)) {
     goBack();
   }
   ObjectMap.Entries<String, Rectangle> entries = bindingButtons.entries();
   boolean focusedAnOption = false;
   while (entries.hasNext()) {
     ObjectMap.Entry<String, Rectangle> entry = entries.next();
     Rectangle bounds = entry.value;
     camera.unproject(mousePos.set(x, y, 0));
     if (bounds.contains(mousePos.x, mousePos.y)) {
       this.focused = true;
       focusedAnOption = true;
       this.focusedBox.setY(bounds.y);
       this.focusedBox.setX(bounds.x);
       BitmapFont.TextBounds b = font.getBounds(entry.key);
       this.focusedBox.setHeight(b.height);
       this.focusedBox.setWidth(b.width);
       this.focusedAction = entry.key;
     }
   }
   if (!focusedAnOption) {
     this.focused = false;
   }
   return false;
 }
Beispiel #2
0
 private void updateCamZoom(float newZoom) {
   OrthographicCamera c = cam.camera;
   c.unproject(zTmp1.set(cs.xy.x, cs.xy.y, 0));
   c.zoom = newZoom;
   c.update();
   c.unproject(zTmp2.set(cs.xy.x, cs.xy.y, 0));
   c.translate(zTmp1.sub(zTmp2));
   c.update();
 }
 @Override
 public boolean touchDragged(int x, int y, int pointer) {
   camera.unproject(curr.set(x, y, 0));
   if (!(last.x == -1 && last.y == -1 && last.z == -1)) {
     camera.unproject(delta.set(last.x, last.y, 0));
     delta.sub(curr);
     camera.position.add(delta.x, delta.y, 0);
   }
   last.set(x, y, 0);
   return false;
 }
Beispiel #4
0
  @Override
  public boolean touchDown(int x, int y, int pointer, int newParam) {
    // translate the mouse coordinates to world coordinates
    testPoint.set(x, y, 0);
    camera.unproject(testPoint);

    // ask the world which bodies are within the given
    // bounding box around the mouse pointer
    hitBody = null;
    world.QueryAABB(
        callback, testPoint.x - 0.1f, testPoint.y - 0.1f, testPoint.x + 0.1f, testPoint.y + 0.1f);

    // if we hit something we create a new mouse joint
    // and attach it to the hit body.
    if (hitBody != null) {
      MouseJointDef def = new MouseJointDef();
      def.bodyA = groundBody;
      def.bodyB = hitBody;
      def.collideConnected = true;
      def.target.set(testPoint.x, testPoint.y);
      def.maxForce = 1000.0f * hitBody.getMass();

      mouseJoint = (MouseJoint) world.createJoint(def);
      hitBody.setAwake(true);
    } else {
      for (Body box : boxes) world.destroyBody(box);
      boxes.clear();
      createBoxes();
    }

    return false;
  }
  public void update(float deltaTime) {
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (OverlapTester.pointInRectangle(playBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new GameScreen(game));
        return;
      }
      if (OverlapTester.pointInRectangle(highscoresBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new HighscoresScreen(game));
        return;
      }
      if (OverlapTester.pointInRectangle(helpBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new HelpScreen(game));
        return;
      }
      if (OverlapTester.pointInRectangle(soundBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        Settings.soundEnabled = !Settings.soundEnabled;
        if (Settings.soundEnabled) Assets.music.play();
        else Assets.music.pause();
      }
    }
  }
Beispiel #6
0
  private void updateRunning(float deltaTime) {
    switch (world.state) {
      case World.WORLD_STATE_RUNNING:
        if (Gdx.input.justTouched()) {
          if (shots > 0) {
            guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
            Assets.shoot.play();
            shots--;
          }
        }
        break;
      case World.WORLD_STATE_ROUND_PAUSE:
        stateTime = 0;
        shots = 3;
        break;
      case World.WORLD_STATE_COUNTING_DUCKS:
        stateTime = 0;
        break;
      case World.WORLD_STATE_ROUND_START:
        state = GAME_READY;
        break;
      case World.WORLD_STATE_GAME_OVER_1:
        stateTime = 0;
        state = GAME_OVER_1;
        Assets.gameOver1.play();
        break;
    }
    // ApplicationType appType = Gdx.app.getType();

    /*
     * Input code
     */
    updateScore();
  }
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub

    if (Gdx.input.justTouched()) {
      guiCam.unproject(touch.set(Gdx.input.getX(), Gdx.input.getY(), 0));
      if (startbutton.contains(touch)) {
        maingame.setScreen(maingame.mainscene);
        return;
      }
    }

    GL10 gl = Gdx.graphics.getGL10();
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    /*
     * Actualiza los parametros de la camara
     * y los enlaza al objeto de renderizado batcher
     * */
    guiCam.update();
    this.batcher.setProjectionMatrix(this.guiCam.combined);
    /*
     * Desactiva las trasnparencias
     * */
    batcher.disableBlending();
    batcher.begin();
    batcher.draw(Assets.background, 0, 0, 10, 15);
    batcher.end();
    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.title, 1, 6, 8, 8);
    batcher.draw(Assets.start, x, 3, 6, 3);
    x += c;
    batcher.end();
  }
Beispiel #8
0
  @Override
  public void render() {
    // clear the screen with a dark blue color. The
    // arguments to glClearColor are the red, green
    // blue and alpha component in the range [0,1]
    // of the color to be used to clear the screen.
    Gdx.gl.glClearColor(0, 0, 0.2f, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    // tell the camera to update its matrices.
    camera.update();

    // tell the SpriteBatch to render in the
    // coordinate system specified by the camera.
    batch.setProjectionMatrix(camera.combined);

    // begin a new batch and draw the bucket and
    // all drops
    batch.begin();
    batch.draw(bucketImage, bucket.x, bucket.y);
    for (Rectangle raindrop : raindrops) {
      batch.draw(dropImage, raindrop.x, raindrop.y);
    }
    batch.end();
    //

    // process user input
    if (Gdx.input.isTouched()) {
      Vector3 touchPos = new Vector3();
      touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
      camera.unproject(touchPos);
      bucket.x = touchPos.x - 48 / 2;
    }
    if (Gdx.input.isKeyPressed(Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();
    if (Gdx.input.isKeyPressed(Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();

    // make sure the bucket stays within the screen bounds
    if (bucket.x < 0) bucket.x = 0;
    if (bucket.x > 800 - 48) bucket.x = 800 - 48;

    // commit

    // check if we need to create a new raindrop
    if (TimeUtils.nanoTime() - lastDropTime > 1000000000) spawnRaindrop();

    // move the raindrops, remove any that are beneath the bottom edge of
    // the screen or that hit the bucket. In the later case we play back
    // a sound effect as well.
    Iterator<Rectangle> iter = raindrops.iterator();
    while (iter.hasNext()) {
      Rectangle raindrop = iter.next();
      raindrop.y -= 200 * Gdx.graphics.getDeltaTime();
      if (raindrop.y + 48 < 0) iter.remove();
      if (raindrop.overlaps(bucket)) {
        dropSound.play();
        iter.remove();
      }
    }
  }
 @Override
 public boolean touchDragged(int screenX, int screenY, int pointer) {
   mCurrentPos.set(screenX, screenY, 0);
   camera.unproject(mCurrentPos);
   camera.position.sub(mCurrentPos.sub(mCamPos));
   camera.update();
   return true;
 }
Beispiel #10
0
 /**
  * Helper function to deal with the fact that unproject expects coordinates with positive y
  * pointing down.
  */
 private Vector2 myUnproject(OrthographicCamera camera, float x, float y) {
   Vector3 raw =
       camera.unproject(
           new Vector3(x, y + overviewCamera.viewportHeight - camera.viewportHeight, 0),
           0,
           0,
           camera.viewportWidth,
           camera.viewportHeight);
   return new Vector2(raw.x, raw.y);
 }
  public void update() {
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (nextBounds.contains(touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new MainMenuScreen(game));
      }
    }
  }
Beispiel #12
0
 @Override
 public boolean touchDragged(int x, int y, int pointer) {
   // if a mouse joint exists we simply update
   // the target of the joint based on the new
   // mouse coordinates
   if (mouseJoint != null) {
     camera.unproject(testPoint.set(x, y, 0));
     mouseJoint.setTarget(target.set(testPoint.x, testPoint.y));
   }
   return false;
 }
Beispiel #13
0
  public void update(float deltaTime) {
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (OverlapTester.pointInRectangle(nextBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
  public void spawnOrb(int x, int y) {
    Vector3 touchPos = new Vector3();
    touchPos.set(x, y, 0);
    camera.unproject(touchPos);

    Orb orb =
        new Orb(new Vector2(touchPos.x, touchPos.y), 10f, new Color(0.4f, 0.6f, .09f, 1.0f), this);
    orbs.add(orb);

    Gdx.app.log("LOG", "Orb Spawned at: (" + touchPos.x + ", " + touchPos.y + ")!");
  }
  private void updatePaused() {

    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (MainMenuScreen.pointInRectangle(pauseBounds, touchPoint.x, touchPoint.y)) {

        state = GAME_RUNNING;
        return;
      }
    }
  }
 @Override
 public boolean touchDown(int screenX, int screenY, int pointer, int button) {
   // ignore if its not left mouse button or first touch pointer
   if (button != Input.Buttons.LEFT || pointer > 0) return false;
   // camera.unproject(tp.set(screenX, screenY, 0));
   // System.out.println("ScreenX: " + screenX + "    ScreenY: " + screenY);
   camera.unproject(tp.set(screenX, screenY, 0));
   // System.out.println("UnProject ScreenX: " + tp.x + "    UnProject ScreenY: " + tp.y);
   clickedPartX = screenX;
   clickedPartY = screenY;
   touchedDown = true;
   return true;
 }
  @Override
  public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    if (button != Input.Buttons.LEFT || pointer > 0) return false;
    camera.unproject(tp.set(screenX, screenY, 0));

    if (touchedDown && !dragging) {
      touchedDown = false;
      worldManager.checkForTouch(tp.x, tp.y);
    }

    dragging = false;
    touchedDown = false;
    return true;
  }
Beispiel #18
0
  @Override
  public void render() {

    Gdx.gl.glClearColor(0, 0, 0.2f, 1);

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();

    batch.setProjectionMatrix(camera.combined);

    batch.begin();
    batch.draw(bucketImage, bucket.x, bucket.y);

    for (Rectangle raindrop : raindrops) {
      batch.draw(dropImage, raindrop.x, raindrop.y);
    }

    batch.end();

    if (Gdx.input.isTouched()) {
      Vector3 touchPos = new Vector3();
      touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
      camera.unproject(touchPos);
      bucket.x = touchPos.x - 64 / 2;
    }
    if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();
    if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();

    // make sure the bucket stays within the screen bounds
    if (bucket.x < 0) bucket.x = 0;
    if (bucket.x > 800 - 64) bucket.x = 800 - 64;

    if (TimeUtils.nanoTime() - lastDropTime > 1000000000) {
      spawnRaindrop();
    }

    Iterator<Rectangle> iter = raindrops.iterator();
    while (iter.hasNext()) {
      Rectangle raindrop = iter.next();
      raindrop.y -= 200 * Gdx.graphics.getDeltaTime();
      if (raindrop.y + 64 < 0) iter.remove();
      if (raindrop.overlaps(bucket)) {
        dropSound.play();
        iter.remove();
      }
    }
  }
Beispiel #19
0
  private void updatePaused() {
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (OverlapTester.pointInRectangle(resumeBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        state = GAME_RUNNING;
        return;
      }

      if (OverlapTester.pointInRectangle(quitBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
  public void update() {
    if (Gdx.input.isKeyPressed(Input.Keys.BACK)) {
      Gdx.app.exit();
    }
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (startButton.getBoundingRectangle().contains(touchPoint.x, touchPoint.y)) {
        game.setScreen(new StartGameScreen(game));
        return;
      }

      if (creditsButton.getBoundingRectangle().contains(touchPoint.x, touchPoint.y)) {
        game.setScreen(new CreditsScreen(game));
        return;
      }
    }
  }
Beispiel #21
0
  private void updateRunning(float deltaTime) {
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
      world.ShotProjectile();
      if (OverlapTester.pointInRectangle(pauseBounds, touchPoint.x, touchPoint.y)) {
        Assets.playSound(Assets.clickSound);
        state = GAME_PAUSED;
        return;
      } else if (Bob.BOB_DOUBLE_JUMP == false) {
        if (Bob.jumpTime > 0.8f) {
          Bob.BOB_DOUBLE_JUMP = true;
          Bob.jumpTime = 0f;
        }
      }
    }

    ApplicationType appType = Gdx.app.getType();
    // should work also with Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer)
    if (appType == ApplicationType.Android || appType == ApplicationType.iOS) {
      world.update(deltaTime, Gdx.input.getAccelerometerX());
    } else {
      float accel = 0;
      if (Gdx.input.isKeyPressed(Keys.DPAD_LEFT)) accel = 5f;
      if (Gdx.input.isKeyPressed(Keys.DPAD_RIGHT)) accel = -5f;
      world.update(deltaTime, accel);
    }
    if (world.score != lastScore) {
      lastScore = world.score;
      scoreString = "SCORE: " + lastScore;
    }
    if (world.state == World.GAME_LEVEL_END) {
      state = GAME_LEVEL_END;
    }
    if (world.state == World.GAME_OVER) {
      state = GAME_OVER;
      if (lastScore >= Settings.highscores[4]) scoreString = "NEW HIGHSCORE: " + lastScore;
      else scoreString = "SCORE: " + lastScore;
      Settings.addScore(lastScore);
      Settings.save();
    }
  }
        @Override
        public boolean touchDown(int x, int y, int pointer, int button) {
          Vector3 v = new Vector3(x, y, 0);
          camera.unproject(v);

          draggedSprite = null;

          Sprite[] sprites = new Sprite[] {powered, gdx};
          for (Sprite sp : sprites) {
            if (sp.getX() <= v.x
                && v.x <= sp.getX() + sp.getWidth()
                && sp.getY() <= v.y
                && v.y <= sp.getY() + sp.getHeight()) {
              draggedSprite = sp;
              break;
            }
          }

          lastX = x;
          lastY = y;
          return true;
        }
  @Override
  public void render() {
    Gdx.gl.glClearColor(0, 0, 0.2f, 1);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // tell the camera to update its matrices.

    updateCamera();

    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render();

    if (Gdx.input.isTouched()) {
      final Vector3 touchPos = new Vector3();
      touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
      camera.unproject(touchPos);
      targetPos.x = touchPos.x - sprite.getWidth() / 2;
      targetPos.y = touchPos.y - sprite.getHeight() / 2;
    }

    updateTargetPosition();
  }
Beispiel #24
0
 public static Vector2 getUnprojectedTouchpointPosition(int index) {
   Vector3 unprojected = new Vector3(Gdx.input.getX(index), Gdx.input.getY(index), 1);
   CAM.unproject(unprojected);
   return new Vector2(unprojected.x, unprojected.y);
 }
 @Override
 public boolean touchDown(int screenX, int screenY, int pointer, int button) {
   mCamPos.set(screenX, screenY, 0);
   camera.unproject(mCamPos);
   return true;
 }
  private void updateRunning() {
    float accel = 0;
    if (Gdx.input.justTouched()) {
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (MainMenuScreen.pointInRectangle(pauseBounds, touchPoint.x, touchPoint.y)) {
        state = GAME_PAUSED;
        return;
      }

      if (MainMenuScreen.pointInRectangle(upBounds, touchPoint.x, touchPoint.y)
              && MainMenuScreen.pointInRectangle(upBounds, touchPoint.x, touchPoint.y)
              && world.thePlayer.onGround
          || MainMenuScreen.pointInRectangle(upBounds, touchPoint.x, touchPoint.y)
              && world.thePlayer.position.y == 0) {

        world.listener.jump();
        world.thePlayer.currentState = Player.PLAYER_JUMPING;
        world.thePlayer.velocity.y = Player.JUMP_VELOCITY;
      }
    }

    if (Gdx.input.isTouched()) {

      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (MainMenuScreen.pointInRectangle(leftBounds, touchPoint.x, touchPoint.y)) {
        accel = 5f;
        world.thePlayer.currentState = Player.PLAYER_WALKING;
      }
      guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));

      if (MainMenuScreen.pointInRectangle(rightBounds, touchPoint.x, touchPoint.y)) {
        accel = -5f;
        world.thePlayer.currentState = Player.PLAYER_WALKING;
      }
    }

    if (!(world.thePlayer.currentState == Player.PLAYER_ATTACKING)) {
      if (Gdx.input.isKeyPressed(Keys.A)) {

        accel = 5f;
        world.thePlayer.currentState = Player.PLAYER_WALKING;
      }
      if (Gdx.input.isKeyPressed(Keys.D)) {

        accel = -5f;
        world.thePlayer.currentState = Player.PLAYER_WALKING;
      }
      if (Gdx.input.isKeyPressed(Keys.SPACE) && world.thePlayer.onGround
          || Gdx.input.isKeyPressed(Keys.SPACE) && world.thePlayer.position.y == 0) {

        world.listener.jump();
        world.thePlayer.currentState = Player.PLAYER_JUMPING;
        world.thePlayer.velocity.y = Player.JUMP_VELOCITY;

      } else if (accel == 0f) {

        world.thePlayer.currentState = Player.PLAYER_IDLE;
      }
    }

    if (Gdx.input.isKeyPressed(Keys.X)
        && this.slashCooldown > 0.5f
        && this.world.thePlayer.currentState != Player.PLAYER_ATTACKING) {

      this.world.thePlayer.currentState = Player.PLAYER_ATTACKING;
      this.world.thePlayer.attackWithSword();
      this.slashCooldown = 0f;
    } else this.slashCooldown += Gdx.graphics.getDeltaTime();

    for (int i : world.skillsOnBar.keySet()) {

      Skill s = world.skillsOnBar.get(i);
      if (Gdx.input.isKeyPressed(i) && !s.coolDown.isOnCooldown) {

        s.execute(world.thePlayer);
      }
    }

    if (Gdx.input.isKeyPressed(Keys.A)) {

      accel = 5f;
    }
    if (Gdx.input.isKeyPressed(Keys.D)) {

      accel = -5f;
    }

    world.update(Gdx.graphics.getDeltaTime(), accel);
  }
Beispiel #27
0
  @Override
  public void render(float delta) {
    // clear the screen with a dark blue color. The
    // arguments to glClearColor are the red, green
    // blue and alpha component in the range [0,1]
    // of the color to be used to clear the screen.
    Gdx.gl.glClearColor(0, 0, 0.2f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // tell the camera to update its matrices.
    camera.update();

    // tell the SpriteBatch to render in the
    // coordinate system specified by the camera.
    game.batch.setProjectionMatrix(camera.combined);

    // Implement pause/resume
    if (Gdx.input.isKeyJustPressed(Keys.ESCAPE)) {
      if (state == State.RUN) {
        setGameState(State.PAUSE);
      } else {
        setGameState(State.RUN);
      }
    }

    // begin a new batch and draw the bucket and
    // all drops
    game.batch.begin();
    game.font.draw(game.batch, "Drops Collected: " + dropsGathered, 0, 480);
    game.batch.draw(bucketImage, bucket.x, bucket.y);
    for (Rectangle raindrop : raindrops) {
      game.batch.draw(dropImage, raindrop.x, raindrop.y);
    }
    game.batch.end();

    // Implement pause/resume
    switch (state) {
      case RUN:
        // process user input
        if (Gdx.input.isTouched()) {
          Vector3 touchPos = new Vector3();
          touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
          camera.unproject(touchPos);
          bucket.x = touchPos.x - 64 / 2;
        }
        if (Gdx.input.isKeyPressed(Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();
        if (Gdx.input.isKeyPressed(Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();

        // make sure the bucket stays within the screen bounds
        if (bucket.x < 0) bucket.x = 0;
        if (bucket.x > 800 - 64) bucket.x = 800 - 64;

        // check if we need to create a new raindrop
        if (TimeUtils.nanoTime() - lastDropTime > 1000000000) spawnRaindrop();

        // move the raindrops, remove any that are beneath the bottom edge of
        // the screen or that hit the bucket. In the later case we increase the
        // value our drops counter and add a sound effect.
        Iterator<Rectangle> iter = raindrops.iterator();
        while (iter.hasNext()) {
          Rectangle raindrop = iter.next();
          raindrop.y -= 200 * Gdx.graphics.getDeltaTime();
          if (raindrop.y + 64 < 0) iter.remove();
          if (raindrop.overlaps(bucket)) {
            dropsGathered++;
            dropSound.play();
            iter.remove();
          }
        }
        break;

      case PAUSE:
        break;
    } // end switch
  }
 /**
  * Renders specific layers in the given a camera.
  *
  * @param cam The camera to use
  * @param layers The list of layers to draw, 0 being the lowest layer. You will get an
  *     IndexOutOfBoundsException if a layer number is too high.
  */
 public void render(OrthographicCamera cam, int[] layers) {
   getProjectionMatrix().set(cam.combined);
   tmp.set(0, 0, 0);
   cam.unproject(tmp);
   render(tmp.x, tmp.y, cam.viewportWidth * cam.zoom, cam.viewportHeight * cam.zoom, layers);
 }
Beispiel #29
0
 /** changes coordinates from screen to game units */
 @Override
 public Actor hit(float x, float y, boolean touchable) {
   v3.set(x, screenH - y, 0f);
   cam.unproject(v3);
   return super.hit(v3.x, v3.y, touchable);
 }
Beispiel #30
0
 @Override
 public boolean touchDragged(int screenX, int screenY, int pointer) {
   unprojected = camera.unproject(new Vector3(screenX, screenY, 0));
   return super.touchDragged(screenX, screenY, pointer);
 }