Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Bullet/Bullet.cpp
- Committer:
- fy14lkaa
- Date:
- 2019-05-05
- Revision:
- 126:c63c5ad39f73
- Parent:
- 100:b0e9c067d80a
- Child:
- 133:eed60548d170
File content as of revision 126:c63c5ad39f73:
#include "Bullet.h"
Bullet::Bullet()
{
}
Bullet::~Bullet()
{
}
void Bullet::init(int x_bullet, int y_bullet,int speed_bullet, int fired_bullet)
{
_x_bullet= x_bullet;
_y_bullet= y_bullet;
_speed_bullet=speed_bullet;
_fired_bullet= fired_bullet;
}
void Bullet::draw(N5110 &lcd)
{
lcd.drawRect(_x_bullet,_y_bullet,_x_bullet+5,_y_bullet+5,FILL_BLACK);
//lcd.drawSprite(_x_bullet,_y_bullet,12,10,(int *)bullet);
}
void Bullet::update(Direction d,float mag)//no need for mag
{
_speed_bullet = int(mag*10.0f);
if(d==E){
_fired_bullet=1;
//_x_bullet=11;
//_y_bullet=y;
}
if(_fired_bullet){
_x_bullet+=2;//velocity
}
}
int Bullet::get_pos_x()
{
return _x_bullet;
}
int Bullet::get_pos_y()
{
return _y_bullet;
}
void Bullet::set_pos(int x, int y)
{
_x_bullet = x;
_y_bullet = y;
}