The lab is done in groups of 2 or 3.
Start with the balloon exercise and implement the world functionality as described below. The "world" is a multitude of randomly generated balloons that start at the botom of the screen and float up. The world state is a list of balloon structures. The structure is already defined in the file:
(define-struct balloon [x y size color])
;; example:
(make-balloon 100 200 2.5 "blue")
The x and y are the coordinates of the balloon, size is its size relative to
the example given in the file, and the color is its color.
balloon-picture
that takes a ballon structure
and returns the picture of the balloon of the given size and color.
It doesn't use the coordinates. the function must work according
to the two given check-expects.
draw-balloons
.
The function takes a list of balloon structures and returns a scene
width-by-height in which all baloons are placed one-by-one on top of the
empty scene.
move-balloons
according to its description.
Think of how the balloon positions change on every clock tick,
then write the list of balloon structures with the new positions.
Note that there is a speed
constant defined.
move-balloons
function so that when a balloon
disappears from the screen, it is removed from the list. You should write
a predicate is-visible?
that checks if a balloon is still
visible on the scene. This feature is very important for writing
games: if you don't remove invisible objects, you get too many
of them and your game starts slowing down.
move-balloons
function to add a new
balloon at the bottom of the screen at a random x coordinate and
of a random color and size (use color-chooser, feel free to add more
colors) on every clock tick. Add it to the
end of the list (the base case for the empty list). Think carefully of
what kind of thing the function needs to return (hint - look at the
signature!). Important: your check-expects will fail at this point;
comment them out or switch to check-random.
Name your file with the combination of your last names, no spaces, followed by the word "Lab"
and the lab number.
For instance,
if your last names are Smith and Lee, the file name should be SmithLeeLab6.rkt
If there are others in the class with the same name as yours, you your initial in addition
to your last name: MSmithJLeeLab6.rkt
At least one person in the group must submit it via canvas as a file upload (make sure it's that .rkt
file).
Make a comment indicating who you worked with. The other person (or people) in the group may submit the same file and also
indicate who was in the group or just make a comment listing all your group members (note: if you don't submit a note listing
your group members,
your work may not be counted, even if your group partners list you as the group member).