Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F625418
Bullet.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
576 B
Referenced Files
None
Subscribers
None
Bullet.cpp
View Options
#include
"Bullet.h"
extern
int
width
;
extern
int
height
;
Bullet
::
Bullet
(
int
X
,
int
Y
,
int
S
,
bool
friendly
)
{
x_pos
=
X
;
y_pos
=
Y
;
status
=
0
;
speed
=
S
;
isFriendly
=
friendly
;
}
Bullet
::
Bullet
(){}
Bullet
::~
Bullet
(){}
void
Bullet
::
UpdateBulletPos
(
Spaceship
&
s
)
{
x_pos
=
s
.
x_pos
;
y_pos
=
s
.
y_pos
;
}
void
Bullet
::
UpdatebulletPos
(
Enemy
&
e
)
{
x_pos
=
e
.
x_pos
+
30
;
y_pos
=
e
.
y_pos
+
10
;
}
void
Bullet
::
Increment
()
{
if
(
isFriendly
)
y_pos
-=
speed
;
else
y_pos
+=
speed
;
if
(
y_pos
<
10
||
y_pos
>
height
-10
)
//if bullet reaches top or bottom
status
=
0
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sat, Nov 14, 11:27 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
110859
Default Alt Text
Bullet.cpp (576 B)
Attached To
Mode
R72 DarthInvaders
Attached
Detach File
Event Timeline