Ejemplo n.º 1
0
  @Override
  public void update(long currentFrame) {

    // Check for moving
    if (!_myState.moving) {
      // Check for destroy
      if (_animation.isStopped()) {
        _level.getLogicManager().detachLogic(this);
      }

      return;
    }

    super.update(currentFrame);

    // Check for squash grunts / spiders
    for (CellLogic cell : _level.getCellManager().getCollisionsWith(this, 16, currentFrame)) {

      // Check for grunt
      try {
        Grunt grunt = (Grunt) cell;
        grunt.getBehaviour().exit("Squash");
      } catch (Exception e) {
      }

      // Check for spider
      try {
        Spider spider = (Spider) cell;
        spider.squash(currentFrame);
      } catch (Exception e) {
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public void init(Pair xy, TreeMap<String, String> props) {
    super.init(xy, props);

    _skin = props.get("skin");

    // Load the skin for the ball in the direction
    _animation =
        ResourceLoader.getAnimationForPath("ballz/" + _skin + _myState.direction.toString());
  }
Ejemplo n.º 3
0
  @Override
  public void stateRestore(State state) {

    super.stateRestore(state);

    _myState = (RollingBallState) _state;

    // Set animation
    if (_myState.motion == RollingBallMotion.Rolling)
      // Load the skin for the ball in the direction
      _animation =
          ResourceLoader.getAnimationForPath("ballz/" + _skin + _myState.direction.toString());
    else if (_myState.motion == RollingBallMotion.Sinking)
      _animation = ResourceLoader.getAnimationForPath("ballz/" + _skin + "Sink");
    else if (_myState.motion == RollingBallMotion.Smashing)
      _animation = ResourceLoader.getAnimationForPath("ballz/" + _skin + "Smash");
  }