|
- 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!
- Find an appropriate backdrop (ocean if you are doing fish, space if spaceships, etc) and add the url to the setBackdropURL call
- On the web, find two transparent images: a hunter (crab) and a food (fish). Save the URL's for the images.
- Add two sprite images. Use code from the Sprites & Backgrounds section of the Woof documentation.
Now change the url: attribute in the sprite object to be that of the crab,fish, alien etc images you found.
- Add a forever function to your code. (Hint: look in the Control section of the Woof documentation)
This will take care of updating changes in the game in real time.
- Inside the forever function, get your Crab to move in 4 directions if arrow keys are pressed.
Look in the Sensing section if there is an instruction that checks if a key is pressed. Copy it and put it inside an if statement:
Something like:
if (keysDown.includes('UP')) {
//move the crab up 5 pixels
}
- Declare a Text sprite lable to show points.
- Add a check for the Crab catching the fish. If this happens, add points, and move the fish to a random spot on the screen.
- Check for Crab hitting the edges of the screen and react appropriately.
- Create a timer variable and set it to however many seconds you want the game to last.
- Add an every function, cycling every second. (Look in the Control section.)
Inside the every function, decrease the timer by 1, and when the timer runs down, stop the game.
- Play a sound every time the crab gets a point.
- Keep working on the project and customizing until you are satisfied.
Ask your teacher/TA to upload it to your public folder.
|
|