Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Spaceship/Spaceship.cpp@108:ca888bb3ed54, 2019-05-05 (annotated)
- Committer:
- fy14lkaa
- Date:
- Sun May 05 13:29:31 2019 +0000
- Revision:
- 108:ca888bb3ed54
- Parent:
- 107:83b0bc100600
- Child:
- 109:2137a6a63840
added a new void update function to update the positions of the spaceship.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fy14lkaa | 105:b206078335a3 | 1 | #include "Spaceship.h" |
fy14lkaa | 83:a55e77dfee5a | 2 | |
fy14lkaa | 106:73d5d818ae7d | 3 | Spaceship::Spaceship() |
fy14lkaa | 83:a55e77dfee5a | 4 | { |
fy14lkaa | 83:a55e77dfee5a | 5 | } |
fy14lkaa | 106:73d5d818ae7d | 6 | Spaceship::~Spaceship() |
fy14lkaa | 83:a55e77dfee5a | 7 | { |
fy14lkaa | 83:a55e77dfee5a | 8 | } |
fy14lkaa | 84:d875c6e87398 | 9 | |
fy14lkaa | 87:4635d00ffe9d | 10 | |
fy14lkaa | 87:4635d00ffe9d | 11 | |
fy14lkaa | 106:73d5d818ae7d | 12 | void Spaceship::init(int x_spaceship,int y_spaceship, int speed_spaceship) |
fy14lkaa | 85:0094d33fb1da | 13 | { |
fy14lkaa | 106:73d5d818ae7d | 14 | |
fy14lkaa | 106:73d5d818ae7d | 15 | _x_spaceship= x_spaceship; |
fy14lkaa | 106:73d5d818ae7d | 16 | _y_spaceship= y_spaceship; |
fy14lkaa | 106:73d5d818ae7d | 17 | _speed_spaceship= speed_spaceship; |
fy14lkaa | 106:73d5d818ae7d | 18 | } |
fy14lkaa | 85:0094d33fb1da | 19 | |
fy14lkaa | 107:83b0bc100600 | 20 | void Spaceship::draw(N5110 &lcd) |
fy14lkaa | 107:83b0bc100600 | 21 | { |
fy14lkaa | 107:83b0bc100600 | 22 | lcd.drawRect(_x_spaceship,_y_spaceship,_x_spaceship+5,_y_spaceship+10,FILL_BLACK); |
fy14lkaa | 107:83b0bc100600 | 23 | //lcd.drawSprite(_x_spaceship,_y_spaceship,10,12,(int *) spaceship_2); |
fy14lkaa | 107:83b0bc100600 | 24 | |
fy14lkaa | 107:83b0bc100600 | 25 | } |
fy14lkaa | 108:ca888bb3ed54 | 26 | |
fy14lkaa | 108:ca888bb3ed54 | 27 | |
fy14lkaa | 108:ca888bb3ed54 | 28 | void Spaceship::update(Direction d,float mag) |
fy14lkaa | 108:ca888bb3ed54 | 29 | { |
fy14lkaa | 108:ca888bb3ed54 | 30 | _speed_spaceship = int(mag*10.0f); |
fy14lkaa | 108:ca888bb3ed54 | 31 | |
fy14lkaa | 108:ca888bb3ed54 | 32 | |
fy14lkaa | 108:ca888bb3ed54 | 33 | |
fy14lkaa | 108:ca888bb3ed54 | 34 | } |