SA-1, due Mar 31
Make a blob that wanders a little more purposefully than the one from class, walking in a straight line for a fixed number of steps before switching. E.g., every 10 steps it picks a random new dx and dy, instead of doing that every step like Wanderer.
Exercises
You can mostly follow the structure of Wanderer, though when you're reviewing later, you might try doing this from a clean slate.
- Define a new subclass of
Blob; you can choose the name. - Give it instance variables indicating the number of steps between velocity changes, and how many of those it has currently gone since the last change.
- Define a constructor that takes initial
xandyvalues and invokes thesuperconstructor with them. The constructor should also set the number of steps between velocity changes, to be a random number between 10 and 20. - Override the
stepmethod so that random new values are assigned todxanddyeach time the required number of steps has been taken. - Modify the
BlobGUIto allow creation of an instance of your class.
Submission Instructions
Turn in your completed Java code.