class for bullet in Car_race game
Diff: Bullet.cpp
- Revision:
- 4:a32443aee8f8
- Parent:
- 3:7015c77e39a2
- Child:
- 5:fd945bf405dc
diff -r 7015c77e39a2 -r a32443aee8f8 Bullet.cpp --- a/Bullet.cpp Fri Apr 07 10:56:15 2017 +0000 +++ b/Bullet.cpp Tue Apr 11 22:37:46 2017 +0000 @@ -10,10 +10,12 @@ } -void Bullet::init(int bullet_x,int bullet_y) +void Bullet::init(Vector2D _CarHead) { - _bullet_x = bullet_x; - _bullet_y = bullet_y; + _bullet_x = _CarHead.x; + _bullet_y = _CarHead.y + 2; + + printf("x=%d y=%d \n",_bullet_x,_bullet_y); } void Bullet::draw(N5110 &lcd) @@ -23,7 +25,7 @@ void Bullet::update() { - _bullet_x += 0; - _bullet_y -= 1; - + _bullet_x = _bullet_x; + _bullet_y = _bullet_y - 5; + printf("x=%d y=%d \n",_bullet_x,_bullet_y); } \ No newline at end of file