Package ponkOut.logic

Source Code of ponkOut.logic.WallBall

/* Copyright 2010, 2013 Christian Matt
*
* This file is part of PonkOut.
*
* PonkOut is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PonkOut is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PonkOut.  If not, see <http://www.gnu.org/licenses/>.
*/

package ponkOut.logic;

import org.lwjgl.util.vector.Vector2f;

import ponkOut.graphics.GraphicsObjectsManager;
import ponkOut.graphics.Material;

/**
* Ball at the corner of field, which cannot move
*/
public class WallBall extends Ball {
  public enum Place {
    TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
  };

  private Place place;

  public WallBall(Place place, GraphicsObjectsManager goManager) {
    super(Material.getPresetMaterial(Material.PresetMaterial.PEWTER), goManager);

    this.place = place;
    switch (place) {
    case TOP_LEFT:
      setPosition(new Vector2f(-TOP_POS, TOP_POS));
      break;

    case TOP_RIGHT:
      setPosition(new Vector2f(TOP_POS, TOP_POS));
      break;

    case BOTTOM_LEFT:
      setPosition(new Vector2f(-TOP_POS, -TOP_POS));
      break;

    case BOTTOM_RIGHT:
      setPosition(new Vector2f(TOP_POS, -TOP_POS));
      break;
    }
  }

  @Override
  public boolean isMovable() {
    return false;
  }

  @Override
  public boolean isAttached() {
    return false;
  }

  @Override
  public void detach() {
  }

  public Place getPlace() {
    return place;
  }

  @Override
  public Paddle getLastPaddle() {
    return null;
  }

  @Override
  public void setLastPaddle(Paddle paddle) {
  }
}
TOP

Related Classes of ponkOut.logic.WallBall

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.