Mochu Yao explorer game
Dependencies: mbed
Diff: Surface/surface.h
- Revision:
- 27:354d91d59b6d
- Parent:
- 26:4d193529b447
- Child:
- 28:4a1260ad0346
--- a/Surface/surface.h Tue Apr 28 17:39:26 2020 +0000 +++ b/Surface/surface.h Tue Apr 28 17:58:00 2020 +0000 @@ -10,7 +10,67 @@ int y; }; +//the line structer will have four main elements + +/** surface Class +* @1 the leftside of the line move toward right then the rightside should also move to the right to keep the length +* @2 the line will be random length but must be suitable +* @3 makesure there are two surface for player to stay +* @date April 22th 2020 +* @author Yaomochu +@code + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "surface.h" +#include <cstdlib> +#include <ctime> + +N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); +Gamepad gamepad; +Surface _surface; + +Line line_1_value; +Line line_2_value; +Line line_3_value; +Line line_4_value; +Line line_5_value; +Line line_6_value; + +int main() { + _surface.init(20,40); + while(1) { + //draw line 1 + _surface.line_1(); + line_1_value = _surface.getline_1(); + lcd.drawLine(line_1_value.left,line_1_value.y,line_1_value.right,line_1_value.y,FILL_BLACK); + //draw line 2 + _surface.line_2(); + line_2_value = _surface.getline_2(); + lcd.drawLine(line_2_value.left,line_2_value.y,line_2_value.right,line_2_value.y,FILL_BLACK); + //draw line 3 + _surface.line_3(); + line_3_value = _surface.getline_3(); + lcd.drawLine(line_3_value.left,line_3_value.y,line_3_value.right,line_3_value.y,FILL_BLACK); + //draw line 4 + _surface.line_4(); + line_4_value = _surface.getline_4(); + lcd.drawLine(line_4_value.left,line_4_value.y,line_4_value.right,line_4_value.y,FILL_BLACK); + //draw line 5 + _surface.line_5(); + line_3_value = _surface.getline_5(); + lcd.drawLine(line_5_value.left,line_5_value.y,line_5_value.right,line_5_value.y,FILL_BLACK); + //draw line 6 + _surface.line_6(); + line_6_value = _surface.getline_6(); + lcd.drawLine(line_6_value.left,line_6_value.y,line_6_value.right,line_6_value.y,FILL_BLACK); + } +} + +@endcode +*/ //the surface function is to creat the surface for player to stand on and move class Surface {