Book Image

JavaScript Projects for Kids

By : Syed Omar Faruk Towaha
Book Image

JavaScript Projects for Kids

By: Syed Omar Faruk Towaha

Overview of this book

JavaScript is the most widely-used programming language for web development and that's not all! It has evolved over the years and is now being implemented in an array of environments from websites to robotics. Learning JavaScript will help you see the broader picture of web development. This book will take your imagination to new heights by teaching you how to work with JavaScript from scratch. It will introduce you to HTML and CSS to enhance the appearance of your applications. You’ll then use your skills to build on a cool Battleship game! From there, the book will introduce you to jQuery and show you how you can manipulate the DOM. You’ll get to play with some cool stuff using Canvas and will learn how to make use of Canvas to build a game on the lines of Pacman, only a whole lot cooler! Finally, it will show you a few tricks with OOP to make your code clean and will end with a few road maps on areas you can explore further.
Table of Contents (17 chapters)
JavaScript Projects for Kids
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Chapter 8. Building Rat-man!

In this chapter, we will be building a game called Rat-man, which is actually a modified version of the famous game Pac-Man. We will use canvas, JavaScript, CSS, and HTML to build our game.

Let's start with introducing our game's characters:

  • Our game will have one rat. The player will act as the rat.

  • There will be four cats who will try to catch the rat and a lot of cheese for the rat to eat.

  • The main goal of the game is to eat all the cheese without being caught by the monster cats.

Sounds fun, right? Let's get right to it...

Note

To make our code clean, we will keep our JavaScript, CSS, and images files in separate folders. We will have three primary folders named as follows:

  • css

  • img

  • scripts