; ; ALIEN BLOCKADE ; ; ; ; In this assignment you will use universe to create a
ID: 3533241 • Letter: #
Question
; ; ALIEN BLOCKADE
; ;
; ; In this assignment you will use universe to create a simple game. In this game you must pilot a
; ; rocket around invading aliens to reach "space" (the top of the screen).
; ;
; ;
; ; The Problem
; ;
; ; When you are finished, your game should contain the following:
; ;
; ; A rocket that moves continuously towards the top of the screen from the bottom. The user can
; ; control the left-right motion of the rocket with the arrow keys.
; ;
; ; If the rocket gets to the side of the screen, it should hit a wall (and not be able to fly
; ; off the side of the screen).
; ;
; ; Three UFOs moving left and right across the screen. All three should have different random
; ; starting X positions, different random starting Y positions, and different speeds. The position
; ; should be "random" but constrained so as to make sense.
; ;
; ; The UFOs should detect collisions with the edge of the screen and move the other way after colliding.
; ;
; ; If the rocket hits any of the UFOs the rocket is destroyed and the game should end.
; ;
; ; If the rocket reaches the top of the screen (outer space) the game should end and a victory message
; ; should be displayed.
; ;
; ;
; ; To make the assignment easier, you may want to break it up into simpler steps such as:
; ;
; ; Draw a rocket on the screen and have it move from the bottom to the top.
; ;
; ; Add UFOs drawn standing still at different starting x and y positions.
; ;
; ; Make the Rocket horizontally controllable by keyboard arrows.
; ;
; ; Make the UFOs move from left to right across the screen.
; ;
; ; Add collisions between the UFOs and the walls.
; ;
; ; Add collision detection between the UFOs and the rocket and add a rocket-destroyed final scene
; ;
; ; Testing
; ;
; ; Your test cases will be a major part of your grade on this assignment.
;
Explanation / Answer
Your Racket should look like Racket, not Java. We expect you to follow the formatting conventions below:
This means, closing parentheses go on the same line, not the line below. You want the following:
(define (add-two num)
(+ num 2))
not:
(define (add-two num)
(+ num 2)
)
Name your variables using dashes to separate words. Don't camel case, don't use underscores. You want my-function not MyFunction, my_function or My-Function.
Try to keep the total length of your lines around 80 characters. You can bring arguments down to a new line if you have too many. Breaking up different arguments onto separate lines allows the reader to see what expressions are arguments to what other functions. This is much easier to read:
(a-very-long-function-name a-long-input-argument
an-even-longer-input-argument
an-even-even-longer-input-argument)
than:
(a-very-long-function-name a-long-input-argument an-even-longer-input-argument an-even-even-longer-input-argument)
If you bring arguments down to a new line, many coders will put all of the arguments on their own line, even if multiple arguments could be fit on the same line. However, this depends on the coder.
Comments - you should have them and they should say things that the function name doesn't already say.
Constants - should be named in all caps with hyphens. E.g: (define SOME-CONSTANT 2)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.