$29
School of Electrical Engineering and Computer Science
CptS 479 Mobile Application Development
Homework 12
General Instructions: Put the entire app directory into one zip file and submit as an attachment
under Content → Assignments → Homework 12 for this course on Blackboard Learn by the above
deadline. Note that you may submit multiple times, but only the most recent entry submitted before
the above deadline will be graded.
What Health App would be complete without a relaxing game of hunt the coronavirus. For this
homework you will implement a SpriteKit game that shoots rockets at the coronavirus. See
screenshots below. Specifically,
1. Create a new project called HealthApp that is a Game application and uses the SpriteKit
game technology.
2. In the GameViewController, set scene.scaleMode = .aspectFit and disable the displaying
of FPS and NodeCount.
3. In the GameScene, you can remove all the code, leaving only an empty didMove method
and touchesEnded method.
4. In the Game Scene editor, remove the “Hello, World!” label. Add a “Health App” label
centered at the top and a “Score: 0” label centered at the bottom.
5. The app will need two images: an image of the target (i.e., coronavirus) and an image of
the projectile (i.e., rocket). The width and height of these images should be 128 pixels or
less. You may use different images for the target and projectile, as long as they comply
with the width and height requirement.
6. When the app starts, a target should spawn every 3 seconds. The target should spawn in a
random location with a random impulse (-200 ≤ dx ≤ 200 and -200 ≤ dy ≤ 200). The
target node should have affectedByGravity=false, linearDamping=0, and restitution=1.
The target should collide with other targets and with the side of the screen. When a target
comes into contact with a projectile, both objects should be removed from the scene, and
the score should increase by 1.
7. Anytime the user taps on the screen at position (x,y), a projectile should be spawned at the
same x position, but at the bottom of the screen. The projectile node should have
affectedByGravity=false, linearDamping=0, and velocity=(0,200), i.e., straight up. The
projectile should not collide with anything. When a projectile comes into contact with a
target, both objects should be removed from the scene, and the score should increase by 1.
2
8. Test your app using the iPhone 11 simulator, which is the same simulator we will use to
grade your app.
9. You may assume your app will be tested in portrait mode only.
Scene Editor:
3
Simulator: