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.
Dependencies: mbed
Fork of el17zl by
Diff: PushingEngine/PushingEngine.h
- Revision:
- 13:5930f0e5889d
- Parent:
- 11:f5d0ea7e4b74
- Child:
- 16:27c284d8b01b
--- a/PushingEngine/PushingEngine.h Sun Apr 28 17:56:09 2019 +0000
+++ b/PushingEngine/PushingEngine.h Tue Apr 30 09:58:30 2019 +0000
@@ -9,25 +9,68 @@
#include "Cross.h"
#include "Menu.h"
-
+/** PushingEngine Class
+@author Zhenwen liao, University of Leeds
+@brief Controls the Pushing and Determining Move in the Sokoban game
+@date 04 2019
+*/
class PushingEngine
{
public:
+ /** Constructor */
PushingEngine();
+
+ /** Destructor */
~PushingEngine();
+ /** Initialise the first position of two boxes, ppl, two crosses and initial reading of Menu parameter
+ * @param box1_x @details the first x position of box1 (int)
+ * @param box1_y @details the first y position of box1 (int)
+ * @param box2_x @details the first x position of box2 (int)
+ * @param box2_y @details the first y position of box2 (int)
+ * @param ppl_x @details the first x position of ppl (int)
+ * @param ppl_y @details the first y position of ppl (int)
+ * @param cross1_x @details the first x position of cross1 (int)
+ * @param cross1_y @details the first y position of cross1 (int)
+ * @param cross2_x @details the first x position of cross2 (int)
+ * @param cross2_y @details the first y position of cross2 (int)
+ * @param menu_x @details the initial reading of level for menu (int)
+ * @param menu_y @details the initial reading of level confirmation for menu (int)
+ */
void init(int box1_x,int box1_y,int box2_x,int box2_y,int ppl_x,int ppl_y,
int cross1_x,int cross1_y,int cross2_x,int cross2_y,int menu_x,int menu_y);
+
+ /** Read the inputs from Gamepad
+ * @details Read the potentialmeter, botton A,B,X,Y
+ */
void read_input(Gamepad &pad);
+
+ /** Update the Pushing and determining proccess
+ * @details First,check box and ppl touching or not
+ * Second,check if next move of ppl will kick the box out off screen
+ * Third, update the parameter accorading to the determination of above function
+ * Fourth, reset the indicator for function
+ * Fifth, check if ppl will cover the box after next move
+ * Sixth, check if box and cross match each other and set the scores
+ */
void update(Gamepad &pad,int barrier_x,int barrier_y);
+
+ /** Draw all the oject on the screen*/
void draw(N5110 &lcd,int barrier_x,int barrier_y);
+
+ /** Set the score */
int set_score();
+
+ /** Get the Menu
+ * @return the parameter of current Menu state
+ */
Vector2D get_menu(N5110 &lcd,Gamepad &pad);
private:
-
+
+
void check_ppl_box1_touching(Gamepad &pad);
void check_ppl_box2_touching(Gamepad &pad);
void hold_ppl_box1_wall(Gamepad &pad);
