About this ebook
Related to The Javascript Adventure
Related ebooks
JavaScript: Beginner's Guide to Programming Code with JavaScript: JavaScript Computer Programming Rating: 0 out of 5 stars0 ratingsPrinciples of Programming: Java Level 1 Rating: 0 out of 5 stars0 ratingsJavaScript: Best Practices to Programming Code with JavaScript Rating: 0 out of 5 stars0 ratingsJavaScript: Best Practices to Programming Code with JavaScript: JavaScript Computer Programming, #3 Rating: 0 out of 5 stars0 ratingsJavaScript: Beginner's Guide to Programming Code with JavaScript Rating: 5 out of 5 stars5/5Rails: Novice to Ninja: Build Your Own Ruby on Rails Website Rating: 4 out of 5 stars4/5Learn Programming by Coding Like a Professional: Create Games, Apps, & Programs Rating: 0 out of 5 stars0 ratingsWriting Computer Code: Learn the Language of Computers! Rating: 5 out of 5 stars5/5Java: Beginner's Guide to Programming Code with Java Rating: 0 out of 5 stars0 ratingsLearn to Code With JavaScript Rating: 0 out of 5 stars0 ratingsVue.js: Tools & Skills Rating: 0 out of 5 stars0 ratingsLearn Javascript In 1 Hour Rating: 0 out of 5 stars0 ratingsFlutter for Jobseekers: Learn Flutter and take your cross-platform app development skills to the next level (English Edition) Rating: 0 out of 5 stars0 ratingsJavaScript: Tips and Tricks to Programming Code with Javascript Rating: 0 out of 5 stars0 ratingsLearning HTML5 by Creating Fun Games Rating: 4 out of 5 stars4/5JavaScript Projects for Kids Rating: 0 out of 5 stars0 ratingsProfessional JavaScript for Web Developers Rating: 0 out of 5 stars0 ratings10 Lessons in Front-end Rating: 2 out of 5 stars2/5A Pocket Guide to CSS Animations Rating: 5 out of 5 stars5/550 C# Concepts Every Developer Should Know Rating: 0 out of 5 stars0 ratingsThe App Development Blueprint: A Step-by-Step Guide to Creating an App with Freelancers Rating: 0 out of 5 stars0 ratingsWeb Design Blueprints Rating: 0 out of 5 stars0 ratingsAnalysis and Design of Algorithms: A Beginner’s Hope Rating: 0 out of 5 stars0 ratingsLearning Android Game Development Rating: 0 out of 5 stars0 ratingsA Guide To All Programming and Coding Languages Rating: 0 out of 5 stars0 ratingsReact JS and Express Framework: A Comprehensive Guide Rating: 0 out of 5 stars0 ratingsMastering HTML5 Forms Rating: 1 out of 5 stars1/5Crafting HTML Email Rating: 0 out of 5 stars0 ratings
Computers For You
Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5The Invisible Rainbow: A History of Electricity and Life Rating: 5 out of 5 stars5/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Elon Musk Rating: 4 out of 5 stars4/5The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5Uncanny Valley: A Memoir Rating: 4 out of 5 stars4/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsSlenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5Learning the Chess Openings Rating: 5 out of 5 stars5/5The Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Some Future Day: How AI Is Going to Change Everything Rating: 0 out of 5 stars0 ratingsCompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsGrokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5iPhone Unlocked Rating: 0 out of 5 stars0 ratingsThe Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms Rating: 0 out of 5 stars0 ratings
Reviews for The Javascript Adventure
0 ratings0 reviews
Book preview
The Javascript Adventure - Ron Sims II
The Javascript Adventure
Learn to Code by Building a Text-based Adventure Game
Ron Sims II
2015
The Javascript Adventure
Learn to Code by Building a Text-based Adventure Game
Published by the author Ron Sims II 2015
First published by the author June 2015
Copyright © 2015 Ron Sims II
ISBN 978-1-329-21993-9
All rights reserved. Only the source Javascript code and sample Javascript code examples found in this publication may be reproduced. No other parts of this publication may be reproduced in any format without the prior written permission of the author and publisher.
For information related to educational and institutional sales please contact :
ron@orangemantis.net
216.365.8223
Source code for the examples in this book are available at:
https://github.com/orangemantis/gamekit/archive/master.zip
© 2012 Google Inc. All rights reserved. Google and the Google Logo are registered trademarks of Google Inc.
© 2012 Google Inc. All rights reserved. Chrome™ browser is a trademark of Google Inc.
Throughout this publication trademarked logos, names, marks and images appear in an editorial capacity. The author and publisher are not associated with any of the respective parties that hold a claim to any of these trademarks.
While much effort has been made to present the information as correctly as possible in this publication, the author and publisher of this book assume no responsibility and provide no warranty for errors, omissions or any damage that may result from the use of information contained in this publication.
Introduction
This book was created to help people get started writing computer code. Every attempt was made to keep things as simple as possible. To do this, many concepts are not covered because frankly they make things way too complicated. This is not a guide to teach all things programming. It is just a book that helps people get started.
The concepts in this book are taught by showing you how to build a game. Just about every line you write will contribute to creating a simple text-based adventure game. All you will need to get started is a computer with Google's Chrome browser, a text editor, an internet connection (to download the starter materials) and a bit of imagination.
Chapters 1-6 of this book are designed with the beginner in mind. These sections teach the reader how to write game code from scratch. The examples found in the first six chapters introduce the Javascript language and many key programming concepts.
Chapters 7-8 are for intermediate learners that have mastered the concepts introduced in the first part of the book. This part of the book breaks down how the included sample game works.
A Note on Format
The section below explains the text format of this book.
New technical terms, important concepts and things to remember are in bold.
Technical terms and important concepts are italicized.
Code appears in this font.
New code that you must add is in this font and bold!
This is really all you need to know to get started. If you have a question, feel free to send me a tweet @mantisorange. Keep reading and within minutes you will have written your first program!
Chapter 1: Hello World, Everybody's First Program
Computer programming is not hard, it just takes time. Don't worry, it will be fun (most of the time). Enough talk, let’s get busy coding. All you need to start is a modern web browser and a basic text editor. Fortunately, most computers already have both of these installed.
Note: For Windows we recommend using the Notepad++ text editor. For Mac we recommend the Text Wrangler editor. Google's Chrome is recommended for both platforms.
Let’s write your first program.
1. Open your browser and navigate to google.com (type http://google.com
in the address bar and press enter).
2. Right click on the page and select Inspect element from the context menu.
The browser window should now be split. One part of the screen should still show the Google page and the other should have a bunch of technical options like: Network, Console, Elements and so on. This is the inspector. The inspector is the main tool in the browser used for programming.
3. In the Inspector look for a tab labeled Console and click on it. The console is where you make the programming magic happen.
4. Typically somewhere in the console you will see >. This is called the console prompt, or prompt for short.
In computerese (the strange technical vocabulary of programming) the console is where you type commands, things you want the computers to do.
5. Type this at the prompt and hit enter:
alert(Hello World
);
If you typed everything correctly, a window should have popped up that said Hello World
.