Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
game-time-accumulator
Advanced tools
A great class to manage updates to your own game using time accumulator principle. Works on browser + NodeJS (check this for compability table)
npm install game-time-accumulator
or bower install game-time-accumulator
.
var GameTimeAccumulator = require('game-time-accumulator');
var canvas = document.getElementById('game-canvas');
var ctx = canvas.getContext('2d');
// Happens exactly in a loop you define
var stepFn = function(){
player.move();
}
// Happen every requestAnimationFrame
var drawFn = function(){
// Clear canvas before each fraw
ctx.clearRect(0, 0, canvas.width, canvas.height);
player.draw(ctx);
}
var game = new GameTimeAccumulator(stepFn, drawFn, 200);
game.start();
stepFn - (Function, default noop) - Run every step loop (you define the time)
drawFn - (Function, default noop) - Run every requestAnimationFrame loop (system defines the time)
stepSize - (Number, default 16 - ~60fps) - Milliseconds of step to loop
start()
- Starts the game
stop()
- Stops the game
FAQs
game-time-accumulator class for creating a game
The npm package game-time-accumulator receives a total of 1 weekly downloads. As such, game-time-accumulator popularity was classified as not popular.
We found that game-time-accumulator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.