-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbullet.cpp
More file actions
41 lines (34 loc) · 899 Bytes
/
bullet.cpp
File metadata and controls
41 lines (34 loc) · 899 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
30
31
32
33
34
35
36
37
38
39
40
41
/***********************************************************************
* C++ File:
* Bullet
* Author:
* Austin Jesperson and Emilio Ordonez
* Summary:
* A bullet to be fired from our ship
************************************************************************/
#include "bullet.h"
/***********************************
* BULLET : MOVE
***********************************/
void Bullet::move()
{
double x = position.getMetersX() + velocity.getMetersX() * 48.0;
double y = position.getMetersY() + velocity.getMetersY() * 48.0;
position.setMetersX(x);
position.setMetersY(y);
time += 1.0;
isLiving();
}
/**************************************
* BULLET : IS LIVING
**************************************/
void Bullet::isLiving()
{
if (active = true)
{
if (lifeSpan <= time)
{
deactivate();
}
}
}