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
spase_ship/space_ship.cpp@86:79cfe806a11d, 2019-04-28 (annotated)
- Committer:
- fy14lkaa
- Date:
- Sun Apr 28 14:53:29 2019 +0000
- Revision:
- 86:79cfe806a11d
- Parent:
- 85:0094d33fb1da
- Child:
- 87:4635d00ffe9d
added draw function to draw the spaceship using lcd&N5110 libraries.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fy14lkaa | 83:a55e77dfee5a | 1 | #include "space_ship.h" |
fy14lkaa | 83:a55e77dfee5a | 2 | |
fy14lkaa | 83:a55e77dfee5a | 3 | space_ship::space_ship() |
fy14lkaa | 83:a55e77dfee5a | 4 | { |
fy14lkaa | 83:a55e77dfee5a | 5 | |
fy14lkaa | 83:a55e77dfee5a | 6 | } |
fy14lkaa | 83:a55e77dfee5a | 7 | |
fy14lkaa | 83:a55e77dfee5a | 8 | space_ship::~space_ship() |
fy14lkaa | 83:a55e77dfee5a | 9 | { |
fy14lkaa | 83:a55e77dfee5a | 10 | |
fy14lkaa | 83:a55e77dfee5a | 11 | } |
fy14lkaa | 84:d875c6e87398 | 12 | |
fy14lkaa | 85:0094d33fb1da | 13 | void space_ship::init(int x,int height,int width) |
fy14lkaa | 85:0094d33fb1da | 14 | { |
fy14lkaa | 85:0094d33fb1da | 15 | _x = x; // x value on screen is fixed |
fy14lkaa | 85:0094d33fb1da | 16 | _y = HEIGHT/2 - height/2; // y depends on height of screen and height of space_ship |
fy14lkaa | 85:0094d33fb1da | 17 | _height = height; |
fy14lkaa | 85:0094d33fb1da | 18 | _width = width; |
fy14lkaa | 85:0094d33fb1da | 19 | _speed = 1; // default speed |
fy14lkaa | 85:0094d33fb1da | 20 | _score = 0; // start score from zero |
fy14lkaa | 85:0094d33fb1da | 21 | |
fy14lkaa | 85:0094d33fb1da | 22 | } |
fy14lkaa | 86:79cfe806a11d | 23 | |
fy14lkaa | 86:79cfe806a11d | 24 | void space_ship::draw(N5110 &lcd) |
fy14lkaa | 86:79cfe806a11d | 25 | { |
fy14lkaa | 86:79cfe806a11d | 26 | // draw space_ship in screen buffer. |
fy14lkaa | 86:79cfe806a11d | 27 | |
fy14lkaa | 86:79cfe806a11d | 28 | } |