Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Ball Class Reference
Ball Class , Controls the ball in the Breakout game, inherits from GameObject, because the ball is a game object. More...
#include <Ball.h>
Inherits GameObject.
Public Member Functions | |
| Ball () | |
| Constructor. | |
| ~Ball () | |
| Destructor. | |
| virtual void | move () |
| Controls movement physics of paddle. | |
| void | hitPad (Paddle &paddle) |
| Checks for collision between ball and paddle and resolves it. | |
| int | randomize () |
| Randomizes the initial x-direction of the ball. | |
| void | reset () |
| Resets ball to initial starting point. | |
| Vector2D & | getVelocity () |
| Gets the velocity of the game object. | |
| virtual void | draw (N5110 &lcd) |
| Draws the game object. | |
| const Vector2D & | getPos () const |
| Gets the x and y coordinates of game object. | |
| int | getW () |
| Gets the width of the game object. | |
| int | getH () |
| Gets the height of the game object. | |
| void | setW (int value) |
| Sets the width of any game object. | |
Protected Attributes | |
| Vector2D | pos |
| width and height of any game object | |
Detailed Description
Ball Class , Controls the ball in the Breakout game, inherits from GameObject, because the ball is a game object.
- Date:
- March 2019
Definition at line 16 of file Ball.h.
Constructor & Destructor Documentation
Member Function Documentation
| void draw | ( | N5110 & | lcd ) | [virtual, inherited] |
| int getH | ( | ) | [inherited] |
Gets the height of the game object.
- Returns:
- the height of the game object
Definition at line 34 of file GameObject.h.
| const Vector2D & getPos | ( | ) | const [inherited] |
Gets the x and y coordinates of game object.
Definition at line 11 of file GameObject.cpp.
| Vector2D& getVelocity | ( | ) | [inherited] |
Gets the velocity of the game object.
- Returns:
- the velocity of the game object
Definition at line 61 of file GameObject.h.
| int getW | ( | ) | [inherited] |
Gets the width of the game object.
- Returns:
- the width of the game object
Definition at line 30 of file GameObject.h.
| void hitPad | ( | Paddle & | paddle ) |
| void move | ( | ) | [virtual] |
Controls movement physics of paddle.
Reimplemented from GameObject.
| int randomize | ( | ) |
| void setW | ( | int | value ) | [inherited] |
Sets the width of any game object.
- Parameters:
-
value - sets the width of the game objects equal to it
Used for the power-up features
Definition at line 39 of file GameObject.h.
Field Documentation
width and height of any game object
Definition at line 42 of file GameObject.h.
Generated on Thu Jul 14 2022 02:02:53 by
1.7.2