Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Crafty.js game of the blue square and evil red square (learn via repository)
JavaScript
Branch: sprite
Pull request Compare This branch is 1 commit behind score.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitattributes
.gitignore
changes.txt
crafty-min.js
crafty.js
game.html
game.js
readme.txt

readme.txt

The README

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 charles.merriam@gmail.com with any comments.  Tell me how you feel when you try to learn this way.

Something went wrong with that request. Please try again.