A lightweight JavaScript game engine
git clone git://soophie.de/game-engine
blob: 2de09683a4b8e24a7a586b3a614f88ce6716e0d4 (249 bytes)[doc][blame][raw]
1
export default class Timer {2
constructor(step) {3
this.time = 0;4
this.step = step || 1;5
}6
count() {7
if(this.time >= 1) {8
this.time = 0;9
return true;10
}11
this.time += 1 / this.step;12
return false;13
}14
reset() {15
this.time = 0;16
}17
}