Giter VIP home page Giter VIP logo

03.7-practice-1-'s Introduction

03.7 Practice

Use what you've learned about click handlers to make add to this Mario game!

Code Along Part 1

Let's take a look at the variables that've been declared for us already. What HTML elements have been saved?


Code Along Part 2

Taking a look at lines 13 through 58, notice that there's starter code for many click handlers to make this game work. Now we just need to fill in the blanks!

For problem 1, let me fill in the blank with with the correct variable to make it so that when the user clicks the "Jump" button, Mario jumps and the coin disappears.

Code It Solo Part 2 (3 min)

Now your turn! For problem 2, fill in the blank with the correct variable to make it so that when the "Jump Down" button is pressed, Mario will jump down. Make sure you eraser the comment marks so you can test this code out on the actual web page!

Stop here!


Code Along Part 3

For problem 3, I'm going to do a bit more and write the whole click handler, including the variable, .onclick, and the keyword function.

First, what variable should I fill in the blanks with so that when I click the "Change Color" button the background of the game changes color?

Then, what should I write in the other two blank?

Code It Solo Part 3 (12 minutes)

4: For problem 4, fill in the blanks on line 41 with to make a click handler for the "End Game" button. This would change the text of the h1 to "Game Over" when the button is clicked.

5: For problem 5, fill in the blanks so that when the when the "Update Score" button is clicked, the counter score goes up to "1" instead of 0.

6 Now Try writing the WHOLE click handler! Write the code that would make Mario get bigger when the "Grow" button is clicked. Use .style and give Mario a width of 300px.

Hint:

  • What variable holds what you will be clicking? That should go on the first line.
  • What variable holds what you change with .style? That will go on the second line.

03.7-practice-1-'s People

Contributors

cn-mika avatar

Watchers

 avatar

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.