A downloadable constructor

Download NowName your own price

Intro

Vector2, a common data type for game engines, is missing from GameMaker no more!

Github repo coming soon~

Vector2

  • Fully-documented
  • Example code
  • Both return and overwrite behavior
  • 15 methods:
    • slope
    • magnitude
    • normalized
    • add
    • subtract
    • component multiply (scale per-axis)
    • scale (linear)
    • round
    • floor
    • ceiling
    • dot product
    • angle
    • lerp
    • reflect
    • rotate

More than just a coordinate, Vector2 allows you to determine many things such as the slope of a surface, or the speed of an object from a pair of coordinates (using subtract and then magnitude), or which direction one character is looking relative to another (dot product), for example, using very similar code to what you might find in other modern game engines.

For example, you could use Vector2 like this to create a sprite that orbits your object:

//create event
v2 = new Vector2(16,16)//offset
va=v2//vector a
//draw event
draw_sprite(sprOrbiter,va.x,va.y)
//step event
v2 = v2.rotate(degtorad(3))
va = v2.add(v2,new Vector2(x,y))


In this example, we use a sprite, but we could use anything, like a particle effect or another object. Simply access the x and y components and various methods of a Vector2 using dot notation.



Updated 9 hours ago
Published 3 days ago
StatusReleased
CategoryTool
Authorwhendric
Made withGameMaker
TagsGameMaker, Math, No AI, Vector
Code licenseGNU Lesser General Public License v3.0 (LGPL)
LinksHomepage, Paypal

Download

Download NowName your own price

Click download now to get access to the following files:

Vector2 Documentation.pdf 64 kB
Vector2GMS2.yymps 4.9 kB

Development log

Community

by whendric · 1 post
2d
by whendric · 1 post
2d
by whendric · 1 post
3d
Post a new topicView all posts