Simple Animation Program
Take the TwoBalls.java (Bounce2.java) program and do something better with it.
You'll also need Ball.java
You might be able to work with a partner on this as long as you both contribute.
Please use a new package for this program
Some ideas:
- make the balls follow you and try to hit your mouse (or the hitbox around it).
- maybe add a timer so that you only have to survive for 10 seconds (or perhaps accomplish something in 10 seconds).
or make a 3 balls that move at various speeds, these balls all want to follow your mouse - if they touch it you die.
Add some inertia to the largest ball so that once it starts moving, it's hard for it to stop or change direction
- make the balls avoid the mouse (draw a circle around the mouse cursor and all of the other balls want to avoid this circle at all costs)
- add in gravity
- make a maze ...
- have rectangular obstacles and get the balls to bounce off of them too
- or have multiple balls and have them bounce off each other
Planning
Before you write the program, plan out what you want to do.
- Write a short description of what the program will do (in just a couple of sentences).
- Do a diagram of what the screen looks like
- List your global variables.
- These should be as few as possible. Only the ones that are absolutely necessary.
- If any of them have a name that's not obvious, you must add a comment describing them.
- We've already used methods called "setup", "moveBalls", "drawGraphics", and perhaps "checkCollsion".
If you need any other methods, write down what you will call them and include a once sentence description of what they do.
- Write down what you need to know that you don't already know. If it's more than one thing, write them in point form
- If you're working with a partner, write down what each of you will be doing
Programming
We'll work on this for a few days. It won't be anything incredibly complex (like Jezzball or Qix or TowerDefense). We can do that later.
Testing
-- not much to do here I think
Marking
- Demonstrate that you know how to make objects move
- Make something more complicated than Bounce2.java
- You probably should not have more than 3 objects. It gets too complicated and we'll use arrays instead
- You should use collisions somehow - either hitting your mouse or two balls hitting each other (or ball and paddle)
- Proper form: good names, comments, indenting