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:
- 32:58def659f463
- Parent:
- 17:5d8ff39a0e49
diff -r 0d2c19a285f6 -r 58def659f463 Start/Start.cpp --- a/Start/Start.cpp Wed May 08 03:03:46 2019 +0000 +++ b/Start/Start.cpp Wed May 08 15:14:55 2019 +0000 @@ -25,10 +25,10 @@ void Start::starter_draw(N5110 &lcd) { lcd.clear(); - _c1.draw_cha1_sprite(60, _pos_cy, lcd); - _s1.draw_cha1_sprite(32, _pos_sy, lcd); - _b1.draw_cha1_sprite(4, _pos_by, lcd); - lcd.drawRect(_pos_x, _pos_y, 25, 25, FILL_TRANSPARENT); + _c1.draw_cha1_sprite(60, _pos_cy, lcd); // Draw Charmander's sprite at position (60, 5) + _s1.draw_cha1_sprite(32, _pos_sy, lcd); // Draw Squirtle's sprite at position (32, 9) + _b1.draw_cha1_sprite(4, _pos_by, lcd); // Draw Bulbasaur's sprite at position (4, 13) + lcd.drawRect(_pos_x, _pos_y, 25, 25, FILL_TRANSPARENT); //Draw selection box dependent on which Pokemon is currently being selected int instruct_data[15][69] = { {1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0}, {1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, @@ -46,17 +46,17 @@ {0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1}, {1,1,1,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1}, }; - lcd.drawSprite(5, 33, 15, 69, (int*)instruct_data); + lcd.drawSprite(5, 33, 15, 69, (int*)instruct_data); // Draw the instruction for choosing to read information or start the game lcd.refresh(); } void Start::starter_update(Gamepad &pad) { - update_select(pad); - update_animation_b(pad); - update_animation_c(pad); - update_animation_s(pad); - update_alt(); + update_select(pad); // Update the position of the selection box according to joystick input + update_animation_b(pad); // Update the animation of Bulbasaur if it is being selected + update_animation_c(pad); // Update the animation of Charmander if it is being selected + update_animation_s(pad); // Update the animation of Squirtle if it is being selected + update_alt(); // Update the alt parameter to alter the sprites of the characters } Vector2D Start::update_select(Gamepad &pad) @@ -103,24 +103,6 @@ return alt; } -void Start::set_pos(Vector2D p) -{ - _pos_x = p.x; - _pos_y = p.y; -} - -void Start::set_pos_csb(int pos_cy, int pos_sy, int pos_by) -{ - _pos_cy = pos_cy; - _pos_sy = pos_sy; - _pos_by = pos_by; -} - -void Start::set_alt(int alt) -{ - _alt = alt; -} - int Start::get_select(Vector2D p) { // Return a value to represent the character that is being selected by the selection box @@ -134,7 +116,7 @@ void Start::intro(int select,Gamepad &pad, N5110 &lcd) { - // Fetch the information from Character file to display the character information + // Fetch the files 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);}