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
Diff: main.cpp
- Revision:
- 7:bbc2b75c1418
- Parent:
- 6:8741d2011692
- Child:
- 8:5327418f823a
--- a/main.cpp Tue Mar 19 11:34:21 2019 +0000 +++ b/main.cpp Wed Mar 20 17:56:55 2019 +0000 @@ -18,27 +18,36 @@ N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; Engine game_engine; -Map map; +//Map map; void init_game(); -void run_game(); +void run_game(int t); + +/* Line line_1; Line line_2; Line line_3; int length_1; int length_2; int length_3; +*/ + +int t = 0; int main(){ init_game(); + /* map.init(); srand(time(NULL)); - +*/ while(1){ lcd.clear(); - //run_game(); + + /* + + run_game(); length_1 = (rand() %20)+10; length_2 = (rand() %20)+10; length_3 = (rand() %20)+10; @@ -58,8 +67,17 @@ lcd.drawLine(line_3.x_start,line_3.y,line_3.x_end,line_3.y,FILL_BLACK); wait(0.1); + + */ + + run_game(t); + //wait(0.1); lcd.refresh(); wait(0.01); + t++; + if(t == 100) { + t = 0; + } } } @@ -72,11 +90,16 @@ lcd.setBrightness(0.5); } -void run_game() { +void run_game(int t) { game_engine.read_input(gamepad); + + if( t % 10 == 0 ){ + game_engine.generate_map(); + } + game_engine.find_level(); game_engine.process_y(); - game_engine.process_x(); + game_engine.process_x(t); game_engine.process_sprite(); game_engine.update_lcd(lcd); } \ No newline at end of file