Game codes for Pokemon Academy Yiu Fai Kwok - 201198802 I have read the University Regulations on Plagiarism and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources.
Dependencies: mbed FXOS8700CQ mbed-rtos
Diff: Start/Start.cpp
- Revision:
- 17:5d8ff39a0e49
- Parent:
- 11:5a6b9dffd78a
- Child:
- 32:58def659f463
--- a/Start/Start.cpp Sat Apr 20 15:20:43 2019 +0000 +++ b/Start/Start.cpp Sun Apr 21 11:02:28 2019 +0000 @@ -12,6 +12,7 @@ void Start::init(Gamepad &pad) { + // Initialize the positions for all objects _pos_x = 2; _pos_y = 8; _pos_cy = 5; @@ -60,6 +61,7 @@ Vector2D Start::update_select(Gamepad &pad) { + // Move the selection box according to the joystick input to move left and right if(pad.get_direction() == E && _pos_x < 58){_pos_x = _pos_x + 28; _pos_y = _pos_y - 4;} else if(pad.get_direction() == W && _pos_x > 2){_pos_x = _pos_x - 28;_pos_y = _pos_y + 4;} Vector2D p = {_pos_x, _pos_y}; @@ -68,6 +70,7 @@ int Start::update_animation_b(Gamepad &pad) { + // Update the sprite's position according to parameter alt to create animation if(_alt == 0 && _pos_x == 2){_pos_by = 13;} else if(_alt == 1 && _pos_x == 2){_pos_by = 11;} int pos_by = _pos_by; @@ -76,6 +79,7 @@ int Start::update_animation_c(Gamepad &pad) { + // Update the sprite's position according to parameter alt to create animation if(_alt == 0 && _pos_x == 58){_pos_cy = 3;} else if(_alt == 1 && _pos_x == 58){_pos_cy = 5;} int pos_cy = _pos_cy; @@ -84,6 +88,7 @@ int Start::update_animation_s(Gamepad &pad) { + // Update the sprite's position according to parameter alt to create animation if(_alt == 0 && _pos_x == 30){_pos_sy = 7;} else if(_alt == 1 && _pos_x == 30){_pos_sy = 9;} int pos_sy = _pos_sy; @@ -118,6 +123,7 @@ int Start::get_select(Vector2D p) { + // Return a value to represent the character that is being selected by the selection box int select = 0; int x = p.x; if(x == 2) {select = 0;} @@ -128,6 +134,7 @@ void Start::intro(int select,Gamepad &pad, N5110 &lcd) { + // Fetch the information from Character file to display the character information if(select == 2){_c1.description(pad, lcd);} else if(select == 1){_s1.description(pad, lcd);} else if(select == 0){_b1.description(pad, lcd);}