def distance_between(obj1, obj2) a = obj1.x - obj2.x b = obj1.y - obj2.y Math.hypot(a, b) end struct Vector2 property x = 0f32 property y = 0f32 def initialize(@x : Float32, @y : Float32) end end # All fake data a = Vector2.new(100.00f32, 100.00f32) b = Vector2.new(100.00f32, 300.00f32) # fake game loop loop do temp_buffer = Hash(String, Float32).new temp_buffer["update_positions"] = distance_between(a, b) puts temp_buffer sleep 0 # 100 CPU USAGE! end puts "Started..."