def distance_between(obj1, obj2)
a = obj1.x - obj2.x
b = obj1.y - obj2.y
Math.hypot(a, b)
end
struct Vector2
property x = 0
property y = 0
def initialize(@x : Int32, @y : Int32)
end
end
a = Vector2.new(100, 100)
b = Vector2.new(100, 100)
# fake game loop
loop do
distance_between(a, b)
sleep 0 # 100 CPU USAGE!
end
puts "Started..."