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
Diff: Bullet/Bullet.cpp
- Revision:
- 133:eed60548d170
- Parent:
- 126:c63c5ad39f73
- Child:
- 134:2da2db5871bd
--- a/Bullet/Bullet.cpp Mon May 06 14:35:54 2019 +0000
+++ b/Bullet/Bullet.cpp Wed May 08 18:54:03 2019 +0000
@@ -11,31 +11,33 @@
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;
-
+ _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);
+ //lcd.drawRect(_x_bullet,_y_bullet,_x_bullet+5,_y_bullet+5,FILL_BLACK);
+ lcd.drawSprite(_x_bullet,_y_bullet,16,16,(int *)bullet2);
}
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
- }
+ //_x_bullet=11;
+ //_y_bullet=y;
+ }
+ if(_fired_bullet){
+ _x_bullet+=4;//velocity
+ }
+
+ if(_x_bullet >= 84) {
+ init(16,10,1,0);
+ }
}
@@ -48,7 +50,6 @@
return _y_bullet;
}
-
void Bullet::set_pos(int x, int y)
{
_x_bullet = x;