Add inaccuracy to missile targeting
This commit is contained in:
parent
d6952e9eaf
commit
a935b498da
|
@ -25,6 +25,7 @@ local enemies = {}
|
||||||
local enemy_radius = 0.025
|
local enemy_radius = 0.025
|
||||||
local enemy_min_shoot = 2
|
local enemy_min_shoot = 2
|
||||||
local enemy_max_shoot = 20
|
local enemy_max_shoot = 20
|
||||||
|
local enemy_inaccuracy = 0.05
|
||||||
|
|
||||||
local window_width = nil
|
local window_width = nil
|
||||||
local window_height = nil
|
local window_height = nil
|
||||||
|
@ -290,7 +291,8 @@ function updateEnemies(dt)
|
||||||
enemy.until_shoot = enemy_min_shoot + math.random() * (enemy_max_shoot - enemy_min_shoot)
|
enemy.until_shoot = enemy_min_shoot + math.random() * (enemy_max_shoot - enemy_min_shoot)
|
||||||
if unreflected_missiles < unreflected_missiles_max then
|
if unreflected_missiles < unreflected_missiles_max then
|
||||||
local target = cities[math.random(1, #cities)]
|
local target = cities[math.random(1, #cities)]
|
||||||
spawnMissile(enemy.x, enemy.y, target.x, target.y, 0.2)
|
local inaccuracy = math.random() * 2 * enemy_inaccuracy - enemy_inaccuracy
|
||||||
|
spawnMissile(enemy.x, enemy.y, target.x + inaccuracy, target.y, 0.2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue