Due: Tuesday 12/10 10:00am
Submission name: work30_stamp
Grab the stampIt
starter code from thesource
. It’s a program where the user controls a circle with either their mouse or the keyboard, and can then “stamp” the circle on the screen, and create a new circle to move around. By overloading the constructor and move
methods, you will add functionality to the program. Notes on the program:
- In
MOUSE_MODE
, the circle’s position is set by the mouse, callingmove(mouseX, mouseY)
. The driver functionstamp
is called when the mouse is pressed. This code is all provided. - In
KEY_MODE
, the circle’s position is modified based on keystrokes and other modifiers. The driver functionstamp
is called when space is pressed. - The
moveMode
driver variable should be changed with different keys, and then differentmove
methods (defined below). Will be called based onmoveMode
Methods to overload
- Overload the constructor with one that only takes the size as an argument. The position should be a random valid point in the screen.
- Modify the keypress for space so that this constructor is called.
- For the following versions of move, add a key listener that will change
moveMode
and then call the correct method. move
- use
n
to setmoveMode
toNORMAL
:move(int direction)
- moves up/down/left/right based on
direction
.
- moves up/down/left/right based on
- use
g
to setmoveMode
toRESIZE
:move(int direction, float sizeFactor)
- moves up/down/left/right based on
direction
. - multiplies size based on sizeFactor.
- you can pass any values you’d like to
sizeFactor
- moves up/down/left/right based on
- use
r
to setmoveMode
toRANDOM
:move()
- moves to a randomly set location.
- use