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
Game_three/Book/Book.cpp
- Committer:
- yfkwok
- Date:
- 2019-04-28
- Revision:
- 21:704d938acf5d
- Child:
- 27:4bcdfb212467
File content as of revision 21:704d938acf5d:
#include "Book.h" Book::Book() { } Book::~Book() { } void Book::init(int position) { // 4 possibilities. Get random modulo and set initial position accordingly if (position == 0) { _x = 36; _y = 1; } else if (position == 1) { _x = 1; _y = 18; } else if (position == 2) { _x = 71; _y = 18; } else if (position == 3) { _x = 36; _y = 35; } } void Book::draw(N5110 &lcd) { int Book_data [14][14] = { {1,1,1,0,0,0,0,0,0,0,0,1,1,1}, {1,0,0,1,1,0,0,0,0,1,1,0,0,1}, {1,0,0,0,0,1,0,0,1,0,0,0,0,1}, {1,0,1,1,0,0,1,1,0,0,1,1,0,1}, {1,0,0,0,1,0,0,0,0,1,0,0,0,1}, {1,0,1,1,0,1,0,1,1,0,1,1,0,1}, {1,0,0,0,0,0,0,0,0,1,0,0,0,1}, {1,0,1,0,0,1,0,1,0,0,0,0,0,1}, {1,0,0,0,1,0,0,0,0,0,1,1,0,1}, {1,0,0,0,0,1,0,1,1,0,0,0,0,1}, {1,1,1,0,0,0,0,0,0,0,0,1,1,1}, {0,1,1,1,1,0,0,0,0,1,1,1,1,0}, {0,0,0,1,1,1,0,0,1,1,1,0,0,0}, {0,0,0,0,0,1,1,1,1,0,0,0,0,0}, }; // Sprite for the book lcd.drawSprite(_x, _y, 14, 14, (int*)Book_data); } Vector2D Book::get_pos() { Vector2D p = {_x,_y}; return p; } void Book::set_pos(Vector2D p) { _x = p.x; _y = p.y; }