Uses of Class
org.openpatch.scratch.Vector2
Packages that use Vector2
Package
Description
The org.openpatch.scratch package contains classes that provide an API for creating Scratch-like
projects in Java.
Provides classes and interfaces for camera extensions in Scratch.
Provides classes and interfaces for shader extensions in Scratch.
-
Uses of Vector2 in org.openpatch.scratch
Methods in org.openpatch.scratch that return Vector2Modifier and TypeMethodDescriptionAdds another vector and returns the resultVector2.clone()Creates a clone of the vectorstatic Vector2Vector2.fromPolar(double magnitude, double angle) Constructor method for constructing a vector based on polar coordinates.Sprite.getMouse()Retrieves the current position of the mouse cursor.Stage.getMouse()Returns the current position of the mouse cursor as a Vector2Sprite.getPosition()Retrieves the current position of the sprite.Text.getPosition()Retrieves the current position as a Vector2 object.Vector2.multiply(double scalar) Multiplies a scalar and return the result.Vector2.normalVector()Returns the normal vector, which is perpendicular to the vector.static Vector2Random.randomPosition()Returns a random position with respect to the width of the window.static Vector2Random.randomVector2()Returns a random unit vectorVector2.reverse()Reverses a vector and returns the result.Vector2.rotateBy(double angle) Rotates the vector by an angle and returns the result.Vector2.rotateTo(double angle) Rotates the vector to a given angle and returns the result.Substracts another vector and returns the resultVector2.unitVector()Returns the unit vector.Methods in org.openpatch.scratch with parameters of type Vector2Modifier and TypeMethodDescriptionAdds another vector and returns the resultvoidSprite.changePosition(Vector2 v) Changes the position of the sprite by a given vector.doubleCalculates the distance to another vector.doubleVector2.distanceSq(Vector2 v) Calculates the squared distance to another vector.doubleCalculates the dot product.voidMoves the sprite in the direction of the given vector.voidSprite.pointInDirection(Vector2 v) Points the sprite in the direction of the given vector.voidSprite.setDirection(Vector2 v) Sets the direction of the sprite to the direction of a given vector.voidPen.setPosition(Vector2 v) Sets the position of the pen using a Vector2 object.voidSprite.setPosition(Vector2 v) Sets the position of the sprite based on the coordinates of a given vector.voidText.setPosition(Vector2 v) Sets the position of the text object using a Vector2 object.Substracts another vector and returns the resultConstructors in org.openpatch.scratch with parameters of type Vector2 -
Uses of Vector2 in org.openpatch.scratch.extensions.camera
Methods in org.openpatch.scratch.extensions.camera that return Vector2Modifier and TypeMethodDescriptionCamera.getPosition()Returns the position of the spriteCamera.toGlobalPosition(Vector2 v) Converts local camera coordinates to screen coordinatesCamera.toLocalPosition(Vector2 v) Converts screen coordinates to local camera coordinatesMethods in org.openpatch.scratch.extensions.camera with parameters of type Vector2Modifier and TypeMethodDescriptionvoidCamera.setPosition(Vector2 v) Sets the position of the sprite based on the coordinates of a given vector.Camera.toGlobalPosition(Vector2 v) Converts local camera coordinates to screen coordinatesCamera.toLocalPosition(Vector2 v) Converts screen coordinates to local camera coordinates -
Uses of Vector2 in org.openpatch.scratch.extensions.shader
Methods in org.openpatch.scratch.extensions.shader with parameters of type Vector2