Skip to content

Archmage.Vec2

A 2D vector, the type of a vector field whose elements are not 32-bit, such as int64, uint16 or float64.

Inherits: RefCounted

A vector field whose elements are 32-bit, such as int32 or float32, is a Vector2i or Vector2 instead.

var x: Variant

An int or a float, as the element type of the field.

var y: Variant

An int or a float, as the element type of the field.

static func from_json(d: Variant, conv: Callable, e: Archmage.ParseError = null) -> Archmage.Vec2

Returns the vector in d, a parsed JSON object, converting each element with conv.call(value, e), which returns the zero value for null. For null, returns the zero vector. For any other value that is not an object, returns the zero vector too and records the type mismatch in e (see Archmage.ParseError.report_mismatch()).

func to_json() -> Dictionary

Returns the vector as a JSON object.

func to_godot() -> Variant

Returns a Vector2i when the elements are integers, or a Vector2 otherwise. A Vector2i keeps only the low 32 bits of each integer, and a Vector2 stores 32-bit floats unless Godot is built with double precision.