Skip to content

HunorMarton/gorillas

Repository files navigation

JavaScript Game Tutorial: Gorillas

YouTube Tutorial: Gorillas

Welcome to the source code repository for the Gorillas JavaScript Game Tutorial. There are multiple versions of this tutorial.

  • The simplified version you can find on freeCodeCamp. This is a comprehensive guide, yet it lacks several main features of the final game and the graphics is more stripped down.

  • The full tutorial you can find on YouTube. This includes many more chapters, like how to make the buildings destructible, how to animate the hand of the gorilla to follow the drag movement while aiming, and we add AI logic, so you can play against the computer.

  • You can also play the final, extended version of the game on CodePen. This includes even more features, like light and dark mode and in this version the flying bomb is also affected by the wind.

While the main tutorials are very packed, there are still a few topics we could not cover in them. Below you can also find a few follow-up tutorials

  • How to make the game fullscreen?

  • How to handle dark mode?

Source Code for the freeCodeCamp Article

freeCodeCamp Tutorial: Gorillas

You can find the simplified version of this tutorial on freeCodeCamp. You can find the end result of this article as a playable game on Vercel. If you follow along you should end up with the following source code:

Source Code for the YouTube Tutorial

YouTube Tutorial: Gorillas

You can find the full version of the tutorial on YouTube. You can play the final, single player version of the game on Vercel. Here are the source codes for each major step.

Initial Setup

Drawing with HTML Canvas

Aiming

Animation and Hit Detection

Endgame

AI Logic

You can find a play the final, single player version of the game on Vercel.

Follow-Up Tutorials

How to use the Fullscreen API in JavaScript?

YouTube Tutorial: Fullscreen

How to run a game you created for the web in fullscreen? In this quick tutorial, we check how to display a game or any other HTML element in fullscreen, how to exit fullscreen, and how to make a nice fullscreen toggle button in SVG.

Source Code

Demo

How to handle dark mode with CSS and JavaScript? (with SVG toggle button)

YouTube Tutorial: Dark Mode

How can we detect dark mode in CSS and JavaScript? How can we manually override it with a toggle button? And how do we save our setting in localStorage? In this quick tutorial, we look into detecting dark mode in CSS and JavaScript and then create a toggle button with SVG to override the default behavior.

Source Code

Source Code of the Final, Extended Version

YouTube Tutorial: Gorillas

You can find a play the final, extended version on CodePen and on Vercel.

About

Made by Hunor Márton Borbély in 2024

Follow me on X

Buy Me a Coffee

YouTube Tutorial: Gorillas