Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a simple JavaScript game where red colored squares are created at random and the user has to click on them to turn them purple.

Create a simple JavaScript game where red colored squares are created at random and the user has to click on them to turn them purple. Do not use jQuery. A demo can be shown on request. Requirements 1. Red squares are created at 0.5 second intervals 2. The squares are positioned randomly 3. The squares turn purple when clicked 4. When the user leaves 5 divs red (because of being unable to color them fast enough), they lose the game and an alert is shown 5. When the user loses the game, no further divs are created Syntax reference This script is doable using your JavaScript lectures, the only additional info needed is given below To produce a random number between 1 and 500: Math.floor((Math.random() * 500) + 1) Remember that to change the position of an HTML element, first set its position value to absolute, then set its top, left, bottom and/or right values. Use 500 max for top and 100 max for left to get positions within reasonable bounds for a laptop screen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago

Question

Are these written ground rules?

Answered: 1 week ago

Question

How do members envision the ideal team?

Answered: 1 week ago