Chukwuebuka Nwibe
/
el16ccn
el16ccn_maze
Diff: MazeEngine/MazeEngine.cpp
- Revision:
- 9:73888767b4db
- Parent:
- 7:cfd0854eee25
--- a/MazeEngine/MazeEngine.cpp Tue May 08 10:48:51 2018 +0000 +++ b/MazeEngine/MazeEngine.cpp Tue May 08 14:17:41 2018 +0000 @@ -31,7 +31,7 @@ } - +//reads joystick input ans sets them to control ball movememnt void MazeEngine::readInput(Gamepad &pad) { _control = true; @@ -47,7 +47,6 @@ return; } - // lcd.drawCircle(70, 41, 2, FILL_BLACK); //update ball position based on input (using joystick) _ball.update(position); @@ -138,6 +137,8 @@ } + +//gets joystick input as mapped coordinate(x,y) void MazeEngine::getJoystickInput(Gamepad &pad) { position = pad.get_mapped_coord(); @@ -145,12 +146,14 @@ } + +//check if maze has been completed +//boolean variable where true = completed and false = not completed +//only true if x (x coordinate of ball centre) > 83 (maximum x for lcd buffer) bool MazeEngine::checkFinish() { Vector2D position = _ball.getPosition(); - - // completion when ball goes outside map for all mazes apart - // from extreme (mazeIndex 9) + if (position.x > 86){ _finish = true; @@ -162,7 +165,7 @@ } - +//draw needed maze and ball for particular level and ball type void MazeEngine::draw(N5110 &lcd, Visuals &visual) { _ball.draw(lcd);