JavaScript Game Tutorial: Planet Defense @Frankslaboratory
JavaScript Game Tutorial: Planet Defense  @Frankslaboratory
Uploaded October 2023 | Updated November 2026, 3 days ago
Every game is made out of a few basic building blocks. Once you understand these techniques you can get creative, combine these elements in different ways and make many different games easily.
Let's learn JavaScript by making games.

Today we are building an animated 2d game completely from scratch with no frameworks and no libraries using just plain vanilla JavaScript and HTML5 canvas.

Discover many 2D game development techniques and learn how to implement them with JavaScript. We will cover everything from keyboard and mouse controls to performance friendly sprite animation tips and tricks, and the main focus this time is object pool design pattern. We will use it for enemies and for player projectiles, because reusing our objects, rather then creating and discarding them over and over, can be a massive performance benefit.

This class is for creative coders who want to learn about the fundamentals of 2D game development as well as for JavaScript beginners who want to practice their object oriented programming skills on a fun visual and interactive project.

๐Ÿ‘ฝ Download Project Art assets ๐Ÿ‘ฝ
Background: frankslaboratory.co.uk/downloads/131/background.png
Planet: frankslaboratory.co.uk/downloads/131/planet.png
Player space ship: frankslaboratory.co.uk/downloads/131/player.png
Asteroid enemy: frankslaboratory.co.uk/downloads/131/asteroid.png
Lobstermorph enemy: frankslaboratory.co.uk/downloads/131/lobstermorph.png
Beetlemorph enemy: frankslaboratory.co.uk/downloads/131/beetlemorph.png
Rhinomorph enemy: frankslaboratory.co.uk/downloads/131/rhinomorph.png
(if you can't download the files, try to use a different browser or VPN to change your country, also leave a comment so I can fix it)

Playlist: youtube.com/playlist?list=PLYElE_rzEw_tw6scwjv96oEABmnMSQoQW

๐ŸŒŒ Tutorial Contents ๐ŸŒŒ
00:00:00 Intro
00:01:02 Project setup
00:03:24 Planet and Game class
00:11:34 Mouse position
00:17:53 Player spaceship
00:22:35 A little bit of math
00:30:23 Understand canvas rotation
00:36:39 Debug mode
00:39:04 Object pool
00:51:27 Player projectiles
00:57:38 Enemy pool
01:05:03 Reusable collision detection method
01:07:24 Periodic events
01:15:30 Asteroid enemy class
01:19:51 Sprite animation in JavaScript
01:29:07 Lobstermorph enemy class
01:38:22 Drawing game text
01:43:49 Player lives
01:48:58 Beetlemorph enemy class
01:50:33 Rhinomorph enemy class
01:51:40 What's next

If you want to SUPPORT me you can use the links below and get some one my EXTENDED classes! ๐Ÿ’ช
udemy.com/course/learn-creative-coding-with-vanilla-javascript/?referralCode=7C560D4661C5C59262BB
udemy.com/course/learn-game-development-with-javascript/?referralCode=69874A38D543D7F510F2
udemy.com/course/creative-coding-deep-dive-for-beginners/?referralCode=F43E8FCE60957A64DF4A
udemy.com/course/build-animated-physics-game-with-javascript/?referralCode=B4482AF631243104650B
udemy.com/course/learn-html-canvas-pixels-particles-physics/?referralCode=F7977062A4BC964A1F5E
udemy.com/course/remake-retro-games-with-javascript/?referralCode=2ACCA21F16FE78E631F7
udemy.com/course/learn-html-canvas-advanced-text-effects/?referralCode=4C5821D2D04048CC4A01

Get Skillshare FREE for 1 month: โ€๐ŸŽ“
skillshare.com/en/r/profile/Frank-Dvorak/507488567?gr_tch_ref=on&gr_trp=on

The description of this video may contain affiliate links, which means that if you buy one of the products that I recommend, I'll receive a small commission without any additional cost for you. This helps to support the channel and allows me to continue making videos like this. Thank you for the support!
#frankslaboratory
JavaScript Game Tutorial: Planet DefenseFree Tool Makes ANY Indie Game CharacterWhy Hardcoding Kills Scale (Go Data-Driven)Pure CSS Animated Background Tutorial - Dripping Liquid EffectPerfect Pixel Art in Seconds (CSS)Pure CSS Morph Effect | Awesome UI Hover Animations with CSS Clip Path PropertySprite Animation in JavaScriptMake a Mobile Game with JavaScriptBuild a Swarm With One UpgradeHTML Canvas Deep Dive 2026Bouncing Particles with vanilla JavaScriptJavaScript Flow Fields - Advanced Experiments
Franks laboratory |

JavaScript Game Tutorial: Planet Defense

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER