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.h
00001 #ifndef BALL_H 00002 #define BALL_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "GameObject.h" 00007 #include "Gamepad.h" 00008 #include "Paddle.h" 00009 00010 /** Ball Class 00011 , Controls the ball in the Breakout game, inherits from GameObject, because the ball is a game object 00012 @author Kostadin Chakarov, University of Leeds 00013 @date March 2019 00014 */ 00015 00016 class Ball : public GameObject 00017 { 00018 00019 public: 00020 /** Constructor */ 00021 Ball(); 00022 /** Destructor */ 00023 ~Ball(); 00024 /** Controls movement physics of paddle */ 00025 virtual void move(); 00026 /** Checks for collision between ball and paddle and resolves it */ 00027 void hitPad(Paddle &paddle); 00028 /** Randomizes the initial x-direction of the ball 00029 * @return either 1 or -1 for the initial x-velocity of the ball 00030 */ 00031 int randomize(); 00032 /** Resets ball to initial starting point */ 00033 void reset(); 00034 00035 private: 00036 }; 00037 #endif
Generated on Thu Jul 14 2022 02:02:53 by
1.7.2