From the course: Building Website Interactivity with JavaScript
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Solution: Finalizing the basic gameplay - JavaScript Tutorial
From the course: Building Website Interactivity with JavaScript
Solution: Finalizing the basic gameplay
(upbeat music) - [Instructor] Let's take a look at my solution to this final challenge. Okay, enter in some letters here. So this was not a valid word, so I'm told to try again. Okay, fine, I'll try again. There we go. So you can see these success and error messages are differentiated. The good job is in larger friendlier letters, and it's bold, and everything is otherwise working. Starting with the HTML file, I've hard coded the messages in here since there's no need for them to change per solution. Then in the CSS file, I'm styling each of these with just some different colors and a little bit larger, bolder type, when the solution is correct. Then in the script, there's a couple of things to note. First of all, in order to figure out whether a solution is correct, I need to know how long a solution can be. Instead of hard coding that as the number four, I'm getting the length of a query selector all on the slots. That way if I decide later to change the number of slots, I don't…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Inspecting the game prototype2m 59s
-
(Locked)
Implementing basic interaction: Click to add6m 46s
-
(Locked)
Reversing the interaction: Click to remove5m 25s
-
(Locked)
Supporting the keyboard in the game5m 30s
-
(Locked)
Allowing tiles to be dragged8m 11s
-
(Locked)
Allowing tiles to be dropped4m 42s
-
(Locked)
Adding animation to make interactions smoother3m 22s
-
(Locked)
Challenge: Finalizing the basic gameplay1m 25s
-
(Locked)
Solution: Finalizing the basic gameplay2m 50s
-
-