CoordinateVector
Package: Libraries.Game.Graphics.Fonts · Inherits from: Libraries.Language.Object
The CoordinateVector class is used to store information about x/y coordinate pairs, including their position, whether or not they are on the curve, and if they are endpoints.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame()
CoordinateVector vector
vector:SetX(0)
vector:SetY(1)
output "x: " + vector:GetX() + ", y: " + vector:GetY()
end
end
Actions
AddNewPointRelativeToLast(integer changeInX, integer changeInY, boolean onCurve, boolean endpoint)
This action changes the vector's coordinates based on the change in x and y for a given line.
Parameters
changeInXinteger: The rate of change along the x-axis.changeInYinteger: The rate of change along the y-axis.onCurveboolean: Whether or not this point is on the curve.endpointboolean
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame()
CoordinateVector vector
vector:AddNewPointRelativeToLast(1, 2, true, false)
end
end
Copy(Libraries.Game.Graphics.Fonts.CoordinateVector vector)
This action makes a copy of a given vector.
Parameters
vectorLibraries.Game.Graphics.Fonts.CoordinateVector: The vector to be copied.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector1
CoordinateVector vector2
vector1:SetX(1)
vector1:SetY(1)
vector2:Copy(vector1)
output vector2:GetX()
end
end
GetX()
This action returns the x position of the vector.
Returns
integer: Returns the x position of the vector.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
output vector:GetX()
end
end
GetY()
This action returns the y position of the vector.
Returns
integer: Returns the y position of the vector.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
output vector:GetY()
end
end
IsComputed()
This action checks whether or not this vector has had its coordinates computed.
Returns
boolean: Returns true if the vector has been computed, and false
if it has not been.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
output vector:IsComputed()
end
end
IsEndpoint()
This action checks whether or not this vector is an endpoint of the curve.
Returns
boolean: Returns true if the vector is an endpoint of the curve,
and false if it is not.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
output vector:IsEndpoint()
end
end
IsOnCurve()
This action returns whether or not the vector is on the outline curve.
Returns
boolean: Returns true if the vector is on the curve, and false if
it is not.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame()
CoordinateVector vector
output vector:IsOnCurve()
end
end
SetComputed(boolean computed)
This action sets whether or not this vector has had its coordinates computed.
Parameters
computedboolean: True if the vector has been computed, and false if it has not been.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
vector:SetComputed(false)
end
end
SetEndpoint(boolean endpoint)
This action sets whether or not this vector is an endpoint of the curve.
Parameters
endpointboolean: True if the vector is an endpoint, and false if it is not.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
vector:SetEndpoint(true)
end
end
SetOnCurve(boolean onCurve)
This action sets whether or not this vector is on the outline curve.
Parameters
onCurveboolean: True is the vector is on the curve, false if it is not.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
vector:SetOnCurve(true)
output vector:IsOnCurve()
end
end
SetX(integer x)
This action sets the x position of the vector.
Parameters
xinteger: The x position of the vector.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
vector:SetX(1)
output vector:GetX()
end
end
SetY(integer y)
This action sets the y position of the vector.
Parameters
yinteger: The y position of the vector.
Example
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
CoordinateVector vector
vector:SetY(1)
output vector:GetY()
end
end