Example #1
0
 public Paddle(PlayingField fieldPtr, Point initialPosition, Velocity initialVelocity) {
   super(fieldPtr, initialPosition, initialVelocity);
   _theView = ((BricklesPlayingField) _fieldPtr).getView();
   _bitmap = _theView.getImage(_theView.getCodeBase(), "images/paddle.gif");
   if (_bitmap == null) _theView.showStatus("BitMap not loaded");
   _extent = new Dimension(60, 20);
   _leadingPoint = new Point(_currentPosition.x, _currentPosition.y);
   newLeadingPoint();
   _boundingBox = new Rectangle(_currentPosition, _extent);
 }
Example #2
0
 public void move() {
   if (_currentPosition.x + _extent.width >= _theView.getFieldWidth())
     _currentPosition.x = _theView.getFieldWidth() - _extent.width;
   _boundingBox = new Rectangle(_currentPosition, _extent);
   newLeadingPoint();
 }