vooga.gameEngine.item
Interface Tangible

All Known Subinterfaces:
Collidable<T>, Renderable, Scriptable
All Known Implementing Classes:
AIDemoItem, AIDemoText, Alien, Ball, Ball, Ball, Barrier, Barrier, Block, Bomb, BoundedItem, Box, CameraController, CameraRectangle, Character, EnemyShip, Explosion, GameItem, ImageObstacle, InfoBar, KeyMovingCameraController, Laser, LookButNoTouchCharacter, MenuScreen, Missle, MissleLauncher, Paddle, PaddleLeft, PaddleRight, PhysicalItem, PlacedText, Platform, PongItem, Powerup, Projectile, ReducePaddlePowerup, RobotUnicorn, Ship, StaticItem, TerrainPiece, TestGameItem, TestSquare, UFO, UnicornCamera, Weapon, Worm, WormsCameraController

public interface Tangible

Represents an item that has a Position, Dimension, and Rotation2D. Useful for making a BoundedItem.

Author:
Justin C. Klaassen

Method Summary
 Position getPosition()
          Getter method for the current position of this item in the coordinate system used by the game.
 Rotation2D getRotation()
          Getter method for the current rotation of this item in the coordinate system used by the game.
 java.awt.Shape getShape()
          Method for getting a Shape representing the area that can be rendered on screen.
 Dimension getSize()
          Getter method for the current dimension of this item in the coordinate system used by the game.
 void move(double dx, double dy)
          Moves this object dx to the right and dy up, which is relative to the in game coordinate system.
 void resize(double dx, double dy)
          Change's the size of this object dx in width and dy in height, which is relative to the in game coordinate system.
 void rotate(double dtheta)
          Rotates this object dtheta clockwise, which is relative to the Position defined the existing Rotation2D associated with this object.
 void setPosition(Position p)
          Moves this object to a specified Position.
 void setRotation(Rotation2D r)
          Changes this object's rotation to the specified Rotation2D.
 void setSize(Dimension d)
          Changes this object's size to a specified Dimension.
 

Method Detail

getPosition

Position getPosition()
Getter method for the current position of this item in the coordinate system used by the game.

Returns:
a copy of the Position representing current position

getSize

Dimension getSize()
Getter method for the current dimension of this item in the coordinate system used by the game.

Returns:
a copy of the Dimension representing current size

getRotation

Rotation2D getRotation()
Getter method for the current rotation of this item in the coordinate system used by the game.

Returns:
a copy of the Rotation2D representing current rotation

move

void move(double dx,
          double dy)
Moves this object dx to the right and dy up, which is relative to the in game coordinate system. A negative dx corresponds to moving left, and a negative dy corresponds to moving down. Fires a PositionChangedEvent when called.

Parameters:
dx - the change in the x-axis
dy - the change in the y-axis

setPosition

void setPosition(Position p)
Moves this object to a specified Position. Fires a PositionChangedEvent when called.

Parameters:
p - new position of the object (top left corner)

rotate

void rotate(double dtheta)
Rotates this object dtheta clockwise, which is relative to the Position defined the existing Rotation2D associated with this object. Fires a RotationChangedEvent when called.

Parameters:
dtheta - is the angle to rotate the object in radians

setRotation

void setRotation(Rotation2D r)
Changes this object's rotation to the specified Rotation2D. Fires a RotationChangedEvent when called.

Parameters:
r - is new rotation of the object

resize

void resize(double dx,
            double dy)
Change's the size of this object dx in width and dy in height, which is relative to the in game coordinate system. Fires a SizeChangedEvent when called.

Parameters:
dx - the change in the width
dy - the change in the height

setSize

void setSize(Dimension d)
Changes this object's size to a specified Dimension. Fires a SizeChangedEvent when called.

Parameters:
d - is new dimension of the object in the game's coordinate system

getShape

java.awt.Shape getShape()
Method for getting a Shape representing the area that can be rendered on screen.

Returns:
the shape of the object