Snowcraft clone (really bad one)

by enbette

HTML

<!doctype html>
<html>
  <head>
    <style>
      canvas {
        border: 1px solid #d3d3d3;
        background-color: #f1f1f1;
      }
    </style>
  </head>

  <body onload="Game.start()">
    <canvas id="gameScreen" height="500" width="688"></canvas>

    <script type="text/javascript">
      var activeObj
      var activeInterval

      document.getElementById("gameScreen").addEventListener(
        "mousedown",
        function (e) {
          takeControl(e)
        },
        true,
      )
      document
        .getElementById("gameScreen")
        .addEventListener("mousemove", function (e) {
          moveUnit(e)
        })
      document
        .getElementById("gameScreen")
        .addEventListener("mouseup", function (e) {
          stopControl(e)
        })

      function takeControl(e) {
        for (let i = 0; i < objects.length; i++) {
          if (
            objects[i].direction === "up" &&
            e.offsetX > objects[i].x - 45 &&
            e.offsetX < objects[i].x + 45 &&
            e.offsetY > objects[i].y - 45 &&
            e.offsetY < objects[i].y + 45
          ) {
            activeObj = objects[i]
            activeObj.moveProgress = 1.1
            activeObj.moveCount = Math.floor(Math.random() * 200) + 50
          }
        }
      }
      function moveUnit(e) {
        if (activeObj !== undefined) {
          activeObj.x = e.offsetX - 25
          activeObj.y = e.offsetY - 25
        }
      }
      function stopControl(e) {
        activeObj = undefined
      }

      var objects = []
      var balls = []
      var interp_tasks = []
      var pos = {
        x: 0,
        y: 0,
      }
      const throwDir = {
        up: { x: -1, y: -1 },
        down: { x: 1, y: 1 },
      }
      var Game = {
        start: function () {
          Object.assign(snowBall.prototype, ball)
          myGameArea.start()
        },
        spawn: function (x, y, direction, type) {
          if (type === "Char") {
            var newchar =...