You are on page 1of 3

Custom Program Plan

Name: Joffa Ling Jun Xiang


Student ID: 204385109

1. Provide a summary of your program, maybe write up a paragraph or two to describe what does it
do? What are some of the key features etc.

It is simple gaming program named “Food Hunter” based in the SDL library. In this game,
there is a hunter who is directed by arrow keys to move in a window and capture different species
of foods that appear randomly on the screen. A hunter earns points when he eats food and each
kind of food gives him a specified score. It has a feature of the score, a boundary that triggers the
game over upon crossing, the menu screen at the beginning, and the game over the screen along
with the final score. These images are texture mapped from image files, while hunting sounds
accompany catching food by the hunter. It involves several SDL elements like event management,
graphics display, as well as sound playing. Furthermore, it uses structures, enums, and functions to
ensure that the code is well arranged. So, in sum, this project describes the foundation for an
outline in a 2D game with basic gameplay mechanics and interactivity.

2. Drawing a picture of what you want it to look like, sketch the first few interfaces that will be shown
when the program is run.
Menu Screen

Game Screen

Game Over Screen


3. List and describe some of the main data types:

Field Name Data Type Description Example of value


CORRECT, Enumerated Represents whether the CORRECT
NOTHING type hunter has successfully eaten
food or not.
available, x, y, Struct Represents a food item in the { true, 200, 300, 1,
food_index, game, including its <SDL_Texture*> }
texture availability, position, index,
and texture.
renderer, font, Function Draws the player's score on draw_score(renderer, font, 10)
score the game window.
renderer, font Function Draws the game menu on the draw_menu(renderer, font)
window.
renderer, Function Draws the background of the draw_background(renderer,
background game window. texture_space)
renderer, Function Draws the hunter character draw_hunter(renderer, hunter)
hunter on the game window.
renderer, Function Draws the food items on the draw_food(renderer,
food_array game window. food_array)
hunter Function Moves the hunter character move_hunter(&hunter)
based on its direction.
renderer, font, Function Draws the game over screen draw_game_over(renderer,
score with the final score. font, 20)
hunter, Function Checks if the hunter has hunter_eat_food(hunter,
food_array eaten any food. food_array)
x, y, direction, Struct Represents the hunter { 350, 250, 0, 1, <SDL_Texture*>
food_index, character in the game, }
texture_hunter including its position,
direction, food index, and
texture.
food_array, Function Adds new food or moves add_or_move_food(food_array,
texture_food existing food in the game. texture_food)
4. Describe the main functions and procedures. Have enough that you can start to see how the
program will continue to develop as you progress. (eg: initialize, draw, update etc)
Function /Procedure/Method Description
draw_score Function: Draws the player's score on the screen using SDL
rendering.
Uses SDL functions for rendering text.

draw_menu Function: Draws the menu screen with options to play or quit.
Uses SDL functions for rendering text.

draw_background Function: Sets the render color, clears the renderer, and draws the
background image.
draw_hunter Function: Draws the hunter on the screen based on its position and
texture.
draw_food Function: Draws the available food items on the screen.
hunter_eat_food Function: Checks if the hunter's mouth is close enough to any
available food to eat it.
add_or_move_food Handles logic for moving existing food items and adding
Function: new ones based on time intervals.
move_hunter Function: Moves the hunter based on its current direction.
draw_game_over Function: Draws the game over screen with the final score.
main Function: The main entry point of the program.
Initializes SDL, TTF, and IMG.
Loads audio and images.
Handles game loop, user input, and game state
transitions.
Manages cleanup and resource freeing at the end.

You might also like