Eduardo Nava / Mbed 2 deprecated MazeRunner_Fall2017

Dependencies:   4DGL-uLCD-SE mbed wave_player

Fork of MazeRunner_Fall2017-shell by Eduardo Nava

Committer:
navaem
Date:
Fri Dec 29 15:32:31 2017 +0000
Revision:
1:2c6ae0fe9a2a
Parent:
0:cf4396614a79
December 29, 2017;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rconnorlawson 0:cf4396614a79 1 #pragma once
rconnorlawson 0:cf4396614a79 2
rconnorlawson 0:cf4396614a79 3 // Forward declarations
rconnorlawson 0:cf4396614a79 4 struct Physics;
rconnorlawson 0:cf4396614a79 5 struct Entity;
rconnorlawson 0:cf4396614a79 6
rconnorlawson 0:cf4396614a79 7 /**
rconnorlawson 0:cf4396614a79 8 * Structure to represent a Wall in the arena.
rconnorlawson 0:cf4396614a79 9 *
rconnorlawson 0:cf4396614a79 10 * This structure is a ArenaElement; its first data element is an integer (type)
rconnorlawson 0:cf4396614a79 11 * whose value is always WALL.
rconnorlawson 0:cf4396614a79 12 */
rconnorlawson 0:cf4396614a79 13 struct Wall {
rconnorlawson 0:cf4396614a79 14 int type;
rconnorlawson 0:cf4396614a79 15 int direction;
rconnorlawson 0:cf4396614a79 16 int x, y;
rconnorlawson 0:cf4396614a79 17 int length;
rconnorlawson 0:cf4396614a79 18 float bounce;
rconnorlawson 0:cf4396614a79 19 int should_draw;
rconnorlawson 0:cf4396614a79 20 };
rconnorlawson 0:cf4396614a79 21
rconnorlawson 0:cf4396614a79 22 // Directions
rconnorlawson 0:cf4396614a79 23 #define HORIZONTAL 0
rconnorlawson 0:cf4396614a79 24 #define VERTICAL 1
rconnorlawson 0:cf4396614a79 25
rconnorlawson 0:cf4396614a79 26 /**
rconnorlawson 0:cf4396614a79 27 * Allocate and initialize a new wall object.
rconnorlawson 0:cf4396614a79 28 *
rconnorlawson 0:cf4396614a79 29 * @param[in] direction The direction of the wall (HORIZONTAL or VERTICAL)
rconnorlawson 0:cf4396614a79 30 * @param[in] x The x location of the origin of the wall
rconnorlawson 0:cf4396614a79 31 * @param[in] y The y location of the origin of the wall
rconnorlawson 0:cf4396614a79 32 * @param[in] length The length of the wall. (HORIZONTAL = right, VERTICAL = down)
rconnorlawson 0:cf4396614a79 33 * @param[in] bounce The coefficient of bounciness for the wall. Between 0 and 1.
rconnorlawson 0:cf4396614a79 34 * @return The newly initialized wall.
rconnorlawson 0:cf4396614a79 35 */
rconnorlawson 0:cf4396614a79 36 Wall* create_wall(int direction, int x, int y, int length, float bounce);
rconnorlawson 0:cf4396614a79 37
rconnorlawson 0:cf4396614a79 38 /**
rconnorlawson 0:cf4396614a79 39 * Computes the physics update for a wall.
rconnorlawson 0:cf4396614a79 40 *
rconnorlawson 0:cf4396614a79 41 * @param[out] phys The result physics update. Assumed valid at function start.
rconnorlawson 0:cf4396614a79 42 * @param[in] ball The ball to update
rconnorlawson 0:cf4396614a79 43 * @param[in] wall The wall to bounce off of
rconnorlawson 0:cf4396614a79 44 * @param[in] delta The elapsed time, in seconds, since the previous update
navaem 1:2c6ae0fe9a2a 45 * @return hit if the wall was hit or not
rconnorlawson 0:cf4396614a79 46 */
navaem 1:2c6ae0fe9a2a 47 int do_wall(Physics* next, const Physics* curr, Wall* wall, float delta);
rconnorlawson 0:cf4396614a79 48
rconnorlawson 0:cf4396614a79 49 /**
rconnorlawson 0:cf4396614a79 50 * Draws a given wall to the screen.
rconnorlawson 0:cf4396614a79 51 *
rconnorlawson 0:cf4396614a79 52 * @param[in] wall The wall to draw
rconnorlawson 0:cf4396614a79 53 */
rconnorlawson 0:cf4396614a79 54 void draw_wall(Wall* wall);