
Learn to build a flying bird game from scratch using JavaScript and the DOM, covering element selection, dynamic content, event listeners, keyboard controls, animations, and collision detection.
Set up a game structure with a score area, start screen, and game over message in the main game area. Connect DOM elements with JavaScript using querySelector.
Add event listeners to the button, start screen, and document to track click and key press interactions, control the start sequence, and hide the game message using classList.
Track keyboard input by listening to keydown and keyup, updating a global keys object with true/false using the event code. Use preventDefault when needed and drive smooth animation with requestAnimationFrame.
Create a bird element with the createElement method, assign bird and wing classes, and append it to the game area to start the action.
Learn to implement smooth animations with requestAnimationFrame by looping a step function that updates a bird’s position using arrow keys and the element’s offset properties.
Apply move boundaries by checking player x and y against zero and the dynamic game area width and height with 50-pixel offsets to keep the character on screen.
Move the bird's wings by toggling a boolean on key presses, update wing position and style, and map space or up arrow to flap so the player stays aloft.
Enable gravity by updating bird's y position with the player speed, and implement scoring that increases as the player stays alive, ending game when bird leaves area.
End the game by setting the player in play to false, then run a game over sequence that shows the score and message and flips the bird on crash.
Create dynamic obstacles by generating top and bottom pipes with JavaScript, compute spacing, randomize heights, and render them via the DOM before the bird flies.
Move pipes across the screen as obstacles for the bird by selecting elements with class pipe, updating each pipe’s x position and left style, then regenerate pipes on the right.
Implement collision detection between two elements using getBoundingClientRect, comparing their top, bottom, left, and right, returning a boolean and logging a crash to the console.
Implement collision detection to trigger the game over function when the bird hits obstacles or goes off screen, display a game message, show the score, and allow starting again.
Review the bird game's html, css, and javascript source to understand dynamic gameplay, pipes, collision detection, and restart logic via dom manipulation and getBoundingClientRect.
Add a bonus color feature by generating a random hex color with math.random, converting to base16, and applying six characters to both pipes.
Fun and exciting way to practice JavaScript while building an interactive game from scratch.
Learn how to apply JavaScript - connect to elements - update and manipulate element content and attributes - create interaction with event listeners - create content dynamically - all done in a step by step format so you can learn explore and create your own version of the game. Apply what you learn to your JavaScript projects to master working with the DOM.
Explore how you can apply JavaScript to :
Select elements from the web page
Create global variables and objects to use for game play
Add event listeners to create interactive content
Listen for keypress and apply the results in your code
Add classes and remove classes from elements
Create elements dynamically on the fly with JavaScript
Append new elements to existing webpage elements
Use offset values of elements within code
Update element style values to produce animation
Use of awesome JavaScript methods like getBoundingClientRect()
Smooth animations with requestAnimationFrame()
Check for element overlap and collision detection
How to build your game to be dynamic with flexible variables
and much more.
Source Code is included so you can try it for yourself, what is covered in the lessons.
No libraries, no shortcuts just learning JavaScript making it DYNAMIC and INTERACTIVE web application.
Step by step learning with all steps included.
Beginner JavaScript knowledge is required as the course covers only JavaScript relevant to the building of the game. Also HTML and CSS knowledge is essential as scope of this course is all JavaScript focused.
Taught by a professional instructor with over 18 years of experience ready to help you learn.
Along with friendly support in the Q&A to help you learn and answer any questions you may have.
Try it now you have nothing to lose, comes with a 30 day money back guarantee.
Start building your own version of the game today!!!!