200943373MAZE

Dependencies:   mbed

Fork of 200943373MAZE by hongyun AHN

Committer:
hongyunAHN
Date:
Thu May 04 14:08:31 2017 +0000
Revision:
1:bd92ef8d00ac
Parent:
0:df4347043adf
200943373  hongyun AHN

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hongyunAHN 0:df4347043adf 1 #include "Player.h"
hongyunAHN 0:df4347043adf 2 //#include "Background.h"
hongyunAHN 0:df4347043adf 3 Player::Player()
hongyunAHN 0:df4347043adf 4 {
hongyunAHN 0:df4347043adf 5
hongyunAHN 0:df4347043adf 6 }
hongyunAHN 0:df4347043adf 7 Player::~Player()
hongyunAHN 0:df4347043adf 8 {
hongyunAHN 0:df4347043adf 9
hongyunAHN 0:df4347043adf 10 }
hongyunAHN 0:df4347043adf 11
hongyunAHN 0:df4347043adf 12 void Player::init(){
hongyunAHN 0:df4347043adf 13
hongyunAHN 0:df4347043adf 14
hongyunAHN 0:df4347043adf 15 const char array[3][3]={
hongyunAHN 0:df4347043adf 16 {1,1,1},
hongyunAHN 0:df4347043adf 17 {1,1,1},
hongyunAHN 0:df4347043adf 18 {1,1,1},
hongyunAHN 0:df4347043adf 19 };
hongyunAHN 0:df4347043adf 20
hongyunAHN 0:df4347043adf 21 _x==2;
hongyunAHN 0:df4347043adf 22 _y==2;
hongyunAHN 0:df4347043adf 23
hongyunAHN 0:df4347043adf 24
hongyunAHN 0:df4347043adf 25 }
hongyunAHN 0:df4347043adf 26
hongyunAHN 0:df4347043adf 27 void Player::update(Direction d,N5110 &lcd,Gamepad &pad)
hongyunAHN 0:df4347043adf 28 {
hongyunAHN 0:df4347043adf 29
hongyunAHN 0:df4347043adf 30 const char map[48][85] = _background.draw(N5110 &lcd);
hongyunAHN 1:bd92ef8d00ac 31 //Vector2D monsterPos = get_pos();
hongyunAHN 0:df4347043adf 32 if(A_PRESSED==1){
hongyunAHN 1:bd92ef8d00ac 33 if(//map[_y][_x+5]==1
hongyunAHN 1:bd92ef8d00ac 34 ){
hongyunAHN 0:df4347043adf 35 _x==_x;
hongyunAHN 0:df4347043adf 36 _y==_y;
hongyunAHN 0:df4347043adf 37 }
hongyunAHN 0:df4347043adf 38 else{
hongyunAHN 0:df4347043adf 39 _x+5==_x;
hongyunAHN 0:df4347043adf 40 _y==_y;
hongyunAHN 0:df4347043adf 41 }
hongyunAHN 0:df4347043adf 42 }
hongyunAHN 0:df4347043adf 43 else if (B_PRESSED==1){
hongyunAHN 1:bd92ef8d00ac 44 if(//map[_y+5][_x]==1
hongyunAHN 1:bd92ef8d00ac 45 ){
hongyunAHN 0:df4347043adf 46 _x==_x;
hongyunAHN 0:df4347043adf 47 _y==_y;
hongyunAHN 0:df4347043adf 48 }
hongyunAHN 0:df4347043adf 49 else{ _x==_x;
hongyunAHN 0:df4347043adf 50 _y+5==_y;
hongyunAHN 0:df4347043adf 51 }
hongyunAHN 0:df4347043adf 52 }
hongyunAHN 0:df4347043adf 53 else if (d == N) {
hongyunAHN 1:bd92ef8d00ac 54 if(//map[_y+3][_x]==1
hongyunAHN 1:bd92ef8d00ac 55 ){
hongyunAHN 0:df4347043adf 56 _x==_x;
hongyunAHN 0:df4347043adf 57 _y==_y;
hongyunAHN 0:df4347043adf 58 }
hongyunAHN 1:bd92ef8d00ac 59 else if (//map[_y+3][_x+2]==1
hongyunAHN 1:bd92ef8d00ac 60 ){
hongyunAHN 0:df4347043adf 61 _x==_x;
hongyunAHN 0:df4347043adf 62 _y==_y;
hongyunAHN 0:df4347043adf 63 }
hongyunAHN 0:df4347043adf 64 else{
hongyunAHN 0:df4347043adf 65 _x==_x;
hongyunAHN 0:df4347043adf 66 _y+1==_y;
hongyunAHN 0:df4347043adf 67
hongyunAHN 0:df4347043adf 68 }
hongyunAHN 0:df4347043adf 69 }
hongyunAHN 0:df4347043adf 70 else if (d == S) {
hongyunAHN 1:bd92ef8d00ac 71 if(//map[_y-1][_x]==1
hongyunAHN 1:bd92ef8d00ac 72 ){
hongyunAHN 0:df4347043adf 73 _x==_x;
hongyunAHN 0:df4347043adf 74 _y==_y;
hongyunAHN 0:df4347043adf 75 }
hongyunAHN 1:bd92ef8d00ac 76 else if(//map[_y-1][_x+2]==1
hongyunAHN 1:bd92ef8d00ac 77 ){
hongyunAHN 0:df4347043adf 78 _x==_x;
hongyunAHN 0:df4347043adf 79 _y==_y;
hongyunAHN 0:df4347043adf 80 }
hongyunAHN 0:df4347043adf 81 else{
hongyunAHN 0:df4347043adf 82 _x==_x;
hongyunAHN 0:df4347043adf 83 _y-1==_y;
hongyunAHN 0:df4347043adf 84 ;
hongyunAHN 0:df4347043adf 85 }
hongyunAHN 0:df4347043adf 86 }else if (d == W) {
hongyunAHN 1:bd92ef8d00ac 87 if(//map[_y][_x-1]==1
hongyunAHN 1:bd92ef8d00ac 88 ){
hongyunAHN 0:df4347043adf 89 _x==_x;
hongyunAHN 0:df4347043adf 90 _y==_y;;
hongyunAHN 0:df4347043adf 91 }
hongyunAHN 1:bd92ef8d00ac 92 else if(//map[_y+2][_x-1]==1
hongyunAHN 1:bd92ef8d00ac 93 ){
hongyunAHN 0:df4347043adf 94 _x==_x;
hongyunAHN 0:df4347043adf 95 _y==_y;
hongyunAHN 0:df4347043adf 96 }
hongyunAHN 0:df4347043adf 97 else{
hongyunAHN 0:df4347043adf 98 _x-1==_x;
hongyunAHN 0:df4347043adf 99 _y==_y;
hongyunAHN 0:df4347043adf 100
hongyunAHN 0:df4347043adf 101 }
hongyunAHN 0:df4347043adf 102 }else if (d == E) {
hongyunAHN 1:bd92ef8d00ac 103 if(//map[_y][_x+3]==1
hongyunAHN 1:bd92ef8d00ac 104 ){
hongyunAHN 0:df4347043adf 105 _x==_x;
hongyunAHN 0:df4347043adf 106 _y==_y;
hongyunAHN 0:df4347043adf 107 }
hongyunAHN 1:bd92ef8d00ac 108 else if(//map[_y+2][_x+3]==1
hongyunAHN 1:bd92ef8d00ac 109 ){
hongyunAHN 0:df4347043adf 110 _x==_x;
hongyunAHN 0:df4347043adf 111 _y==_y;
hongyunAHN 0:df4347043adf 112 }
hongyunAHN 0:df4347043adf 113 else{
hongyunAHN 0:df4347043adf 114 _x+1==_x;
hongyunAHN 0:df4347043adf 115 _y==_y;
hongyunAHN 0:df4347043adf 116
hongyunAHN 0:df4347043adf 117 }
hongyunAHN 0:df4347043adf 118 }
hongyunAHN 0:df4347043adf 119 }
hongyunAHN 0:df4347043adf 120
hongyunAHN 0:df4347043adf 121
hongyunAHN 0:df4347043adf 122 Vector2D Player::get_pos() {
hongyunAHN 0:df4347043adf 123 Vector2D p = {_x,_y};
hongyunAHN 0:df4347043adf 124 return p;
hongyunAHN 0:df4347043adf 125 }