Ejemplo n.º 1
0
  public Hammer() {
    super();
    final PolygonShape boxShape = new PolygonShape();
    final BodyDef hammerBodyDef = new BodyDef();
    hammerBodyDef.type = BodyDef.BodyType.KinematicBody;
    hammerBodyDef.position.set(0, 0);
    body = world.createBody(hammerBodyDef);
    boxShape.setAsBox(1.5f, 1.5f);
    body.createFixture(boxShape, 0);
    boxShape.dispose();

    // setup animation
    final Assets assets = Locator.getAssets();
    final SkeletonData skeletonData = assets.getSkeletonData(Assets.Animations.OBST_HAMMER);
    skeleton = new Skeleton(skeletonData);
    animation = skeletonData.findAnimation("trigger");
    animationState =
        new AnimationState(assets.getAnimationStateData(Assets.Animations.OBST_HAMMER));
    animationState.addListener(
        new AnimationState.AnimationStateListener() {
          @Override
          public void start(int trackIndex) {}

          @Override
          public void event(int trackIndex, Event event) {
            if (event.getData().getName().equals("smashed")) {
              if (isBloodied) {
                skeleton.setAttachment("obst_hammer", "hammer_hammer_bloodied");
              }
            }
          }

          @Override
          public void end(int trackIndex) {}

          @Override
          public void complete(int trackIndex, int loopCount) {}
        });

    bone = getBone(skeleton, SLOT_NAME);
  }
 public ContactDispatcher() {
   events = Locator.getEvents();
   playerContactPool = new PlayerContactPool();
 }
Ejemplo n.º 3
0
 public EndPoint(Pool pool) {
   this.world = Locator.getWorld();
   this.pool = pool;
 }
Ejemplo n.º 4
0
 @Override
 public void execute(boolean bloodied) {
   super.execute(bloodied);
   Locator.getEvents().queueEvent(EventType.PLAY_SOUND, SoundManager.HAMMER);
 }