class for bullet in Car_race game
Bullet.cpp@4:a32443aee8f8, 2017-04-11 (annotated)
- Committer:
- fy14aaz
- Date:
- Tue Apr 11 22:37:46 2017 +0000
- Revision:
- 4:a32443aee8f8
- Parent:
- 3:7015c77e39a2
- Child:
- 5:fd945bf405dc
working 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 | 4:a32443aee8f8 | 13 | void Bullet::init(Vector2D _CarHead) |
fy14aaz | 1:6bd0cbdf15f7 | 14 | { |
fy14aaz | 4:a32443aee8f8 | 15 | _bullet_x = _CarHead.x; |
fy14aaz | 4:a32443aee8f8 | 16 | _bullet_y = _CarHead.y + 2; |
fy14aaz | 4:a32443aee8f8 | 17 | |
fy14aaz | 4:a32443aee8f8 | 18 | printf("x=%d y=%d \n",_bullet_x,_bullet_y); |
fy14aaz | 1:6bd0cbdf15f7 | 19 | } |
fy14aaz | 1:6bd0cbdf15f7 | 20 | |
fy14aaz | 1:6bd0cbdf15f7 | 21 | void Bullet::draw(N5110 &lcd) |
fy14aaz | 1:6bd0cbdf15f7 | 22 | { |
fy14aaz | 3:7015c77e39a2 | 23 | lcd.drawRect(_bullet_x,_bullet_x,2,2,FILL_BLACK); |
fy14aaz | 1:6bd0cbdf15f7 | 24 | } |
fy14aaz | 1:6bd0cbdf15f7 | 25 | |
fy14aaz | 3:7015c77e39a2 | 26 | void Bullet::update() |
fy14aaz | 1:6bd0cbdf15f7 | 27 | { |
fy14aaz | 4:a32443aee8f8 | 28 | _bullet_x = _bullet_x; |
fy14aaz | 4:a32443aee8f8 | 29 | _bullet_y = _bullet_y - 5; |
fy14aaz | 4:a32443aee8f8 | 30 | printf("x=%d y=%d \n",_bullet_x,_bullet_y); |
fy14aaz | 1:6bd0cbdf15f7 | 31 | } |