Code Correctness
As always, this assignment has a particular set of design features that we expect you to focus on. This time, there is only one new one: encapsulation (hiding data from
clients of structures in the .c
files). Here’s the list of the other design features we’ve already highlighted:
- code duplication
- good variable and function names
- procedural decomposition
- “overcommenting” (e.g., the comments do not explain things that are already clear from the code itself)
- usage of whitespace
- overmodularization (e.g., modularizing into functions that actually make the code less clear)
Demo
This week, you will be implementing a “pacman” demo which should look something like the following (the arrow keys on the bottom are an overlay to show you what is being pressed–not part of the scene):
This week’s demo is a pacman-like game in which pacman runs around the screen eating pellets. The novel SDL feature this week is keyboard events. The user should
be able to control pacman using the arrow keys. Notably, this means we have updated sdl_wrapper
to include keyboard related management. You will need to integrate this with your code.
We expect your demo to contain (at least) the following:
- pacman should move around and change direction based on the arrow keys
- pacman should accelerate proportionally to how long the key has been held down
- pellets spawn in random locations at some interval
- when pacman runs into a pellet, it should disappear
- pacman should ‘wrap around’ the screen in both directions
We have given you the implementation to create the pacman shape and pellet bodies.
So far, our demos have had a lot of repeated code. One of the goals this week is to create an abstraction around the demos, specifically where you will be using a scene abstraction and body abstraction into the pacman demo.
Note that you will not be needing to implement body and scene as the game person (the engine person will do it this week). Instead refer to the body.h
and the scene.h
file to see how you can utilize them in the demo.
If your team has rotated roles correctly, you should have done the game last week. Before you get started, we highly encourage you to talk with your teammates to learn about what they implemented in the engine in previous weeks!
Task 0. When you are done, your group should meet and complete the questions here.