Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Vector2 class allows math operations and distance calculations — Gideros Forum

Vector2 class allows math operations and distance calculations

NiicodemusNiicodemus Member
edited May 2013 in Code snippets
I wrote this quite a while ago, but for some reason didn't think of making it available until @ar2rsawseen mentioned it. I agree with @OZApps that it should be built in to Gideros, and maybe it will be eventually. But in the meantime, here's my implementation of a Vector2 class similar to those found in other frameworks. It uses Lua overloading so you can add, subtract, multiply, divide, compare, concatentate and print the vectors. It also includes a method for calculating distance to other Vector2 points. The code is on my GitHub along with a really quick sample project.

https://github.com/nshafer/Vector2

Thanks,
Nathan Shafer
+1 -1 (+4 / -0 )Share on Facebook
Sign In or Register to comment.