Compare commits
2 Commits
d6952e9eaf
...
643663a415
Author | SHA1 | Date |
---|---|---|
Juhani Krekelä | 643663a415 | |
Juhani Krekelä | a935b498da |
|
@ -10,6 +10,8 @@ local missile_radius = 0.005
|
|||
local missile_trail_fade = 0.4
|
||||
local missile_trail_min_visibility = 0.03
|
||||
local missile_trail_length = math.log(missile_trail_min_visibility, missile_trail_fade)
|
||||
local missile_speed_min = 0.15
|
||||
local missile_speed_max = 0.25
|
||||
|
||||
local unreflected_missiles = 0
|
||||
local unreflected_missiles_max = 5
|
||||
|
@ -25,6 +27,7 @@ local enemies = {}
|
|||
local enemy_radius = 0.025
|
||||
local enemy_min_shoot = 2
|
||||
local enemy_max_shoot = 20
|
||||
local enemy_inaccuracy = 0.05
|
||||
|
||||
local window_width = nil
|
||||
local window_height = nil
|
||||
|
@ -290,7 +293,9 @@ function updateEnemies(dt)
|
|||
enemy.until_shoot = enemy_min_shoot + math.random() * (enemy_max_shoot - enemy_min_shoot)
|
||||
if unreflected_missiles < unreflected_missiles_max then
|
||||
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
|
||||
local speed = missile_speed_min + math.random() * (missile_speed_max - missile_speed_min)
|
||||
spawnMissile(enemy.x, enemy.y, target.x + inaccuracy, target.y, speed)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue