/drag_race

You will build a drag race demo, showing your understanding of objects, prototypes, and prototypal inheritance

Drag Race!

Let's build a visual model of how acceleration works in different vehicles by making a drag race demonstration that has an SF GoCar, motorcycle, an Audi S4 and a semi-truck!

This won't be a fair race. So, if you want it to be more fair, you may use vehicles that are a little more compatible, or look at the super bonus for a challenge that can make the drag race more fair, by letting you change the vehicles that are in the race.

What should it do?

Day 1

  • Show how an SF GoCar, a motorcylce, an Audi S4, and a semi-truck would perform in a drag race visually

  • Use HTML, CSS, some images from google, and JS.

  • You should implement JS objects that have the following properties and functions, demonstrating your understanding of:

    • constructors (day 1)
    • prototypical inheritance (day 2) by modeling how the different vehicles behave differently, dependent upon their varying characteristics
  • Implement view objects in js that represent the html elements on the page and allow you to control them separately from the underlying

  • The cars should be lined up at a start line

  • The cars should demonstrate their different acceleration behavior from the start line visually

Properties

  • An engine that produces some power and may be started and stopped
  • Mass
  • A drag coefficient

Functions

  • A way to start a car
  • A way to apply power
  • A way to stop the car

Note: If you finish all the day 1 stuff early, you may get started

on day 2 functionality and the bonuses/super bonuses, but keep in mind that there's still a lot you'll want to learn on Thursday before you work on that. Pace yourselves.

Day 2: In addition

  • A GoCar may only be driven if its in drive. Same with the Audi
  • A motorcycle needs to be upshifted to accelerate
  • A semi needs to have its air brakes applied, before it may stop

Bonus

  • Have the winner of the drag race be displayed after that car hits the finish line
  • Be able to start the race from the beginning

Super-bonus

  • Display other vehicles to add to the drag race
  • Take vehicles out of the race
  • Show the velocity of the vehicle as its moving