Nemesis game, stats
Bullet.cpp
- Committer:
- musallambseiso
- Date:
- 2017-04-02
- Revision:
- 6:fb678d095e0a
- Parent:
- Ship1.cpp@ 5:b822aaa6200d
File content as of revision 6:fb678d095e0a:
#include "Bullet.h" Bullet::Bullet() { } Bullet::~Bullet() { } void Bullet::init(N5110 &lcd, Gamepad &pad, int speed) { Vector2D friendly_pos = _friendly.get_pos(); _x = friendly_pos.x+6; _y = friendly_pos.y+3; _velocity.x = speed; _velocity.y = 0; } void Bullet::draw(N5110 &lcd) { lcd.setPixel(_x,_y); } void Bullet::update() { _x += _velocity.x; _y += _velocity.y; } void Bullet::set_velocity(Vector2D v) { _velocity.x = v.x; _velocity.y = v.y; } Vector2D Bullet::get_velocity() { Vector2D v = {_velocity.x,_velocity.y}; return v; } Vector2D Bullet::get_pos() { Vector2D p = {_x,_y}; return p; } void Bullet::set_pos(Vector2D p) { _x = p.x; _y = p.y; }