insert(obj) {
            let key = this.key(obj.pos);
            let x = key.x;
            let y = key.y;
            if(this.fillNearby) {
                for(let i = -OVERLAP; i <= OVERLAP; i++) {
                    key.x = x + i;
                    for(let j = -OVERLAP; j <= OVERLAP; j++) {
                        key.y = y + j;
                        // uses string representation of key
                        this.insertAtKey(obj, key.toString());
                    }
                }
            } else {
                this.insertAtKey(obj, key); 
            }
            return key;
        }
/**
         * Inserts an object into the HashMap. If fillNearby is true, then it
         * also inserts the object into the immediately surrounding keys.
         * 
         * @param {GameObject} obj The object to insert.
         * @returns {IntPair} The primary key.
         */
Inserts an object into the HashMap. If fillNearby is true, then it
also inserts the object into the immediately surrounding keys.

@param {GameObject} obj The object to insert.
@returns {IntPair} The primary key.
Inserts an object into the HashMap . If fillNearby is true then it also inserts the object into the immediately surrounding keys . @param { GameObject } obj The object to insert . @returns { IntPair } The primary key .
insert(obj) {
            let key = this.key(obj.pos);
            let x = key.x;
            let y = key.y;
            if(this.fillNearby) {
                for(let i = -OVERLAP; i <= OVERLAP; i++) {
                    key.x = x + i;
                    for(let j = -OVERLAP; j <= OVERLAP; j++) {
                        key.y = y + j;
                        this.insertAtKey(obj, key.toString());
                    }
                }
            } else {
                this.insertAtKey(obj, key); 
            }
            return key;
        }
insert ( obj ) { let key = this . key ( obj . pos ) ; let x = key . x ; let y = key . y ; if ( this . fillNearby ) { for ( let i = - OVERLAP ; i <= OVERLAP ; i ++ ) { key . x = x + i ; for ( let j = - OVERLAP ; j <= OVERLAP ; j ++ ) { key . y = y + j ; this . insertAtKey ( obj , key . toString ( ) ) ; } } } else { this . insertAtKey ( obj , key ) ; } return key ; }
Inserts an object into the HashMap.
Inserts an object into the HashMap .
// uses string representation of key