Game for Project 2
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Revision 0:7fe3c940e4b5, committed 2015-06-25
- Comitter:
- leuyentran
- Date:
- Thu Jun 25 14:35:52 2015 +0000
- Commit message:
- Georgia Tech ECE2035 Sum 15
Changed in this revision
diff -r 000000000000 -r 7fe3c940e4b5 4DGL-uLCD-SE.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4DGL-uLCD-SE.lib Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/4180_1/code/4DGL-uLCD-SE/#e39a44de229a
diff -r 000000000000 -r 7fe3c940e4b5 SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/neilt6/code/SDFileSystem/#c2c1f0b16380
diff -r 000000000000 -r 7fe3c940e4b5 Shiftbrite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Shiftbrite.h Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" + +//Setup a new class for a Shiftbrite RGB LED module +class Shiftbrite +{ +public: + Shiftbrite(PinName pin_e, PinName pin_l, PinName pin_do, PinName pin_di, PinName pin_clk); + void write(int red, int green, int blue); + +private: +//class sets up the pins + DigitalOut _pin_e; + DigitalOut _pin_l; + SPI _spi; +}; + +Shiftbrite::Shiftbrite(PinName pin_e, PinName pin_l, PinName pin_do, PinName pin_di, PinName pin_clk) + : _pin_e(pin_e), _pin_l(pin_l), _spi(pin_do, pin_di, pin_clk) +{ + // spi set up + _pin_e=0; + _pin_l=0; + _spi.format(16,0); + _spi.frequency(500000); +} + +void Shiftbrite::write(int red, int green, int blue) +{ + unsigned int low_color=0; + unsigned int high_color=0; + high_color=(blue<<4)|((red&0x3C0)>>6); + low_color=(((red&0x3F)<<10)|(green)); + _spi.write(high_color); + _spi.write(low_color); + _pin_l=1; + _pin_e=0; +}
diff -r 000000000000 -r 7fe3c940e4b5 globals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/globals.h Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,44 @@ +/* Gatech ECE2035 2015 SPRING PAC MAN + * Copyright (c) 2015 Gatech ECE2035 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef GLOBAL_H +#define GLOBAL_H + +#ifndef ULCD_4DGL_H_ +#define ULCD_4DGL_H_ +#include "uLCD_4DGL.h" +#endif + +// === [global object] === +extern uLCD_4DGL uLCD; + + +// === [global settings] === +#define BACKGROUND_COLOR 0x000000 +#define GRID_RADIUS 3 +#define GRID_SIZE 7 //(GRID_RADIUS*2+1) +#define NUM_GRID_X 17 +#define NUM_GRID_Y 16 +#define NUM_GRID 272 //(NUM_GRID_X*NUM_GRID_Y) + + + +#endif //GLOBAL_H \ No newline at end of file
diff -r 000000000000 -r 7fe3c940e4b5 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,115 @@ +// Include header files for platform +#include "mbed.h" +#include "wave_player.h" +#include "SDFileSystem.h" +#include "Shiftbrite.h" +#include <vector> + +// Include header files for pacman project +#include "globals.h" +#include "map_public.h" +#include "robot.h" + +//Platform initialization +DigitalIn left_pb(p24); // push bottom +DigitalIn right_pb(p21); // push bottom +DigitalIn up_pb(p22); // push bottom +DigitalIn down_pb(p23); // push bottom +uLCD_4DGL uLCD(p9,p10,p11); // LCD (serial tx, serial rx, reset pin;) + +DigitalOut myled(LED1); + +int main() +{ + // Initialize the timer + /// [Example of time control implementation] + /// Here is a rough example to implement the timer control <br><br> + int tick, pre_tick; + srand (time(NULL)); + Timer timer; + timer.start(); + tick = timer.read_ms(); + pre_tick = tick; + + // Initialize the buttons + left_pb.mode(PullUp); // The variable left_pb will be zero when the pushbutton for moving the player left is pressed + right_pb.mode(PullUp); // The variable rightt_pb will be zero when the pushbutton for moving the player right is pressed + up_pb.mode(PullUp); //the variable fire_pb will be zero when the pushbutton for firing a missile is pressed + down_pb.mode(PullUp); //the variable fire_pb will be zero when the pushbutton for firing a missile is pressed + + + /// [Example of the game control implementation] + /// Here is the example to initialize the game <br><br> + uLCD.cls(); + map_init(); + robot_init(0,8); + double x=0; + double y=8; + + /// 1. Begin the game loop + while(1) { + tick = timer.read_ms(); // Read current time + + /// 2. Implement the code to get user input and update the Pacman + /// -[Hint] Implement the code to move Pacman. You could use either push-button or accelerometer. <br> + + // [Some hints for user-input detection] + //acc.readXYZGravity(&x,&y,&z); //read accelerometer + uLCD.locate(0,1); + uLCD.printf("Score x%4.1f ",1); //You could remove this code if you already make the accelerometer work. + /// -[Hint] Here is a simple way to utilize the readings of accelerometer: + /// If x is larger than certain value (ex:0.3), then make the Pacman move right. + /// If x<-0.3, then make it move left. <br> + + + if((tick-pre_tick)>500) { // Time step control + pre_tick = tick; // update the previous tick + + /// 3. Update the Pacman on the screen + /// -[Hint] You could update the position of Pacman (draw it on the screen) here based on the user-input at step 2. <br> + if (!up_pb) { //MOVE UP + robot_clear(x,y); + map_draw_grid(x,y); + if (y!=0) { + y=y-1; + } else { + y=15; + } + wait(0.1); + robot_init(x,y); + } else if(!down_pb) { //MOVE DOWN + robot_clear(x,y); + map_draw_grid(x,y); + if(y!=15) { + y=y+1; + } else { + y=0; + } + wait(0.1); + robot_init(x,y); + } else if (!left_pb) { //MOVE LEFT + robot_clear(x,y); + map_draw_grid(x,y); + if (x!=0) { + x-=1; + } + wait(0.1); + robot_init(x,y); + + } else if(!right_pb) { //MOVE RIGHT + robot_clear(x,y); + map_draw_grid(x,y); + if (x!=16) { + x+=1; + } + wait(0.1); + robot_init(x,y); + } + + + + /// 4. Implement the code to check the end of game. + + } + } +} \ No newline at end of file
diff -r 000000000000 -r 7fe3c940e4b5 map/map.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/map/map.cpp Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,122 @@ +/* Gatech ECE2035 2015 SPRING PAC MAN + * Copyright (c) 2015 Gatech ECE2035 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "map_private.h" + +GRID map[NUM_GRID]; +int num_candy = 0; + +void map_init(){ + int i; + int start_x = (SIZE_X-GRID_SIZE*NUM_GRID_X)/2; + int start_y = (SIZE_Y-GRID_SIZE*NUM_GRID_Y); + char temp_wall_type[] = DEFAULT_MAP; + + for(i=0;i<NUM_GRID;i++){ + map[i].x = start_x + IDX2X(i)*GRID_SIZE; + map[i].y = start_y + IDX2Y(i)*GRID_SIZE; + switch(temp_wall_type[i]){ + case MAP_ATTRIBUTE_SIDE_WALK: + map[i].status = GRID_SIDE_WALK; + break; + case MAP_ATTRIBUTE_SIDE_WALK_2: + map[i].status = GRID_SIDE_WALK_2; + break; + case MAP_ATTRIBUTE_CANDY: + map[i].status = GRID_CANDY; + num_candy++; + break; + case MAP_ATTRIBUTE_BIG_CANDY: + map[i].status = GRID_BIG_CANDY; + num_candy++; + break; + case MAP_ATTRIBUTE_V_LINE: + map[i].status = GRID_V_LINE; + break; + case MAP_ATTRIBUTE_ROAD_L: + map[i].status = GRID_ROAD_L; + break; + case MAP_ATTRIBUTE_ROAD_R: + map[i].status = GRID_ROAD_R; + break; + default: + map[i].status = GRID_ROAD; + break; + } + } + map_draw(); +} + +void map_draw(){ + int i; + for(i=0;i<NUM_GRID;i++){ + map_draw_grid(IDX2X(i), IDX2Y(i)); + } +} + +void map_draw_grid(unsigned grid_x, unsigned grid_y) +{ + unsigned i=XY2IDX(grid_x,grid_y); + if(map[i].status==GRID_SIDE_WALK) { + uLCD.filled_rectangle(map[i].x, map[i].y, map[i].x+GRID_SIZE-1, map[i].y+GRID_SIZE-1, SIDE_WALK_COLOR); + } else if(map[i].status==GRID_SIDE_WALK_2) { + uLCD.filled_rectangle(map[i].x, map[i].y, map[i].x+GRID_SIZE-1, map[i].y+GRID_SIZE-1, SIDE_WALK_COLOR_2); + } else if(map[i].status==GRID_CANDY) { + uLCD.filled_circle(map[i].x+GRID_RADIUS, map[i].y+GRID_RADIUS, CANDY_RADIUS, CANDY_COLOR); + } else if(map[i].status==GRID_BIG_CANDY) { + uLCD.filled_circle(map[i].x+GRID_RADIUS, map[i].y+GRID_RADIUS, BIG_CANDY_RADIUS, CANDY_COLOR); + } else if(map[i].status==GRID_ROAD_L) { + if ((grid_x!=4)and ((grid_y%3)!=2)) { + //draw line on the LEFT + uLCD.filled_rectangle(map[i].x, map[i].y, map[i].x+1, map[i].y+GRID_SIZE-1, LINE_COLOR); + } + } else if(map[i].status==GRID_ROAD_R) { + if ((grid_x!=12)and ((grid_y%3)!=2)) { + //draw line on the RIGHT + uLCD.filled_rectangle(map[i].x+GRID_SIZE-1, map[i].y, map[i].x+GRID_SIZE, map[i].y+GRID_SIZE-1, LINE_COLOR); + } + } else if(map[i].status==GRID_V_LINE) { + if ((((grid_x%2)==1)and ((grid_y%2)==0)) or (((grid_x%2)==0)and ((grid_y%2)==1))) { + uLCD.filled_rectangle(map[i].x, map[i].y, map[i].x+GRID_SIZE-1, map[i].y+GRID_SIZE-1, WHITE); + } + } +} + +GRID map_get_grid_status(int grid_x, int grid_y){ + return map[XY2IDX(grid_x,grid_y)]; +} + +bool map_eat_candy(int grid_x, int grid_y){ + int idx=XY2IDX(grid_x,grid_y); + + if(map[idx].status==GRID_CANDY || map[idx].status==GRID_BIG_CANDY){ + map[idx].status = GRID_ROAD; + num_candy--; + return 1; + } + return 0; +} + +int map_remaining_candy(void){ + return num_candy; +} +
diff -r 000000000000 -r 7fe3c940e4b5 map/map_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/map/map_private.h Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,83 @@ +/* Gatech ECE2035 2015 SPRING PAC MAN + * Copyright (c) 2015 Gatech ECE2035 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef MAP_PRIVATE_H +#define MAP_PRIVATE_H + +#include "mbed.h" + +#ifndef ULCD_4DGL_H_ +#define ULCD_4DGL_H_ +#include "uLCD_4DGL.h" +#endif + +#include "globals.h" +#include "map_public.h" + +// It defines the settings for drawing the map +#define SIDE_WALK_COLOR_2 0x999999 +#define SIDE_WALK_COLOR 0x198C19 +#define LINE_COLOR 0xE5E500 +#define CANDY_COLOR 0xFF7F7F +#define CANDY_RADIUS 1 +#define BIG_CANDY_RADIUS 2 +#define WHITE 0xFFFFFF + + + +// It defines the values used in the DEFAULT_MAP +#define MAP_ATTRIBUTE_SIDE_WALK 0 //side walk +#define MAP_ATTRIBUTE_CANDY 1 //candy +#define MAP_ATTRIBUTE_BIG_CANDY 2 //big candy +#define MAP_ATTRIBUTE_ROAD_L 3 +#define MAP_ATTRIBUTE_ROAD 4 +#define MAP_ATTRIBUTE_ROAD_R 5 +#define MAP_ATTRIBUTE_V_LINE 6 +#define MAP_ATTRIBUTE_SIDE_WALK_2 7 + + +#define DEFAULT_MAP {\ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 1, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 2, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 1, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, \ +0, 0, 0, 7, 3, 4, 5, 3, 4, 5, 3, 4, 5, 7, 6, 6, 6, } + +// Here defines some useful macros +#define IDX2X(idx) (idx%NUM_GRID_X) +#define IDX2Y(idx) (idx/NUM_GRID_X) +#define XY2IDX(x,y) (y*NUM_GRID_X+x) + +void map_draw(void); + + +#endif //MAP_H \ No newline at end of file
diff -r 000000000000 -r 7fe3c940e4b5 map/map_public.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/map/map_public.h Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,77 @@ +/* Gatech ECE2035 2015 SPRING PAC MAN + * Copyright (c) 2015 Gatech ECE2035 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/** @file map_public.h */ +#ifndef MAP_PUBLIC_H +#define MAP_PUBLIC_H + +/// The enum define the status of a grid on the map +typedef enum { + GRID_SIDE_WALK=0, //Side_walk + GRID_CANDY, ///< A candy + GRID_BIG_CANDY, // Bigger candy! + GRID_ROAD_L, //Road left + GRID_ROAD, + GRID_ROAD_R, + GRID_V_LINE, //V_line + GRID_SIDE_WALK_2, +} GRID_STATUS; + +/// The structure to store the information of a grid +typedef struct { + int x; ///< The upper-left corner of the grid. It is the x coordinate on the screen. + int y; ///< The upper-left corner of the grid. It is the y coordinate on the screen. + GRID_STATUS status; ///< See enum GRID_STATUS +} GRID; + +/** Call map_init() once at the begining of your code + @brief It initialize the map structure and draw the map. +*/ +void map_init(void); + +/** Remove the cookie/super-cookie from map + @brief It could be called by Pacman when it eat the cookie. + @param grid_x The horizontal position in the grid. + @param grid_y The vertical position in the grid. + @return 1:There is a cookie be eaten. 0:The is no cookie at the grid. +*/ +bool map_eat_candy(int grid_x, int grid_y); + +/** Get the information about the grid + @param grid_x The horizontal position in the grid. + @param grid_y The vertical position in the grid. + @return The data structure of the grid. You could access the contents by using the_grid.x , the_grid.status ... etc. +*/ +GRID map_get_grid_status(int grid_x, int grid_y); + +/** Draw the grid + @param grid_x The horizontal position in the grid. + @param grid_y The vertical position in the grid. +*/ +void map_draw_grid(unsigned grid_x, unsigned grid_y); + +/** Get the number of remaining cookie. + @brief The game should be ended when there is no cookie. + @return The number of remaining cookie. +*/ +int map_remaining_candy(void); + +#endif //MAP_H \ No newline at end of file
diff -r 000000000000 -r 7fe3c940e4b5 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file
diff -r 000000000000 -r 7fe3c940e4b5 robot/robot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/robot/robot.cpp Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "globals.h" +#include "map_public.h" +#include "robot.h" + +// Following code will only draw the Robot on the screen. You are expected to modify most of the functions here. +// All other necessary functions will be implemented by you. Ex: the movement of Pacman, calculate the score ... etc. + +void robot_init(int grid_x, int grid_y){ + + map_eat_candy(grid_x,grid_y); //clear the cookie on the grid. + robot_draw(grid_x,grid_y); + +} + +void robot_draw(int grid_x, int grid_y){ + + GRID grid_info = map_get_grid_status(grid_x,grid_y); + // Calculate the actual position of the grid + int frog_x = grid_info.x + GRID_RADIUS; + int frog_y = grid_info.y + GRID_RADIUS; + + // MAKE + uLCD.filled_circle(frog_x, frog_y, 3, 0x909090); + uLCD.filled_rectangle(frog_x-3,frog_y+1,frog_x+3,frog_y+3,0x33FF66); + uLCD.line(frog_x-1, frog_y+4,frog_x-1, frog_y+5, 0xFF0000);//legs + uLCD.line(frog_x+2, frog_y+4,frog_x+2, frog_y+5, 0xFF0000); + uLCD.line(frog_x+4, frog_y+1,frog_x+5, frog_y+1, 0xFF0000);//hands + uLCD.line(frog_x-4, frog_y+1,frog_x-5, frog_y+1, 0xFF0000); +} + +void robot_clear(int grid_x, int grid_y){ + + GRID grid_info = map_get_grid_status(grid_x,grid_y); + //Fill the grid (a rectangle) with BACKGROUND_COLOR to clear the pacman + uLCD.filled_rectangle(grid_info.x, grid_info.y, grid_info.x+GRID_SIZE-1, grid_info.y+GRID_SIZE-1, BACKGROUND_COLOR); + +}
diff -r 000000000000 -r 7fe3c940e4b5 robot/robot.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/robot/robot.h Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,10 @@ +#ifndef ROBOT_H +#define ROBOT_H + +#define ROBOT_COLOR 0xFFFFFF + +void robot_init(int grid_x, int grid_y); +void robot_draw(int grid_x, int grid_y); +void robot_clear(int grid_x, int grid_y); + +#endif \ No newline at end of file
diff -r 000000000000 -r 7fe3c940e4b5 wave_player.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wave_player.lib Thu Jun 25 14:35:52 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/sravet/code/wave_player/#acc3e18e77ad