- If you are coding outside of WoofJS.com (like in Sublime), insert the Woof_JS source tag into the <head>section of your project page:
<script src="https://rawgit.com/stevekrouse/WoofJS/master/dist/woof.js"></script>
Your code now speaks Woof!
- Select a background for your course that matces your theme.
- Create your ball and destination (hole and green, the planet Earth). These can be images or just a circe. Place them on the screen in opposite corners
- Create a new Line for your flight vector - the direction where your rocket will go. Give it a bright color. Hide it by default.
- When the mouse is clicked, show the vector line and make it go from the mouse pointer to the ball. Have it adjust as you move the mouse.
- When the mouse is released, have the vector line disappear and set the speed of the ball be the direction of the vector. Hint: the two components of ball speed (xSpeed and ySpeed) are a multiple of the xLength and yLength of the vector line.
- Add a forever loop, and move the ball by the X and Y speed components. Make the ball slow down as it travels across the course, so it should eventually come to a stop.
- Have the ball "bounce off" as it hits edges of the screen.
- Add 3-4 barriers on the screen. Use the "bounce off" function you wrote to have the rocket bounce off the barriers.
- Create obstacles and set them up in the middle of the course to block the ball.
- Create a variable that counts how many strokes the player takes. Show it on the screen.
- Play a sound when you hit the ball.
- Check when the ball is in the hole, play a sound, stop the game and show the player score.
- Keep working on the project and customizing until you are satisfied.
Ask your teacher/TA to upload it to your public folder.