Git Product home page Git Product logo

js_ooppractice3's Introduction

Horse Race

featureset 1

  • alter the code of the track.js object to make a horse race
  • add more horses given the examples already present
  • make the horses race and declare a winner when they get to the right!
  • handleHorseUpdate is
    • passed into each horse
    • called by each horse update (every time it moves itself)
    • is given arguments of
      • horse: (Horse object) the horse that finished its update
      • type: (string) the type of update ('moved or reset')
  • handleUpdates
    • called on each update of the game

details

  • libraries/horse.js
    • code is basically pre-generated
    • constructor
      • takes in the following properties
        • name: name of the horse
        • number: number to put on the horse
        • horseClass: additional class to put on the horse (For styling)
        • imageFile: which file to use for the horse background
        • updateTime: how many ms to wait to update background image
        • updateCallback: function in parent to call after each horse update
        • index: which horse this is in the main game (for tracking)
    • methods available:
      • run:
        • purpose: make the horse start its running animation
        • params: none
        • return: none
      • stop:
        • purpose: make the horse stop its running animation
        • params: none
        • return: none
      • getPosition:
        • purpose: get the current left/top of the horse in its parent
        • params: none
        • return: object { left, top} : pixels of current dom position
      • getProperties:
        • purpose: get all properties of the horse, like name and such
        • params: none
        • return: object with all of the properties of the horse
      • isRunning:
        • purpose: get current state of horse running
        • params: none
        • return: boolean - true if running, false if not running
      • resetPosition:
        • purpose: reset the horse's left position back to 0
        • params: none
        • return: none
      • move the horse a distance
        • purpose: move the horse a distance
        • params: (int) the distance to move the horse on the page
        • return: none

js_ooppractice3's People

Contributors

dpaschal-lf avatar

Watchers

James Cloos 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.