Code Monkey home page Code Monkey logo

exercise-pop-baloons-javascript's Introduction

Pop Balloons game using Javascript, HTML/CSS ๐ŸŽˆ๐ŸŽŠ

This is an amazing game to practice HTML, CSS and a little Javascript. The game goal is to POP al the balloons by clicking on them.

๐ŸŒฑ How to start this project

This project comes with the necessary files to start working, but you have two options to start:

a) Open this link in your browser with gitpod (recommended): https://gitpod.io#https://github.com/breatheco-de/exercise-pop-baloons-javascript.git

b) You can clone this repository on your local computer:

$ git clone https://github.com/breatheco-de/exercise-pop-baloons-javascript.git

Run the website by typing the following command on your terminal: $ npx http-server --yes -c-1

๐Ÿ“ Instructions

Balloon Pop Game with HTML/CSS and Javascript

Build a game with the following workflow:

  1. When the website loads (window.onload) you have to render all the ballons.
  2. Every ballon needs to have an onClick attached to listen to when the user clicks on it.
  3. When the user clicks on it the balloon disappears (pops) from the screen.
  4. When all the 20 balloons have disappeared the website reloads and the game starts again.

๐Ÿ’ช Strategy

Strategy to complete the pop balloons

  1. First, declare an array of 20 colors, each color will represent a balloon, the colors can repeat.
  2. To pop a balloon, you will have to turn the value on that balloon position on the array equal to null.
  3. Loop all the colors and make the html string for each balloon, you should generate a big html string like this, and add it into the DOM:
<div class="balloon active"></div>
<div class="balloon popped"></div>
<div class="balloon active"></div>
<div class="balloon active"></div>
  1. Add that string to the innterHTML of the <div id="balloon-map"> element using document.querySelector.

  2. Update your function that renders the ballons to add also an onClick on each balloon div to listen to the click.

  3. When a balloon is clicked, go the array of colors and turn the color back to null.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.