![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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-05-09
- Revision:
- 34:3ddfaa217eca
- Parent:
- 28:a6726a3f8e6d
File content as of revision 34:3ddfaa217eca:
#include "Book.h" Book::Book() { } Book::~Book() { } void Book::init(int position) { // 4 possibilities. Get random modulo and set initial position accordingly if (position == 3) { _x = 35; _y = 0; } else if (position == 2) { _x = 0; _y = 17; } else if (position == 1) { _x = 70; _y = 17; } else if (position == 0) { _x = 35; _y = 35; } } void Book::draw(N5110 &lcd) { int Book_data [14][14] = { {0,0,0,0,0,0,0,0,0,1,0,0,0,0}, {0,0,0,0,0,0,1,1,1,1,1,0,0,0}, {0,0,0,1,1,1,1,1,1,1,1,0,0,0}, {1,1,1,1,1,1,1,1,1,1,1,1,0,0}, {1,1,1,1,1,1,1,1,1,1,1,1,0,0}, {0,1,1,1,1,1,1,1,1,1,1,1,1,0}, {0,1,1,1,1,1,1,1,1,1,1,1,1,0}, {0,0,1,1,1,1,1,1,1,1,1,1,1,1}, {0,0,1,1,1,1,1,1,1,1,1,1,1,1}, {0,0,0,1,1,1,1,1,1,1,1,1,1,0}, {0,0,0,1,1,1,1,1,1,1,0,0,0,0}, {0,0,0,0,1,1,1,0,0,0,0,1,1,1}, {0,0,0,0,1,0,0,0,1,1,1,0,0,0}, {0,0,0,0,0,1,1,1,0,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; }