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.
Dependencies: mbed
boom/boom.cpp@9:d217a636c18d, 2018-04-19 (annotated)
- Committer:
- RickYu
- Date:
- Thu Apr 19 23:07:14 2018 +0000
- Revision:
- 9:d217a636c18d
- Parent:
- 8:4a5e96ed2347
- Child:
- 10:ef01b3076040
fix the problem that boom monney will go outside the screen;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RickYu | 3:1a134243e2f0 | 1 | #include "boom.h" |
RickYu | 3:1a134243e2f0 | 2 | |
RickYu | 3:1a134243e2f0 | 3 | boom::boom() |
RickYu | 3:1a134243e2f0 | 4 | { |
RickYu | 3:1a134243e2f0 | 5 | |
RickYu | 3:1a134243e2f0 | 6 | } |
RickYu | 3:1a134243e2f0 | 7 | |
RickYu | 3:1a134243e2f0 | 8 | boom::~boom() |
RickYu | 3:1a134243e2f0 | 9 | { |
RickYu | 3:1a134243e2f0 | 10 | |
RickYu | 3:1a134243e2f0 | 11 | } |
RickYu | 3:1a134243e2f0 | 12 | |
RickYu | 3:1a134243e2f0 | 13 | |
RickYu | 3:1a134243e2f0 | 14 | void boom::init(int x,int y) |
RickYu | 3:1a134243e2f0 | 15 | { |
RickYu | 3:1a134243e2f0 | 16 | boom_x = x; |
RickYu | 3:1a134243e2f0 | 17 | boom_y = y; |
RickYu | 3:1a134243e2f0 | 18 | |
RickYu | 3:1a134243e2f0 | 19 | |
RickYu | 3:1a134243e2f0 | 20 | } |
RickYu | 3:1a134243e2f0 | 21 | |
RickYu | 3:1a134243e2f0 | 22 | void boom::draw(N5110 &lcd) |
RickYu | 3:1a134243e2f0 | 23 | { |
RickYu | 7:1964f649676e | 24 | //draw the boom on the screen |
RickYu | 6:46d0caedf217 | 25 | lcd.drawCircle(boom_x,boom_y,2,FILL_TRANSPARENT); |
RickYu | 4:55d904040636 | 26 | |
RickYu | 3:1a134243e2f0 | 27 | } |
RickYu | 3:1a134243e2f0 | 28 | |
RickYu | 4:55d904040636 | 29 | void boom::update() |
RickYu | 3:1a134243e2f0 | 30 | { |
RickYu | 7:1964f649676e | 31 | //set the falling speed of boom |
RickYu | 7:1964f649676e | 32 | //let the boom move with set speed |
RickYu | 9:d217a636c18d | 33 | boom_speed = 1; |
RickYu | 3:1a134243e2f0 | 34 | boom_y+= boom_speed; |
RickYu | 9:d217a636c18d | 35 | |
RickYu | 5:0a116644cce2 | 36 | |
RickYu | 5:0a116644cce2 | 37 | } |
RickYu | 5:0a116644cce2 | 38 | Vector2D boom::get_pos() |
RickYu | 5:0a116644cce2 | 39 | { |
RickYu | 5:0a116644cce2 | 40 | Vector2D p = {boom_x,boom_y}; |
RickYu | 5:0a116644cce2 | 41 | return p; |
RickYu | 5:0a116644cce2 | 42 | } |
RickYu | 7:1964f649676e | 43 | void boom::set_pos(Vector2D p1) |
RickYu | 5:0a116644cce2 | 44 | { |
RickYu | 7:1964f649676e | 45 | boom_x = p1.x; |
RickYu | 7:1964f649676e | 46 | boom_y = p1.y; |
RickYu | 3:1a134243e2f0 | 47 | } |
RickYu | 3:1a134243e2f0 | 48 | |
RickYu | 3:1a134243e2f0 | 49 |