class for bullet in Car_race game

Committer:
fy14aaz
Date:
Fri Mar 31 22:25:35 2017 +0000
Revision:
1:6bd0cbdf15f7
Parent:
0:aca013532788
Child:
2:b87e78ff82ca
working on bullet class, main functions

Who changed what in which revision?

UserRevisionLine numberNew 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 1:6bd0cbdf15f7 22 lcd.drawRect(_bullet_x,_bullet_x,_size,_size,FILL_BLACK);
fy14aaz 1:6bd0cbdf15f7 23 }
fy14aaz 1:6bd0cbdf15f7 24
fy14aaz 1:6bd0cbdf15f7 25 void Bullet::update(Direction d,float mag)
fy14aaz 1:6bd0cbdf15f7 26 {
fy14aaz 1:6bd0cbdf15f7 27 _bullet_x += 1;
fy14aaz 1:6bd0cbdf15f7 28 _bullet_y += 1;
fy14aaz 1:6bd0cbdf15f7 29
fy14aaz 1:6bd0cbdf15f7 30 }