This commit is contained in:
aozhiwei 2019-06-17 10:26:56 +08:00
parent a23e11bb66
commit e41ddd96cb

View File

@ -1159,6 +1159,20 @@ void Room::AirDrop(int appear_time, int box_id)
Vector2D dir = Vector2D::UP;
dir.Rotate(a8::RandAngle());
Vector2D box_pos = gas_data.pos_new + dir * (500 + rand() % 300);
#if 1
if (box_pos.x < 1.0f) {
box_pos.x = 1.0f;
}
if (box_pos.x >= MAP_WIDTH) {
box_pos.x = MAP_WIDTH - 1;
}
if (box_pos.y < 1.0f) {
box_pos.y = 1.0f;
}
if (box_pos.y >= MAP_HEIGHT) {
box_pos.y = MAP_HEIGHT - 1;
}
#endif
frame_event.AddAirDrop(appear_time, box_id, box_pos);
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f,
a8::XParams()