diff options
| -rw-r--r-- | var.lua | 1 | ||||
| -rw-r--r-- | virus2.lua | 89 |
2 files changed, 59 insertions, 31 deletions
@@ -242,6 +242,7 @@ function loadVar() v2.attackNextTimer = 0 v2.nextAttack = 20 v2.popupTimer = 60 + v2.shotgunTimer = 10 expl.deb[1].x = 0 expl.deb[1].y = 0 expl.deb[1].ym = 5 @@ -11,6 +11,13 @@ function drawVirusFight2() v2.c.money = v2.c.money + delta*(#v2.pop.p+1) v2.attackNextTimer = v2.attackNextTimer + delta v2.attackTimer = v2.attackTimer - delta + if v2.c.health <= 40 and v2.currentAttack ~= "shotgunRow" and v2.currentAttack ~= "shotgun" then + v2.shotgunTimer = v2.shotgunTimer - delta + end + end + if v2.c.health <= 40 and v2.shotgunTimer <= 0 then + v2FireShotgun() + v2.shotgunTimer = math.random(10,20) end if v2.currentAttack == "first" then v2FirstAttack() @@ -24,15 +31,17 @@ function drawVirusFight2() v2ShotgunPopupAttack() elseif v2.currentAttack == "shotgunBundle" then shotgunBundleAttack() - elseif v2.currentAttack == "shotgunSpiral" then - shotgunSpiralAttack() + elseif v2.currentAttack == "shotgunWheel" then + shotgunWheelAttack() elseif v2.currentAttack == "shotgunFast" then superFastShotgunAttack() elseif v2.currentAttack == "shotgun" then v2ShotgunAttack() + elseif v2.currentAttack == "shotgunSpiral" then + shotgunSpiralAttack() end if v2.nextAttack <= v2.attackNextTimer then - local na = math.random(1,8) + local na = math.random(1,9) if na == 1 then v2.currentAttack = "rShotgun" elseif na == 2 then @@ -44,11 +53,13 @@ function drawVirusFight2() elseif na == 5 then v2.currentAttack = "shotgunBundle" elseif na == 6 then - v2.currentAttack = "shotgunSpiral" + v2.currentAttack = "shotgunWheel" elseif na == 7 then v2.currentAttack = "shotgunFast" elseif na == 8 then v2.currentAttack = "shotgun" + elseif na == 9 then + v2.currentAttack = "shotgunSpiral" end v2.nextAttack = math.random(5,15) if na == 3 or na == 4 then @@ -137,8 +148,10 @@ function drawVirusFight2() v2.c.yd = sys.h/4 elseif v2.c.chat.msgs == 24 then v2.fightStart = true - if v2.currentAttack ~= "shotgun" then + if v2.currentAttack ~= "shotgun" and v2.c.health > 40 then v2.c.handp = "idle" + elseif v2.c.health <= 40 then + v2.c.handp = "gunpoint" end end if v2.fightStart == true then @@ -490,11 +503,13 @@ function floatingShotgun() if v2.sg[i].b == 1 then addBullet(x1,y1,v2.sg[i].r+math.rad(4),10,"v1",2) addBullet(x3,y3,v2.sg[i].r-math.rad(4),10,"v1",2) - end - if math.random(1,8) == 8 then - addBullet(x2,y2,v2.sg[i].r,10,"v1",5) - else - addBullet(x2,y2,v2.sg[i].r,10,"v1",1) + if math.random(1,8) == 8 then + addBullet(x2,y2,v2.sg[i].r,10,"v1",5) + else + addBullet(x2,y2,v2.sg[i].r,10,"v1",1) + end + elseif v2.sg[i].b == 2 then + addBullet(x2,y2,v2.sg[i].r,10,"v1",2) end v2.sg[i].f = true if v2.c.fire:isPlaying() == true then @@ -548,7 +563,7 @@ function v2FirstAttack() end function v2RandomShotgunAttack() if v2.attackTimer <= 0 then - v2.attackTimer = 0.4 + v2.attackTimer = 0.6 addShotgun(math.random(0,sys.w),math.random(0,sys.h/2),0.5,1) end end @@ -566,29 +581,14 @@ function v2ShotgunRowAttack() end function v2PopupAttack() if v2.attackTimer <= 0 then - v2.attackTimer = 1 + v2.attackTimer = 1.5 addPopup(true) end end function v2ShotgunAttack() v2.c.handp = "gunpoint" if v2.attackTimer <= 0 then - local xx = math.cos(v2.gun.r+math.rad(90))*(v2.c.x-82+150-v2.c.x-82) - -math.sin(v2.gun.r+math.rad(90))*(v2.c.y+35-275-v2.c.y+35)+v2.c.x-82 - local yy = math.sin(v2.gun.r+math.rad(70))*(v2.c.x-82+150-v2.c.x-82) - +math.cos(v2.gun.r+math.rad(90))*(v2.c.y+35-275-v2.c.y+35)+v2.c.y+35 - addBullet(xx,yy,v2.gun.r+math.rad(4),10,"v1",2) - addBullet(xx,yy,v2.gun.r-math.rad(4),10,"v1",2) - if math.random(1,8) == 8 then - addBullet(xx,yy,v2.gun.r,10,"v1",5) - else - addBullet(xx,yy,v2.gun.r,10,"v1",1) - end - if v2.c.fire:isPlaying() == true then - v2.c.fire:rewind() - else - v2.c.fire:play() - end + v2FireShotgun() if v2.c.health <= 50 and math.random(1,3) == 1 then for i=1,3 do addShotgun(math.random(0,sys.w),math.random(0,sys.h/2),0.5,1) @@ -601,20 +601,20 @@ function v2ShootingPopupAttack() end function v2ShotgunPopupAttack() if v2.attackTimer <= 0 then - v2.attackTimer = 1.5 + v2.attackTimer = 2 addPopup(true) addShotgun(math.random(0,sys.w),math.random(0,sys.h/2),2,1) end end function shotgunBundleAttack() if v2.attackTimer <= 0 then - v2.attackTimer = 2 + v2.attackTimer = 2.5 for i=1,8 do addShotgun(math.random(0,sys.w),math.random(0,sys.h/2),0.5,1) end end end -function shotgunSpiralAttack() +function shotgunWheelAttack() if v2.attackTimer <= 0 then v2.attackTimer = 1.5 local xx = math.random(0,sys.w) @@ -631,3 +631,30 @@ function superFastShotgunAttack() addShotgun(math.random(0,sys.w),math.random(0,sys.h/2),0.5,2) end end +function shotgunSpiralAttack() + if v2.attackTimer <= 0 then + v2.attackTimer = 2.3 + local xx = math.random(150,sys.w-150) + local yy = sys.h/4 + for i=1,12 do + local dd = 0.4+0.1*i + table.insert(v2.sg, 1, {x=xx,y=yy,r=math.rad(30*i),d=dd,b=1,t=0,op=0,ra=math.rad(45),rem=false,remp=false,f=false}) + end + end +end +function v2FireShotgun() + local xx = math.cos(v2.gun.r+math.rad(90))*(v2.c.x-82+150-v2.c.x-82) + -math.sin(v2.gun.r+math.rad(90))*(v2.c.y+35-275-v2.c.y+35)+v2.c.x-82 + local yy = math.sin(v2.gun.r+math.rad(70))*(v2.c.x-82+150-v2.c.x-82) + +math.cos(v2.gun.r+math.rad(90))*(v2.c.y+35-275-v2.c.y+35)+v2.c.y+35 + addBullet(xx,yy,v2.gun.r+math.rad(4),10,"v1",1) + addBullet(xx,yy,v2.gun.r-math.rad(4),10,"v1",1) + addBullet(xx,yy,v2.gun.r+math.rad(8),10,"v1",2) + addBullet(xx,yy,v2.gun.r-math.rad(8),10,"v1",2) + addBullet(xx,yy,v2.gun.r,10,"v1",5) + if v2.c.fire:isPlaying() == true then + v2.c.fire:rewind() + else + v2.c.fire:play() + end +end |
