添加攻击方向处理
This commit is contained in:
parent
47917094fd
commit
b99e46de42
@ -61,8 +61,14 @@ int Room::AliveCount()
|
||||
|
||||
void Room::AddPlayer(Player* hum)
|
||||
{
|
||||
hum->pos.x = 100 + rand() % 100;
|
||||
hum->pos.y = 200 + rand() % 200;
|
||||
{
|
||||
hum->pos.x = 100 + rand() % 100;
|
||||
hum->pos.y = 200 + rand() % 200;
|
||||
hum->attack_dir = hum->pos;
|
||||
hum->attack_dir.Normalize();
|
||||
float angle = ((float)rand() / RAND_MAX) * 2.0f;
|
||||
hum->attack_dir.Rotate(angle);
|
||||
}
|
||||
hum->room = this;
|
||||
uniid_hash_[hum->entity_uniid] = hum;
|
||||
moveable_hash_[hum->entity_uniid] = hum;
|
||||
@ -97,8 +103,14 @@ void Room::ShuaAndroid()
|
||||
hum->name = a8::Format("机器人%d", {i+1});
|
||||
hum->meta = hum_meta;
|
||||
hum->entity_uniid = AllocUniid();
|
||||
hum->pos.x = 100 + rand() % 400;
|
||||
hum->pos.y = 200 + rand() % 500;
|
||||
{
|
||||
hum->pos.x = 100 + rand() % 400;
|
||||
hum->pos.y = 200 + rand() % 500;
|
||||
hum->attack_dir = hum->pos;
|
||||
hum->attack_dir.Normalize();
|
||||
float angle = ((float)rand() / RAND_MAX) * 2.0f;
|
||||
hum->attack_dir.Rotate(angle);
|
||||
}
|
||||
hum->room = this;
|
||||
hum->Initialize();
|
||||
uniid_hash_[hum->entity_uniid] = hum;
|
||||
|
Loading…
x
Reference in New Issue
Block a user