Sword Engine

Source: utils.ts

import { Particle } from "./gameobject";

/**
 * The utils class contains a number of utility functions.
 */
var utils = {

    /**
     * @function blastParticle
     * @param {Particle} particle the input particle
     * @description Blasts the particle 
     * Not yet implemented 
     */
    blastParticle : (particle : Particle)=>{
        particle.velocity.setLength(Math.random() * 10)
        particle.velocity.setAngle(Math.random() * 2 * Math.PI)
    },

    /**
     * @function getRandomColor
     * @returns {string} a random hex color
     */
    getRandomColor : () => {
        var letters = '0123456789ABCDEF';
        var color = '#';
        for (var i = 0; i < 6; i++) {
            color += letters[Math.floor(Math.random() * 16)];
        }
        return color;
    }
}

export default utils;
Made By Vedik Dev - Himanshu Jangid
sword-engine Copyright © 2021 Himanshu.
Documentation generated by JSDoc 3.6.7 on Tue Nov 30 2021 23:12:55 GMT+0530 (India Standard Time) using the TSDoc template.