Touhou ripoff thing

I need help with score calculator, how do I make it increase a millisecond?

    miztis Well, set the score to 0. For the score milliseconds thingy, you could just do setInterval(function(){score+=1},timeIncrement).

      miztis
      yeah but then you can just switch screens and then switch back and get a bajillion score

        Ravage
        if you want a time based score, you need a time based game
        the touhou ripoff is frame based, not time based

        Ravage actually regardless of the browser setInterval is actually kind of fucked as in it won't execute properly if you start giving it lower values which means it's inconsistent making your own setTimeout loop is more practical if your aiming for accuracy if it's just a simple loop then what you said is fine just keep in mind that it will not always be accurate I know from making projects that have been time dependent before so do heed my warning
        here's a demo on how that can be done

        var Loop = (function() {
            function Loop(ms, cb) {
                this.ms = ms;
                this.cb = cb;
                this.main();
            }
            Loop.prototype.main = function() {
                var self = this;
                this.id = setTimeout(function() {
                    self.cb();
                    self.main();
                }, this.ms);
            }
            Loop.prototype.stop = function() {
                clearInterval(this.id);
            }
            return Loop;
        })();

        something like this will do though it's only bare bones atm you can add more to it though

          ackvonhuelio well yea but i imagine they wanted a seperate loop outside of draw that's the point i intend to make that using the Interval as an accurate loop at low speeds will likely fail but using time calculation works within the draw loop too just saying

          Chat