diff --git a/static/js/languages/microscript/v2/runner.coffee b/static/js/languages/microscript/v2/runner.coffee index bb1081b..7d5fc5b 100644 --- a/static/js/languages/microscript/v2/runner.coffee +++ b/static/js/languages/microscript/v2/runner.coffee @@ -144,6 +144,10 @@ class @Runner processor.run(@microvm.context) tick:()-> + # Reset input states at the beginning of every frame + if @updateControls? + @updateControls() + if @system.fps? @fps = @fps*.9 + @system.fps*.1 @@ -277,8 +281,6 @@ class @Thread program = parser.program compiler = new Compiler(program) @processor.load compiler.routine - if (f == "update()" or f == "serverUpdate()") and @runner.updateControls? - @runner.updateControls() true else false diff --git a/static/js/languages/microscript/v2/runner.js b/static/js/languages/microscript/v2/runner.js index a4cde56..e9581c9 100644 --- a/static/js/languages/microscript/v2/runner.js +++ b/static/js/languages/microscript/v2/runner.js @@ -182,6 +182,10 @@ this.Runner = class Runner { tick() { var dt, frame_time, i, index, j, k, len, load, margin, processing, processor, ref, ref1, t, time, time_limit, time_out; + // Reset input states at the beginning of every frame + if (this.updateControls != null) { + this.updateControls(); + } if (this.system.fps != null) { this.fps = this.fps * .9 + this.system.fps * .1; } @@ -346,9 +350,6 @@ this.Thread = class Thread { program = parser.program; compiler = new Compiler(program); this.processor.load(compiler.routine); - if ((f === "update()" || f === "serverUpdate()") && (this.runner.updateControls != null)) { - this.runner.updateControls(); - } } return true; } else {