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: 4DGL-uLCD-SE Motor SparkfunAnalogJoystick mbed
Fork of Fire_Mbed_2_0 by
Diff: main.cpp
- Revision:
- 2:ccfe87a5ccba
- Parent:
- 1:3a9ef60cbbfc
- Child:
- 3:275705c872e0
--- a/main.cpp Tue May 02 02:53:25 2017 +0000 +++ b/main.cpp Tue May 02 03:37:35 2017 +0000 @@ -26,12 +26,14 @@ DigitalIn pb8(p8); #define M_PI 3.14159265358979323846 Serial pc(USBTX, USBRX); +Serial Julio_Mbed(p28,p27); SparkfunAnalogJoystick joysttick(p18, p19, p20); #define x_sector 0x003B int analog2Keypad(SparkfunAnalogJoystick *joystick); int player_turn; +char stagenumber = 0; -typedef struct tiles { +struct tiles { char v; int x; int y; @@ -48,14 +50,14 @@ typedef struct units { job_t job; - int v; + char v; int FoF;//1 = USER // 2= COMP int xloc; int yloc; int xlast; int ylast; - int remain_moves; - int health; + char remain_moves; + char health; int status; } person_t; @@ -161,7 +163,7 @@ void initialize(void){ - //init_jobs(); + init_jobs(); // keep_t.x = x_sector; // house_t.x = x_sector; // grass_t.x = x_sector; @@ -199,6 +201,12 @@ //get map //get units //send julio the char[2] {255, map/track number} + uLCD.printf("Load Map\r\n"); + //put read from gui map code here + uLCD.printf("Load Units\r\n"); + //put read units from gui code here + uLCD.printf("New Game\r\n"); + uLCD.printf("Or Continue\r\n"); uLCD.set_sector_address(Mapx, Mapy); uLCD.display_image(0,0); Mc.job = Lord; @@ -323,7 +331,6 @@ int person_index = 0; int tile_index = 0; int keypad = 5; - int ret =0; person_t* temp_person; tiles tile_erased; int j = pb5; @@ -468,6 +475,16 @@ state = 0; return 0; } + Julio_Mbed.putc(1); + Julio_Mbed.putc(User_person->v); + Julio_Mbed.putc(User_person->health); + Julio_Mbed.putc(User_person->job.maxHealth); + Julio_Mbed.putc(User_person->job.v); + Julio_Mbed.putc(User_person->job.attack); + Julio_Mbed.putc(User_person->job.movement); + Julio_Mbed.putc(User_person->job.rng); + Julio_Mbed.putc(User_person->job.defence); + Julio_Mbed.putc(User_person->job.res); int j = pb7; int xloc_u = 1; int yloc_u = 1; @@ -991,6 +1008,8 @@ void load_units_map(){ int y_num; int x_num; + Julio_Mbed.putc(2); + Julio_Mbed.putc(stagenumber); tiles tile_draw; person_t* draw_unit; //draw map