Projectile Library
Diff: Projectile.cpp
- Revision:
- 4:977109f7b9f6
- Parent:
- 3:70c599d9f191
- Child:
- 5:023fe92d6384
--- a/Projectile.cpp Tue May 02 09:43:19 2017 +0000 +++ b/Projectile.cpp Tue May 02 10:30:06 2017 +0000 @@ -12,8 +12,11 @@ } -void Projectile::init() +void Projectile::init(int playerx, int playery) { + printf("playerxy proj = %d %d \n", playerx, playery); + _playerx = playerx; + _playery = playery; //Make intial position of projectile = centre of player } @@ -23,8 +26,10 @@ void Projectile::draw(N5110 &lcd) { _velocity.x = 0; - _velocity.y = -4; + _velocity.y = -1; + + printf("playerxy projdraw = %d %d \n", _playerx, _playery); if(_x <= -1){ @@ -43,13 +48,13 @@ if(m == 0){ - _x = WIDTH/2; // Middle of screen // Change these values to change starting position - _y = HEIGHT/2; // Near bottom of screen + _x = _playerx +1; // Middle of screen // Change these values to change starting position + _y = _playery +1; // Near bottom of screen m = m+1; } lcd.drawRect(_x,_y,1,1,FILL_BLACK); printf("projdrawn %d %d \n", _x, _y); - printf("playerpos in proj = %d %d \n", playerx, playery); + //printf("playerpos in proj = %d %d \n", playerx, playery); } @@ -74,6 +79,6 @@ Vector2D Projectile::get_pos() { Vector2D projpos = {_x,_y}; - printf("projpos = %f %f \n", projpos.x, projpos.y); + //printf("projpos = %f %f \n", projpos.x, projpos.y); return projpos; } \ No newline at end of file