-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBullet.cpp
More file actions
29 lines (26 loc) · 784 Bytes
/
Bullet.cpp
File metadata and controls
29 lines (26 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "Bullet.h"
Bullet::Bullet(const Bullet& bulletProto)
: Entity (new Point(*bulletProto.pos), new Point(*bulletProto.accel), bulletProto.entityImages, { bulletProto.entityScreenRect.w / bulletProto.imgScale, bulletProto.entityScreenRect.h / bulletProto.imgScale }, bulletProto.imgScale){
team = bulletProto.team;
lifetime = 100;
visible = true;
angle = 0.0;
speed = bulletProto.speed;
}
Bullet::Bullet(std::vector<ReadableTexture*>* bulletImages, SDL_Point bulletImgSize, Point* bulletPos, double bulletSpeed, int scale)
: Entity(bulletImages, bulletImgSize, scale) {
team = 0;
lifetime = 100;
visible = true;
angle = 0.0;
speed = bulletSpeed;
}
void Bullet::update() {
lifetime -= 1;
if (lifetime <= 0) {
visible = false;
}
else {
Entity::update();
}
}