This is the description
Dependencies: mbed Menu Joystick
Bullet/Bullet.cpp@1:099632454013, 2020-04-27 (annotated)
- Committer:
- mrkang
- Date:
- Mon Apr 27 14:22:07 2020 +0000
- Revision:
- 1:099632454013
- Parent:
- 0:59cbc5800eb6
Star wars; ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mrkang | 0:59cbc5800eb6 | 1 | #include "Bullet.h" |
mrkang | 0:59cbc5800eb6 | 2 | |
mrkang | 0:59cbc5800eb6 | 3 | Bullet::Bullet() |
mrkang | 0:59cbc5800eb6 | 4 | { |
mrkang | 0:59cbc5800eb6 | 5 | |
mrkang | 0:59cbc5800eb6 | 6 | } |
mrkang | 0:59cbc5800eb6 | 7 | |
mrkang | 0:59cbc5800eb6 | 8 | Bullet::~Bullet() |
mrkang | 0:59cbc5800eb6 | 9 | { |
mrkang | 0:59cbc5800eb6 | 10 | |
mrkang | 0:59cbc5800eb6 | 11 | } |
mrkang | 0:59cbc5800eb6 | 12 | void Bullet::init(int x,int y,int sizeX,int sizeY) |
mrkang | 0:59cbc5800eb6 | 13 | { |
mrkang | 0:59cbc5800eb6 | 14 | _x = x; |
mrkang | 0:59cbc5800eb6 | 15 | _y = y; |
mrkang | 0:59cbc5800eb6 | 16 | _sizeX = sizeX; |
mrkang | 0:59cbc5800eb6 | 17 | _sizeY = sizeY; |
mrkang | 0:59cbc5800eb6 | 18 | _speed = 2; |
mrkang | 0:59cbc5800eb6 | 19 | } |
mrkang | 0:59cbc5800eb6 | 20 | void Bullet::draw(N5110 &lcd) |
mrkang | 0:59cbc5800eb6 | 21 | { |
mrkang | 0:59cbc5800eb6 | 22 | int bullet[15] = |
mrkang | 0:59cbc5800eb6 | 23 | { |
mrkang | 0:59cbc5800eb6 | 24 | 0,1,0, |
mrkang | 0:59cbc5800eb6 | 25 | 1,1,1, |
mrkang | 0:59cbc5800eb6 | 26 | 0,1,0, |
mrkang | 0:59cbc5800eb6 | 27 | 0,1,0, |
mrkang | 0:59cbc5800eb6 | 28 | 0,1,1, |
mrkang | 0:59cbc5800eb6 | 29 | }; |
mrkang | 0:59cbc5800eb6 | 30 | Bitmap spirte(bullet,_sizeX,_sizeY); |
mrkang | 0:59cbc5800eb6 | 31 | spirte.render(lcd,_x,_y); |
mrkang | 0:59cbc5800eb6 | 32 | } |
mrkang | 0:59cbc5800eb6 | 33 | void Bullet::update() |
mrkang | 0:59cbc5800eb6 | 34 | { |
mrkang | 0:59cbc5800eb6 | 35 | _y-=_speed; |
mrkang | 0:59cbc5800eb6 | 36 | } |
mrkang | 0:59cbc5800eb6 | 37 | Vector2D Bullet::getPos(){ |
mrkang | 0:59cbc5800eb6 | 38 | Vector2D p = {_x,_y}; |
mrkang | 0:59cbc5800eb6 | 39 | return p; |
mrkang | 0:59cbc5800eb6 | 40 | } |