Kree Documentation
  • Welcome to Kree Java
  • Changelog
  • Getting Started
    • Installing Kree
    • Installing Kree using CLI
    • Get Help on Discord
  • Core Components
    • Game
    • Window
    • SceneManager
    • Input
    • Debug
    • Sprite
    • GameObject
    • Transform
    • Vector2
    • SpriteSheet
    • Animation
    • Audio
    • Random
  • GameObject components
    • Animator
    • BoxCollider
    • LookAtObject
    • Mesh Renderer
    • ParticleSystem
    • RigidBody
    • SpriteRenderer
    • PlayerMovement
    • Prefs
  • Kree User Interface
    • Text
    • TextInput
    • ProgressBar
    • Button
    • Panel
  • Code Snippets
    • Launcher
    • Creating Scene
    • Follow Mouse On Click
    • Animating GameObject
    • Implementing Particle System
    • Creating Custom Components
    • Playing Audio
  • Game Tutorials
  • Avoid the Enemy!
  • High score
Powered by GitBook
On this page

Was this helpful?

  1. Core Components

Vector2

This component contains two points x and y

PreviousTransformNextSpriteSheet

Last updated 4 years ago

Was this helpful?

Component Author: Release Date: April 11, 2020

new Vector2(float x, float y);
static distance(Vector2 v1, Vector2 v2); // Returns the distance between two vector

// Vector2 Math
add(Vector2 vec); // Add to another vector

subtract(Vector2 vec); // Add to another vector

multiply(Vector2 vec); // Add to another vector

divide(Vector2 vec); // Add to another vector

// Math
addX(float n); // Add n to Vector2's X

subtractX(float n); // Subtract n to Vector2's X

addY(float n); // Add n to Vector2's Y

subtractY(float n); // Subtract n to Vector2's Y

// Misc
moveTowards(Vector2 target, float speed); // Move towards a Vector2

setX(float x); // Change x

setY(float y); // Change y

getX(); // Returns float

getY(); // Returns float
Jabo