Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
source/pala.h@1:2c86b5fb793a, 2020-05-17 (annotated)
- Committer:
- immou
- Date:
- Sun May 17 02:06:13 2020 +0000
- Revision:
- 1:2c86b5fb793a
- Child:
- 2:292e47672dbe
MVP finished
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| immou | 1:2c86b5fb793a | 1 | #ifndef PALA_H_ |
| immou | 1:2c86b5fb793a | 2 | #define PALA_H_ |
| immou | 1:2c86b5fb793a | 3 | |
| immou | 1:2c86b5fb793a | 4 | #include <iostream> |
| immou | 1:2c86b5fb793a | 5 | #include "../globals.h" |
| immou | 1:2c86b5fb793a | 6 | |
| immou | 1:2c86b5fb793a | 7 | using namespace std; |
| immou | 1:2c86b5fb793a | 8 | |
| immou | 1:2c86b5fb793a | 9 | class Pala |
| immou | 1:2c86b5fb793a | 10 | { |
| immou | 1:2c86b5fb793a | 11 | public: |
| immou | 1:2c86b5fb793a | 12 | int x,y,w,h; |
| immou | 1:2c86b5fb793a | 13 | Pala(int x, int y, int w, int h) : x(x), y(y), w(w), h(h) |
| immou | 1:2c86b5fb793a | 14 | { |
| immou | 1:2c86b5fb793a | 15 | reset(); |
| immou | 1:2c86b5fb793a | 16 | }; |
| immou | 1:2c86b5fb793a | 17 | ~Pala(); |
| immou | 1:2c86b5fb793a | 18 | void reset(); |
| immou | 1:2c86b5fb793a | 19 | void moveUp(); |
| immou | 1:2c86b5fb793a | 20 | void moveDown(); |
| immou | 1:2c86b5fb793a | 21 | void moveAuto(int bolapos); |
| immou | 1:2c86b5fb793a | 22 | }; |
| immou | 1:2c86b5fb793a | 23 | |
| immou | 1:2c86b5fb793a | 24 | void Pala::reset() |
| immou | 1:2c86b5fb793a | 25 | { |
| immou | 1:2c86b5fb793a | 26 | y = (MAP_HEIGHT / 2) - h/2; |
| immou | 1:2c86b5fb793a | 27 | } |
| immou | 1:2c86b5fb793a | 28 | |
| immou | 1:2c86b5fb793a | 29 | void Pala::moveDown() |
| immou | 1:2c86b5fb793a | 30 | { |
| immou | 1:2c86b5fb793a | 31 | if(y > 1) |
| immou | 1:2c86b5fb793a | 32 | y -= 5; |
| immou | 1:2c86b5fb793a | 33 | }; |
| immou | 1:2c86b5fb793a | 34 | void Pala::moveUp() |
| immou | 1:2c86b5fb793a | 35 | { |
| immou | 1:2c86b5fb793a | 36 | if(y + h < MAP_HEIGHT) |
| immou | 1:2c86b5fb793a | 37 | y += 5; |
| immou | 1:2c86b5fb793a | 38 | }; |
| immou | 1:2c86b5fb793a | 39 | |
| immou | 1:2c86b5fb793a | 40 | #endif |
