- struct holding a set of keyboard bindings
- struct holding a “player” object
- Consists of a Rect, Controls, and current x and y velocity
- struct containing 4 rgba ints
- struct containing an SDL_Rect and a color
- a container for multiple “Rect” structs
- consists of a pointer to a list of “Rect” structs and its size in ints
- Initialize SDL stuff
- (While testing) initialize objects and player
- Begin running the game
- Check to see if left or right keys are held
- Clear the screen
- Pop event off the queue and process
- Render platforms
- Move player
- Render player
- Check if level is complete
- Handle FPS control
- Render frame
- Handle errors
- Close program
A level can be loaded from a .txt file. The files should be saved in the assets/levels path. The .txt file lines should correspond to the following format:
- Background color
- Player model
- Number of platforms
- The remaining lines should be the list of platforms in the level, one platform per line
Here is an example file in table format. In an actual file, each row would only have the values separated by spaces.
Line 1 (Background Color):
| r | g | b | a |
|---|---|---|---|
| 0 | 0 | 0 | 255 |
Line 2 (Player. Color and controls are set by defaults):
| Rect rect | |
| SDL Rect shape | |
| x | y |
|---|---|
| 50 | 50 |
Line 3 (Number of platforms):
5
Remaining lines (list of Rect):
| SDL Rect shape | Color color | int damaging | ||||||
| x | y | w | h | r | g | b | a | |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 1000 | 50 | 255 | 0 | 0 | 255 | 0 |
| 50 | 300 | 50 | 50 | 255 | 0 | 0 | 255 | 1 |
| 300 | 20 | 50 | 50 | 255 | 0 | 0 | 255 | 1 |
| 400 | 20 | 50 | 50 | 255 | 0 | 0 | 255 | 1 |
| 800 | 200 | 500 | 50 | 255 | 0 | 0 | 255 | 0 |
Example file:
0 0 0 255 50 50 5 0 0 1000 255 0 0 255 0 50 300 50 255 0 0 255 1 300 20 50 255 0 0 255 1 400 20 50 255 0 0 255 1 800 200 500 255 0 0 255 0
- How to handle this?
- Lazy Foo scrolling tutorial
- Need to pass camera to rendering functions
- Done: now handles horizontal scrolling