{"id":15026215,"url":"https://github.com/craftyjs/crafty","last_synced_at":"2025-05-14T06:10:53.979Z","repository":{"id":37336683,"uuid":"1052675","full_name":"craftyjs/Crafty","owner":"craftyjs","description":"JavaScript Game Engine","archived":false,"fork":false,"pushed_at":"2023-11-04T15:36:58.000Z","size":7738,"stargazers_count":3493,"open_issues_count":68,"forks_count":554,"subscribers_count":135,"default_branch":"develop","last_synced_at":"2025-05-11T00:46:12.923Z","etag":null,"topics":["games","javascript"],"latest_commit_sha":null,"homepage":"http://craftyjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craftyjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-11-04T23:02:09.000Z","updated_at":"2025-05-08T11:39:32.000Z","dependencies_parsed_at":"2022-07-12T12:13:59.925Z","dependency_job_id":"d5e39e9f-993a-4a36-ae13-6eff02fd9356","html_url":"https://github.com/craftyjs/Crafty","commit_stats":{"total_commits":1480,"total_committers":130,"mean_commits":"11.384615384615385","dds":0.8013513513513514,"last_synced_commit":"f3982baa51af24d4e8a14a3194fd3f0e92a2dcba"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyjs%2FCrafty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyjs%2FCrafty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyjs%2FCrafty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyjs%2FCrafty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craftyjs","download_url":"https://codeload.github.com/craftyjs/Crafty/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254083174,"owners_count":22011820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["games","javascript"],"created_at":"2024-09-24T20:04:04.639Z","updated_at":"2025-05-14T06:10:53.924Z","avatar_url":"https://github.com/craftyjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Crafty JS [![Travis Build Status](https://travis-ci.org/craftyjs/Crafty.svg?branch=develop)](https://travis-ci.org/craftyjs/Crafty) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/craftyjs/Crafty?svg=true\u0026branch=develop)](https://ci.appveyor.com/project/starwed/crafty) [![Sauce Test Status](https://saucelabs.com/buildstatus/mucaho)](https://saucelabs.com/u/mucaho)\n\nCrafty is a JavaScript game library that can help you create games in a structured way…\n\nKey Features:\n\n* Entities \u0026 Components - A clean and decoupled way to organize game elements. No inheritance needed!\n* Eventbinding - Event system for custom events that can be triggered whenever, whatever and bound just as easily.\n* No dom manipulation or custom drawing routines required.\n\nOther Goodies:\n\n* Thriving community - Help is readily available in the forum.\n* Community modules - A growing collection of user-generated code you can use.\n* Pure JavaScript - No magic. Works in all major browsers and can be combined with your favorite js library.\n\n\n## Using Crafty\n\nA simple game of pong:\n```javascript\nCrafty.init(600, 300);\nCrafty.background('rgb(127,127,127)');\n\n//Paddles\nCrafty.e(\"Paddle, 2D, DOM, Color, Multiway\")\n    .color('rgb(255,0,0)')\n    .attr({ x: 20, y: 100, w: 10, h: 100 })\n    .multiway(200, { W: -90, S: 90 });\nCrafty.e(\"Paddle, 2D, DOM, Color, Multiway\")\n    .color('rgb(0,255,0)')\n    .attr({ x: 580, y: 100, w: 10, h: 100 })\n    .multiway(200, { UP_ARROW: -90, DOWN_ARROW: 90 });\n\n//Ball\nCrafty.e(\"2D, DOM, Color, Collision\")\n    .color('rgb(0,0,255)')\n    .attr({ x: 300, y: 150, w: 10, h: 10,\n            dX: Crafty.math.randomInt(2, 5),\n            dY: Crafty.math.randomInt(2, 5) })\n    .bind('UpdateFrame', function () {\n        //hit floor or roof\n        if (this.y \u003c= 0 || this.y \u003e= 290)\n            this.dY *= -1;\n\n        // hit left or right boundary\n        if (this.x \u003e 600) {\n            this.x = 300;\n            Crafty(\"LeftPoints\").each(function () {\n                this.text(++this.points + \" Points\") });\n        }\n        if (this.x \u003c 10) {\n            this.x = 300;\n            Crafty(\"RightPoints\").each(function () {\n                this.text(++this.points + \" Points\") });\n        }\n\n        this.x += this.dX;\n        this.y += this.dY;\n    })\n    .onHit('Paddle', function () {\n        this.dX *= -1;\n    });\n\n//Score boards\nCrafty.e(\"LeftPoints, DOM, 2D, Text\")\n    .attr({ x: 20, y: 20, w: 100, h: 20, points: 0 })\n    .text(\"0 Points\");\nCrafty.e(\"RightPoints, DOM, 2D, Text\")\n    .attr({ x: 515, y: 20, w: 100, h: 20, points: 0 })\n    .text(\"0 Points\");\n```\n_Left paddle is controlled by `W` \u0026 `S`, right paddle by `UpArrow` \u0026 `DownArrow`._   \n[Check it out online and try to modify it yourself here](https://jsfiddle.net/mucaho/yL3v48r6/).\n\n## Developing\n\nIf 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](https://github.com/craftyjs/Crafty/wiki)\n\nIf you would like to make larger contributions please catch us in the [forum](https://groups.google.com/forum/?fromgroups#!forum/craftyjs) and we will help you get started. Much appreciated :-)\n\n\n### Quick build instructions\n\nThe easiest way to build crafty is to use [gruntjs](http://gruntjs.com/), which requires [node](nodejs.org/) and [npm](https://npmjs.org/).  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.\n\nYou can also use [yarn](https://yarnpkg.com/) instead of npm.\n\n([Full instructions here](https://github.com/craftyjs/Crafty/wiki/Building).)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftyjs%2Fcrafty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraftyjs%2Fcrafty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftyjs%2Fcrafty/lists"}