copy

Dependencies:   Gamepad N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
hongyunAHN
Date:
Wed May 03 22:37:17 2017 +0000
Commit message:
copy

Changed in this revision

Background/Background.cpp Show annotated file Show diff for this revision Revisions of this file
Background/Background.h Show annotated file Show diff for this revision Revisions of this file
Gamepad.lib Show annotated file Show diff for this revision Revisions of this file
N5110.lib Show annotated file Show diff for this revision Revisions of this file
Player/Player.cpp Show annotated file Show diff for this revision Revisions of this file
Player/Player.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Background/Background.cpp	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,143 @@
+#include "Background.h"
+
+Background::Background()
+{
+
+}
+
+Background::~Background()
+{
+
+}
+
+void Background::init()
+{
+
+  
+}
+
+void Background::read_input(Gamepad &pad)
+{
+    _d = pad.get_direction();
+    _mag = pad.get_mag();
+}
+
+void Background::draw(N5110 &lcd)
+{
+   const char array[48][85]={  
+    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
+    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},  
+    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
+    {1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
+    {1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
+    {1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
+    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
+    
+    };  
+       
+}
+
+void Background::update(Gamepad &pad,N5110 &lcd)
+{
+    check_goal(pad,lcd);
+    
+  
+   
+
+  
+}
+
+
+
+
+
+void Background::check_goal(Gamepad &pad ,N5110 &lcd)
+{
+    Vector2D Player_pos = _player.get_pos();
+   
+    if((Player_pos.x,Player_pos.y)==(40,24)){
+     lcd.printString("    GOAL    ",0,2);  
+    
+        pad.leds_on();
+        wait(0.5);
+        pad.leds_off();
+    }
+
+    if((Player_pos.x,Player_pos.y)==(83,43) ){
+    lcd.printString("   FAKE     ",0,2);
+     lcd.printString("  Find the other way  ",0,2);
+    lcd.refresh();  
+    }
+if((Player_pos.x,Player_pos.y)==(56,4)){
+    pad.leds_on();
+    lcd.printString("   trap    ",0,2);
+     pad.leds_off();
+     lcd.printString("  Find the other way  ",0,2);
+     lcd.refresh();
+     Player_pos.x==2;
+     Player_pos.y==2;
+     
+}
+if((Player_pos.x,Player_pos.y)==(77,29)){
+     pad.leds_on();
+     lcd.printString("   trap    ",0,2);
+     lcd.refresh();
+     pad.leds_off();
+     Player_pos.x==2;
+     Player_pos.y==2;
+     
+}
+if((Player_pos.x,Player_pos.y)==(65,40)){
+     pad.leds_on();
+     lcd.printString("   JUMP    ",0,2);
+     pad.leds_off();
+     lcd.refresh();
+     Player_pos.x==65;
+     Player_pos.y==30;
+     
+}
+        
+        
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Background/Background.h	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,33 @@
+#ifndef BACKGROUND_H
+#define BACKGROUND_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+#include "Player.h"
+
+class Background
+{
+
+public:
+    Background();
+    ~Background();
+
+    void init( );
+    void read_input(Gamepad &pad);
+    void update(Gamepad &pad,N5110 &lcd);
+    void draw(N5110 &lcd);
+    
+private:
+
+    void check_goal(Gamepad &pad,N5110 &lcd);
+    void print_scores(N5110 &lcd);
+    
+    Player _player;
+
+    Direction _d;
+    float _mag;
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Gamepad.lib	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/Gamepad/#e0a4f15a7750
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#d80e568a2e18
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Player/Player.cpp	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,115 @@
+#include "Player.h"
+#include "Background.h"
+Player::Player()
+{
+
+}
+Player::~Player()
+{
+
+}
+
+void Player::init(){
+
+ 
+    const char array[3][3]={
+        {1,1,1},
+        {1,1,1},
+        {1,1,1},
+    };
+
+     _x==2;
+     _y==2;
+      
+
+}
+
+void Player::update(Direction d,N5110 &lcd,Gamepad &pad)
+{
+  
+    const char map[48][85] = _background.draw(N5110 &lcd);
+    Vector2D monsterPos = get_pos();
+    if(A_PRESSED==1){
+        if(map[_y][_x+5]==1){
+            _x==_x;
+            _y==_y;
+            }
+        else{
+            _x+5==_x;
+            _y==_y;
+            }
+    }
+    else if (B_PRESSED==1){
+        if(map[_y+5][_x]==1){
+              _x==_x;
+              _y==_y;
+            }
+        else{ _x==_x;
+              _y+5==_y;
+            }
+        }
+    else if (d == N) { 
+        if(map[_y+3][_x]==1){
+              _x==_x;
+              _y==_y;
+        }
+        else if (map[_y+3][_x+2]==1){
+             _x==_x;
+            _y==_y;
+        }      
+        else{ 
+             _x==_x;
+              _y+1==_y;
+          
+        }
+    } 
+    else if (d == S) {
+        if(map[_y-1][_x]==1){
+             _x==_x;
+             _y==_y;
+        }
+        else if(map[_y-1][_x+2]==1){
+              _x==_x;
+              _y==_y; 
+        }
+        else{   
+               _x==_x;
+              _y-1==_y;
+         ;
+        }   
+    }else if (d == W) {
+        if(map[_y][_x-1]==1){
+              _x==_x;
+              _y==_y;;    
+        }
+        else if(map[_y+2][_x-1]==1){
+              _x==_x;
+              _y==_y;
+        }    
+        else{
+             _x-1==_x;
+              _y==_y;
+           
+        }  
+    }else if (d == E) {
+        if(map[_y][_x+3]==1){
+              _x==_x;
+              _y==_y;
+        }
+        else if(map[_y+2][_x+3]==1){
+              _x==_x;
+              _y==_y;
+        }
+        else{
+             _x+1==_x;
+             _y==_y;
+            
+        }   
+    }
+}
+
+
+Vector2D Player::get_pos() {
+    Vector2D p = {_x,_y};
+    return p;    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Player/Player.h	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,29 @@
+#ifndef PLAYER_H
+#define PLAYER_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+#include "Background.h"
+
+class Player
+{
+public:
+
+    Player();
+    ~Player();
+    void init();
+    void draw(N5110 &lcd);
+    void update(Direction d,N5110 &lcd,Gamepad &pad);
+  
+    Vector2D get_pos();
+   
+private:
+
+    Background _background;
+    
+    int _x;
+    int _y;
+
+};
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,73 @@
+
+#include "mbed.h"
+#include "Gamepad.h"
+#include "N5110.h"
+#include "Background.h"
+
+
+
+struct UserInput {
+    Direction d;
+    float mag;
+};
+
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+Gamepad pad;
+Background back;
+
+void init();
+void update_game(UserInput input);
+void render();
+void welcome();
+
+int main()
+{
+    int fps = 8;  
+
+    init();
+    welcome();
+    
+    render();  
+    wait(1.0f/fps);  
+
+   
+    while (1) {
+        back.read_input(pad);
+        back.update(pad,lcd);
+        render();
+        wait(1.0f/fps);
+    }
+}
+
+void init()
+{
+    lcd.init();
+    pad.init();
+     
+   back.init();
+
+}
+
+void render()
+{
+ 
+    lcd.clear();  
+    back.draw(lcd);
+    lcd.refresh();
+}
+
+void welcome() {
+    
+    lcd.printString("     MAZE    ",0,2);  
+    lcd.printString("  Press Start ",0,5);
+    lcd.refresh();
+     
+  
+    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
+        pad.leds_on();
+        wait(0.3);
+        pad.leds_off();
+        wait(0.2);
+    }
+ 
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 03 22:37:17 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/794e51388b66
\ No newline at end of file