aboutsummaryrefslogtreecommitdiff
path: root/enemies.lua
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2022-02-10 18:22:43 -0800
committer1029chris <1029chris@gmail.com>2022-02-10 18:22:43 -0800
commit3c5f4bf5106d93939c6441f4da70e7830b654a34 (patch)
tree79908379d727029505b4f6fb94475fc952726be0 /enemies.lua
parent261d79999931657a25512c60e53fe322bbbf6f9a (diff)
LASERS!!!!!!!
Diffstat (limited to 'enemies.lua')
-rw-r--r--enemies.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/enemies.lua b/enemies.lua
index 006ba6c..c88b2d9 100644
--- a/enemies.lua
+++ b/enemies.lua
@@ -81,7 +81,7 @@ end
--SHOOTER THAT SHOOTS BIG WALLS!!!!!!
-function addwallshooter(x, shootup, health, speed, offset)
+function addwallshooter(x, shootup, health, speed, offset, bulletspeed)
local enemy = {}
enemy.x = x
enemy.y = 119
@@ -98,6 +98,7 @@ function addwallshooter(x, shootup, health, speed, offset)
enemy.shootcooldown = 0
enemy.speed = speed
enemy.shoottoggle = true
+ enemy.bulletspeed = bulletspeed or 1
function enemy.draw(enemy)
if enemy.inv < 0 or ceil(enemy.inv*10%2) == 1 then
@@ -128,17 +129,17 @@ function addwallshooter(x, shootup, health, speed, offset)
enemy.inv -= 1/60
foreach(players, enemy.collide)
if enemy.shootcooldown < 0 then
- if (t()+enemy.offset)%1>0.5 then
+ if (t()+enemy.offset)%1>0.5/enemy.bulletspeed then
if not enemy.shoottoggle then --implemented a toggle so that the sound effect for firing gets played only once.
enemy.shoottoggle = true
if enemy.x < 128 then
sfx(18)
end
end
- enemy.shootcooldown = 0.08
+ enemy.shootcooldown = 0.08/enemy.bulletspeed
local vely = -1
if shootup then vely = 1 end
- addbullet(enemy.x, enemy.y, -speed, vely, true, 2)
+ addbullet(enemy.x, enemy.y, -enemy.speed, enemy.bulletspeed*vely, true, 2)
else
enemy.shoottoggle = false
end