Crafty.js game of the blue square and evil red square (learn via repository)
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This repository is a new way to learn.

Usually, you pick up a package and there is an installation guide, a few pages trying to define a couple terms, and the dreaded tutorial.  You and I all read those tutorials:  build a game or database or webapp or something by following step after step after step.   When you are done, you have typed a lot, learned a lot, and have no real reference but the final code.  It is experience but it takes time.  Its linear.  Somewhere in that linear road is the answer to your burning question:  "How do I make a bullet reflect off the edge of the screen?".   The demo has a link to the final game, and it happens in the game, but trying to find it is maddening.  Even if you find the right lesson, there is so much investment in builidng the infrastructure to the game that you have no idea how to make the bullet bounce.

This tutorial makes a simple game:  move the blue square to the red square.  Then it branches into lots of other games, one named "bullets that bounce".   That game has a blue square firing bullets bouncing off the wall at a red square.  The game is tiny:  no scoreboard, no obstacles, no music.  Answer solved.   Need an answer to "How do I add theme music?"  Find the game of move the blue square to the red square while theme music is playing.

If you are new to Crafty.js, I recommend following the trail of commits on the main branch until you understand the core game:  a blue square hits a red square.  Then start to explore the branches.  Each branch and commit will have a "changes.txt" file that explains the changes and teaches concepts.  Eventually, there will be a manual from all the changes.txt.

Good luck.  Contact me at with any comments.  Tell me how you feel when you try to learn this way.