To get full marks for this lab assignment, you must:
1720_W17_Lab06Exercises.zip
.
Then
submit your solution using the following command in a terminal
(make sure you are in the directory containing the file you are submitting):
submit 1720 lab6 1720_W17_Lab06Exercises.zip
Make sure you submit before the lab ends.
imagePackage
API.
The API of the classes in the simulation_Lab06Version
package is in the doc
directory of the Eclipse project.
AppDriver.java
.
You will see that the simulation is a solution to Task #5 from the Lab05 exercises. However, by examining the code base, you will see a number of modifications:
AnimationModel_Delegated_V2
has been renamed AnimationModel
.
FrameDrawer_Squiggle_Task5
has been renamed AnimationController
.
AnimatorController
now has a parameter; it requires an AnimationModel
. (In the code base from Lab05 exercises, the AnimationModel
was instantiated inside the AnimatorController
constructor.)
private Collection<BasicSprite> myCollection;
whereas the assignment statement is of this form:
myCollection = new ArrayList<BasicSprite>();
Tasks to perform:
ArrayList
object to a variable of type
Collection
.
AnimationModel
class so that all of the
elements of in the collection are of type
BasicSpriteTypeHorizontal
rather than
BasicSprite
.
Run the app and observe the new behaviour.
AnimationModel
class so that all of the elements of in the collection are of type BasicSpriteTypeVertical
rather than BasicSprite
. Run the app and observe the new behaviour.
Tasks to perform:
BasicSprite
, 20 BasicSpriteTypeHorizontal
, and 20
BasicSpriteTypeVertical
.
Use only one collection.
Hint: Notice that all three of the different sprites implement the Sprite
interface.
Sprites
within it. It is encapsulated by the class AnimationModel
.
Sprite
behaviours directly, since
each Sprite encapsulates its own type of behaviours.
Observee
, which is dispatching ActionEvents
at
regular intervals. When an ActionEvent
is detected, the controller's
actionPerformed(ActionEvent)
method is invoked.
Observee
happens in the SimulationRunnable
class.
Sprite
interface. It can be similar
to the supplied ones, but you should change at least one observable feature
of the sprite, such as colour, shape, motion, etc.
Hint: Notice that the AnimationModel
class implements the
Model
interface.