Now we're going to add a tennis ball that the cat can throw at the bat; hitting the bat bumps your score by one.
This uses concepts we've already used before.
Create a new variable for all sprites called 'cat direction' and add a script to the cat:
Now we're going to pick up that event and use it to start a ball off in the direction the cat is pointing.
Add a new sprite and choose the tennis ball from the 'Things' collection, shrink it down a bit and rename it to 'ball'.
Add the following script; you'll want to do this bit by bit, start off with the third script "when I receive throw ball":
|
Teaching a class to program > Modules >