Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Control the Flow with Conditional Statements
6:46 with Andrew Chalkley, Dave McFarland, and Joel KraftConditional statements are one of the most important ways of controlling how a program works. They let you add "smarts" to your program by reacting to different conditions. Use conditional statements in our JavaScript game to change the number of points added (or subtracted) based on the item the player collects on the screen.
Downloading and Running the Project Files
Because of how the Phaser.JS library handles files, you need to be running a web server locally to view a working copy of this project. You can't just open the index.html file in your web browser as you might a basic HTML page. There are several simple ways to get a web server up and running on your computer:
- The Web Server for Chrome is an easy-to-install extension for Chrome that lets you select a folder on your computer (like the folder with the game files in them) and deliver them through a basic web server. This is probably the easiest way to get started — but you'll need to use the Chrome web browser.
- If you don't want to use Chrome, check out a simple guide for getting a local web server set up for several other methods.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Tsipporah Christopher
Full Stack JavaScript Techdegree Graduate 15,593 PointsWhat's the difference between using an 'if' and an 'else if' statement when setting the conditions for the poison?
2 Answers
-
Emmanuel Nkiriyumwami
1,314 Points1 Answer
-
Federico Lemaire
8,423 Points2 Answers
-
Andrew Morgan
1,080 Points0 Answers
-
Samuel Duarte
2,931 Points2 Answers
-
Ismail Malik
10,131 Points1 Answer
-
josh chappell
220 Points1 Answer
-
Ruben Lindskog
1,008 Points1 Answer
-
Ismael Ramirez
3,627 Points2 Answers
-
Shahe Alam
1,500 Points1 Answer
-
Brandon Nault
102 PointsI typed in everything as the video said and all I see is a black screen.
Posted by Brandon NaultBrandon Nault
102 Points4 Answers
-
Raymond Leong
Full Stack JavaScript Techdegree Student 211 Points2 Answers
-
Richard Rivera
729 PointsI added internet information services, and i still can preview coin collector. The screen loads black.
Posted by Richard RiveraRichard Rivera
729 Points2 Answers
-
Manuel Cano
1,058 Points1 Answer
-
Nour El-din El-helw
8,241 Points1 Answer
-
Uche Onuekwusi
18,070 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up