object Direction extends Serializable
This companion object of class Direction provides some constants of type Direction
and methods for creating new Direction instances.
The object has an alias in the top-level package o1, so it’s accessible to students
simply via import o1._.
- Alphabetic
- By Inheritance
- Direction
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val Down: Direction
the “straight downwards” direction with a
dxof zero, and adyof +1 - val Left: Direction
the “straight leftwards” direction with a
dxof -1, and adyof zero - val NoDirection: Direction { val toString: String }
a “non-direction” whose
dxanddyare both zero - val Right: Direction
the “straight rightwards” direction with a
dxof +1, and adyof zero - val Up: Direction
the “straight upwards” direction with a
dxof zero, and adyof -1 - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fromArrowKey(key: Key): Option[Direction]
Returns the Direction that corresponds to the given arrow key.
- def fromDegrees(angle: Double): Direction
Takes in an angle as degrees and returns the corresponding Direction.
Takes in an angle as degrees and returns the corresponding Direction. Zero degrees points rightwards; positive angles are counterclockwise from there, negative ones clockwise.
- def fromDeltas(dx: Double, dy: Double): Direction
Takes in a difference between x coordinates and a difference between y coordinates and constructs a Direction from them.
Takes in a difference between x coordinates and a difference between y coordinates and constructs a Direction from them.
- dx
a difference between two x coordinates; it is not necessary that this is normalized between -1.0 and +1.0 like the
dxanddyof the resulting Direction object- dy
a difference between two x coordinates; it is not necessary that this is normalized between -1.0 and +1.0 like the
dxanddyof the resulting Direction object- returns
the Direction that corresponds to the given deltas. If both are exactly equal to zero, returns NoDirection.
- def fromKey(key: Key): Option[Direction]
Returns the Direction that corresponds to the given arrow key.
- def fromRadians(angle: Double): Direction
Takes in an angle as radians and returns the corresponding Direction.
Takes in an angle as radians and returns the corresponding Direction. Zero radians points rightwards; positive angles are counterclockwise from there, negative ones clockwise.
- def fromWASD(key: Key): Option[Direction]
Returns the Direction that corresponds to the given WASD key.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def random(): Direction
Returns a randomly chosen direction (evenly distributed over 360 degrees).
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.