class for bullet in Car_race game
Bullet.cpp@2:b87e78ff82ca, 2017-04-01 (annotated)
- Committer:
- fy14aaz
- Date:
- Sat Apr 01 18:48:46 2017 +0000
- Revision:
- 2:b87e78ff82ca
- Parent:
- 1:6bd0cbdf15f7
- Child:
- 3:7015c77e39a2
worked on bullet class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fy14aaz | 1:6bd0cbdf15f7 | 1 | #include "Bullet.h" |
fy14aaz | 1:6bd0cbdf15f7 | 2 | |
fy14aaz | 1:6bd0cbdf15f7 | 3 | Bullet::Bullet() |
fy14aaz | 1:6bd0cbdf15f7 | 4 | { |
fy14aaz | 1:6bd0cbdf15f7 | 5 | |
fy14aaz | 1:6bd0cbdf15f7 | 6 | } |
fy14aaz | 1:6bd0cbdf15f7 | 7 | |
fy14aaz | 1:6bd0cbdf15f7 | 8 | Bullet::~Bullet() |
fy14aaz | 1:6bd0cbdf15f7 | 9 | { |
fy14aaz | 1:6bd0cbdf15f7 | 10 | |
fy14aaz | 1:6bd0cbdf15f7 | 11 | } |
fy14aaz | 1:6bd0cbdf15f7 | 12 | |
fy14aaz | 1:6bd0cbdf15f7 | 13 | void Bullet::init(int bullet_x,int bullet_y) |
fy14aaz | 1:6bd0cbdf15f7 | 14 | { |
fy14aaz | 1:6bd0cbdf15f7 | 15 | _size = 2; |
fy14aaz | 1:6bd0cbdf15f7 | 16 | _bullet_x = bullet_x; |
fy14aaz | 1:6bd0cbdf15f7 | 17 | _bullet_y = bullet_y; |
fy14aaz | 1:6bd0cbdf15f7 | 18 | } |
fy14aaz | 1:6bd0cbdf15f7 | 19 | |
fy14aaz | 1:6bd0cbdf15f7 | 20 | void Bullet::draw(N5110 &lcd) |
fy14aaz | 1:6bd0cbdf15f7 | 21 | { |
fy14aaz | 2:b87e78ff82ca | 22 | lcd.drawRect(_bullet_x,_bullet_x,_size,_size,1); |
fy14aaz | 1:6bd0cbdf15f7 | 23 | } |
fy14aaz | 1:6bd0cbdf15f7 | 24 | |
fy14aaz | 1:6bd0cbdf15f7 | 25 | void Bullet::update(Direction d,float mag) |
fy14aaz | 1:6bd0cbdf15f7 | 26 | { |
fy14aaz | 2:b87e78ff82ca | 27 | _bullet_x += 0; |
fy14aaz | 1:6bd0cbdf15f7 | 28 | _bullet_y += 1; |
fy14aaz | 1:6bd0cbdf15f7 | 29 | |
fy14aaz | 1:6bd0cbdf15f7 | 30 | } |