Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
JavaScript War card game project from Scratch
Rating: 4.4 out of 5(57 ratings)
6,541 students

JavaScript War card game project from Scratch

Explore how to build this JavaScript Game from Scratch based on the card game war. Step by step learning JavaScript
Created byLaurence Svekis
Last updated 11/2024
English
English [Auto],

What you'll learn

  • build an application from scratch
  • learn to apply JavaScript code
  • use JavaScript within web applications

Course content

2 sections22 lectures2h 5m total length
  • Introduction to JavaScript Game Project Course2:47

    Learn to build a JavaScript war card game from scratch by constructing the deck, dealing cards to two players, implementing DOM interactions, and applying game logic to determine the winner.

  • course setup and resources4:22

    Discover course setup essentials by selecting your editor (Atom), using a browser with Chrome dev tools, and mastering the console for debugging and live coding.

  • Build structure for gameplay5:44

    Set up a reusable html template, create a two-player game board with score and card areas, and outline interactive actions for a JavaScript war card game from scratch.

  • eventlisteners in JavaScript DOM9:59

    Build a JavaScript deck of cards, initialize game state, and enable interactions with DOM listeners using querySelector and getElementById on a fight button. Learn dealing, shuffling, and two-player arrays.

  • Source Code0:18
  • build deck of cards10:03

    Build a deck of cards in JavaScript by initializing on first run and looping through suits and card faces. Push each card into the cards array for a war game.

  • Random Array Shuffle Cards9:13

    Learn to shuffle a deck of cards by creating a generic shuffle function that swaps array items using Math.random and Math.floor, producing a randomized card order.

  • Source Code0:30
  • Modulus and Multidimensional Arrays8:44

    Learn to deal a shuffled deck, use modulus to split cards between two players, and build a multidimensional players array in the JavaScript war card game project.

  • Source Code0:34
  • card shift and storage to inplay array5:16

    Implement the attack function and use the shift method to move the first cards from each player's deck into the in-play pot, then check winners and update scores.

  • Create Card output for players10:26

    Develop card outputs for players by rendering card data into each player's hand with the document query selector and styling suits and colors with CSS.

  • CSS styling playing cards10:24

    Learn to style playing cards in a JavaScript war game by building a card structure with top, middle, bottom sections, and applying padding, width, height, border, border-radius, and suit-based coloring.

  • Card battle check for winner9:50

    Check the winner by comparing card values, update the pot, concatenate hands, and handle ties in battle mode while tracking scores.

  • Source Code1:30
  • Create Battle Mode loop JavaScript functions6:40

    Create a battle mode loop to resolve ties in war by increasing the pot. Flip four cards and award the pot to the winner.

  • debugging and tweaking6:21

    Debug and tweak the JavaScript war card game by implementing battle mode, handling game over, and updating the user interface with dynamic messages and DOM output.

  • add automation tweaks to gameplay9:31

    Style the game buttons with border radius, white text, and padding. Add 10, 50, and 100 round automation via listeners and a timer loop that uses a global rounds counter.

  • Source Code1:56
  • Code overview conclusion8:19

    Finalize the war card game by separating JavaScript into a script file and styling into CSS, linking them, and detailing the game loop, card dealing, and winner logic.

Requirements

  • basic HTML and CSS
  • Basic JavaScript understanding
  • Computer access

Description

Learn how to use JavaScript to build a web project from Scratch!

This course will demonstrate how to build a complete interactive web card game from start to finish.  All the source code is included . Learn from setup to completion step by step tutorials.

Basic JavaScript and CSS is required as the scope of this course is to demonstrate working with JavaScript to build web applications.

This course is perfect to learn more about writing JavaScript within a fun dynamic project.  Learn the core concepts of web development and how to apply JavaScript to make your project come to life.

The best way to learn is to practice and this project is a great place to start and challenge yourself to see what you can do with JavaScript.   Card war is a simple game with straight forward rules and it makes a great digital project.  The rules require a dealing of cards to each player, then taking the top card and seeing which player has the highest card.  The high card wins the pot and the won cards then go to the bottom of the players stack.  The first player to run out of cards loses!   Within the course we simulate this game using the rules and apply them with JavaScript.  Using functions, ternary statements, loops, intervals, variables, arrays, objects together to build the game.

Learn by examples - source code is included to get you started quickly

Taught by an instructor with over 18 years of JavaScript experience, ready to help you learn JavaScript and answer any questions you may have.  Regular Q&A discussions with daily responses and coding assistance.

Everything you need to learn how to build this and applications like it!

When you are ready to learn more about building JavaScript applications from scratch, join now and lets start building amazing things online.  


Who this course is for:

  • JavaScript beginners
  • Anyone who wants to learn more about using JavaScript
  • Web developers