-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEnemyBullet.cpp
53 lines (44 loc) · 1.17 KB
/
EnemyBullet.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
#include"main.h"
EnemyBullet::EnemyBullet(Location spawnLocation , Player* player)
{
//変数の初期化
img = LoadGraph("resources/images/enemy_images/wizard/bullet_b.png");
location.x = spawnLocation.x;
location.y = spawnLocation.y;
vector.x = 0;
vector.y = 0;
diff.x = 0;
diff.y = 0;
radius = BULLET_RADIUS;
damage = BULLET_ATTAK_DAMAGE;
speed = BULLET_SPEED;
lifeTimeCnt = BULLET_LIFE_TIME;
SetPlayer_Location(player->GetLocation());
vector.x = Normalization_X(PlayerLoad_X(location.x), PlayerLoad_Y(location.y)) * BULLET_SPEED;
vector.y = Normalization_Y(PlayerLoad_X(location.x), PlayerLoad_Y(location.y)) * BULLET_SPEED;
}
EnemyBullet::~EnemyBullet()
{
DeleteGraph(img);
}
void EnemyBullet::Update(Player* player)
{
//プレイヤーの移動量をdiffにセット
SetPlayerAmountOfTravel_X(player->Player_MoveX());
SetPlayerAmountOfTravel_Y(player->Player_MoveY());
location.x += vector.x - diff.x;
location.y += vector.y - diff.y;
lifeTimeCnt--;
}
void EnemyBullet::Draw() const
{
DrawRotaGraph((int)location.x, (int)location.y, 1, 0, img, TRUE);
}
int EnemyBullet::GetDamage()
{
return damage;
}
int EnemyBullet::GetlifeTimeCnt()
{
return lifeTimeCnt;
}