MovingObject

o1.world.objects.mutable$.MovingObject

A supertype for objects that have a mutable position and a velocity in two-dimensional space.

Attributes

Graph
Supertypes
trait MutablePos
trait HasVelocity
trait HasPos
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def moveAlong(): Unit

Causes the object’s pos to change: the object moves from its current location at its current velocity for one unit of time. That is, the dx and dy components of the velocity are added to the object’s pos.

Causes the object’s pos to change: the object moves from its current location at its current velocity for one unit of time. That is, the dx and dy components of the velocity are added to the object’s pos.

Attributes

Causes the object’s pos to change: the object moves from its current location at its current velocity for one unit of time (as per moveAlong) and is then immediately clamped to fit within the bounds of the given object (as per Pos.clamp).

Causes the object’s pos to change: the object moves from its current location at its current velocity for one unit of time (as per moveAlong) and is then immediately clamped to fit within the bounds of the given object (as per Pos.clamp).

Attributes

Inherited methods

Determines the distance (“as the crow flies”) between this object’s pos and that of the given object.

Determines the distance (“as the crow flies”) between this object’s pos and that of the given object.

Attributes

Inherited from:
HasPos

Determines whether this object is bound for roughly the given direction, as per Direction.sharesQuadrant.

Determines whether this object is bound for roughly the given direction, as per Direction.sharesQuadrant.

Attributes

Inherited from:
HasVelocity

Determines whether this object has a downward velocity, as per Direction.isDownward.

Determines whether this object has a downward velocity, as per Direction.isDownward.

Attributes

Inherited from:
HasVelocity

Determines whether this object has a leftward velocity, as per Direction.isLeftward.

Determines whether this object has a leftward velocity, as per Direction.isLeftward.

Attributes

Inherited from:
HasVelocity

Determines whether this object has a rightward velocity, as per Direction.isRightward.

Determines whether this object has a rightward velocity, as per Direction.isRightward.

Attributes

Inherited from:
HasVelocity

Determines whether this object has an upward velocity, as per Direction.isUpward.

Determines whether this object has an upward velocity, as per Direction.isUpward.

Attributes

Inherited from:
HasVelocity
def nextPos: Pos

Returns the Pos that this object, moving from its current location at its current velocity, reaches in one unit of time. That is, adds the dx and dy components of the velocity to the current Pos and returns the result.

Returns the Pos that this object, moving from its current location at its current velocity, reaches in one unit of time. That is, adds the dx and dy components of the velocity to the current Pos and returns the result.

Attributes

Inherited from:
HasVelocity

the object’s velocity

the object’s velocity

Attributes

Inherited from:
HasVelocity

Inherited fields

var pos: Pos

the object’s location

the object’s location

Attributes

Inherited from:
MutablePos