コード例 #1
0
ファイル: Oneup.java プロジェクト: f1swati/Minion-Master-Game
  private void checkHit() {
    AllMinionState m = (AllMinionState) getOneIntersectingObject(AllMinionState.class);
    SWorld sWorld = (SWorld) getWorld();

    if (m != null) {
      oneUpSound.play();
      CollectPoints cp = new CollectPoints();
      cp.collectLives(1);
      if (getWorld() instanceof MyWorld) {
        MyWorld myWorld = (MyWorld) sWorld;
        myWorld.updatePointScoreboard();
      }
      getWorld().removeObject(this);
    }
  }
コード例 #2
0
ファイル: Fred.java プロジェクト: Chidiemeh184/CSCC_classes
  /** Check whether a hand (of any user) touches the radio. Play radio if it does. */
  public void checkHands() {
    MyWorld world = (MyWorld) getWorld();
    UserData[] users = world.getTrackedUsers();

    for (UserData user : users) {
      Joint rightHand = user.getJoint(Joint.RIGHT_HAND);
      Radio radio = getRadio(rightHand.getX(), rightHand.getY());

      if (radio != null) { // yes, there was a radio
        radio.play(1);
      } else {
        Joint leftHand = user.getJoint(Joint.LEFT_HAND);
        radio = getRadio(leftHand.getX(), leftHand.getY());
        if (radio != null) {
          radio.play(2);
        }
      }
    }
  }