The_Dark_Side_of_Earth/utils/global.gd

13 lines
384 B
GDScript

class_name Global
# Returns the next damage instance (and increases by 1)
static var next_dmg_id : int = 0 :
get:
next_dmg_id += 1
return next_dmg_id
# Entrywise modulo
static func vec_mod(vec : Vector2, modulus : float, only_x = false, only_y = false):
return Vector2(
fposmod(vec.x, modulus) if not only_y else vec.x,
fposmod(vec.y, modulus) if not only_x else vec.y)