
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Crafty is a modern component and event based framework for developing games in JavaScript that targets DOM, Canvas and WebGL.
Crafty is a JavaScript game library that can help you create games in a structured way…
Key Features:
Other Goodies:
A simple game of pong:
Crafty.init(600, 300);
Crafty.background('rgb(127,127,127)');
//Paddles
Crafty.e("Paddle, 2D, DOM, Color, Multiway")
.color('rgb(255,0,0)')
.attr({ x: 20, y: 100, w: 10, h: 100 })
.multiway(200, { W: -90, S: 90 });
Crafty.e("Paddle, 2D, DOM, Color, Multiway")
.color('rgb(0,255,0)')
.attr({ x: 580, y: 100, w: 10, h: 100 })
.multiway(200, { UP_ARROW: -90, DOWN_ARROW: 90 });
//Ball
Crafty.e("2D, DOM, Color, Collision")
.color('rgb(0,0,255)')
.attr({ x: 300, y: 150, w: 10, h: 10,
dX: Crafty.math.randomInt(2, 5),
dY: Crafty.math.randomInt(2, 5) })
.bind('UpdateFrame', function () {
//hit floor or roof
if (this.y <= 0 || this.y >= 290)
this.dY *= -1;
// hit left or right boundary
if (this.x > 600) {
this.x = 300;
Crafty("LeftPoints").each(function () {
this.text(++this.points + " Points") });
}
if (this.x < 10) {
this.x = 300;
Crafty("RightPoints").each(function () {
this.text(++this.points + " Points") });
}
this.x += this.dX;
this.y += this.dY;
})
.onHit('Paddle', function () {
this.dX *= -1;
});
//Score boards
Crafty.e("LeftPoints, DOM, 2D, Text")
.attr({ x: 20, y: 20, w: 100, h: 20, points: 0 })
.text("0 Points");
Crafty.e("RightPoints, DOM, 2D, Text")
.attr({ x: 515, y: 20, w: 100, h: 20, points: 0 })
.text("0 Points");
Left paddle is controlled by W
& S
, right paddle by UpArrow
& DownArrow
.
Check it out online and try to modify it yourself here.
If you want to fix a bug, please submit a pull request against the development branch. Some guides to help you can be found on the wiki
If you would like to make larger contributions please catch us in the forum and we will help you get started. Much appreciated :-)
The easiest way to build crafty uses gruntjs, which requires node and npm. If you have grunt, node, and npm already installed, then run npm install
from Crafty's root directory. (This will pull down about 30MB of node packages.) From then on, just run grunt
to build.
You can also use yarn instead of npm.
FAQs
Crafty is a modern component and event based framework for developing games in JavaScript that targets DOM, Canvas and WebGL.
The npm package craftyjs receives a total of 52 weekly downloads. As such, craftyjs popularity was classified as not popular.
We found that craftyjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.