aboutsummaryrefslogtreecommitdiff
path: root/virus2.lua
blob: a649fe004b5a8eb7a32f70dd9057d7f4898fdfcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
function drawVirusFight2()
  drawDesktop()
  drawVirus2()
  --drawAntivirusV2()
  drawAntivirusFight()
  drawPopups()
  if v2.popshoty < sys.h+1000 then
    if v2.popshots == false then
      v2.c.fire:play()
      v2.popshots = true
    end
    love.graphics.setColor(256,256,256)
    love.graphics.draw(v2.popshot, v2.popshotx+math.random(-v2.popshotsh,v2.popshotsh),
    v2.popshoty+math.random(-v2.popshotsh,v2.popshotsh), v2.popshotr+math.rad(math.random(-v2.popshotsh,v2.popshotsh)), 1, 1, 300, 200)
    if v2.popshotsh > 0 then
      v2.popshotsh = v2.popshotsh - 0.5*sys.s
    end
    v2.popshoty = v2.popshoty + v2.popshotm*sys.s
    v2.popshotm = v2.popshotm + 0.75*sys.s
    v2.popshotr = v2.popshotr + math.rad(1*sys.s)
    if v2.explodeFrame <= 89 then
      love.graphics.setColor(255,255,255)
      love.graphics.draw(expl.pic, expl.frames[math.floor(v2.explodeFrame)], sys.w/2, sys.h/2, 0, 2.5, 2.5, 320/2,240/2)
      v2.explodeFrame = v2.explodeFrame + 1*sys.s
      v1.explosionSound:play()
    end
  end
  if start.o == true then
    drawMenu()
  end
  if start.o == true and sys.mouse.p.p == true and sys.mouse.p.x > 255 or sys.mouse.p.y < sys.h-380 then
    start.o = false
  end
  drawStart()
  if v2.c.chat.msgs == 1 or v2.c.chat.msgs == 6 then
    v2.c.xd = sys.w/2
    v2.c.yd = sys.h/3
    if v2.c.chat.msgs == 6 then
      v2.c.handp = "fist"
    elseif v2.c.chat.msgs == 1 then
      v2.c.handp = "gunfront"
    end
  elseif v2.c.chat.msgs == 2 then
    v2.c.xd = sys.w/3
    v2.c.yd = sys.h/1.7
    v2.c.handp = "gunup"
  elseif v2.c.chat.msgs == 3 then
    v2.c.xd = sys.w/3
    v2.c.yd = sys.h/3
    v2.c.handp = "idle"
  elseif v2.c.chat.msgs == 4 then
    v2.c.xd = sys.w/1.7
    v2.c.yd = sys.h/1.7
  elseif v2.c.chat.msgs == 5 then
    v2.c.xd = sys.w/2
    v2.c.yd = sys.h/2
    win[4].x = sys.w/2
    win[4].y = sys.h-sys.h/4
  elseif v2.c.chat.msgs == 10 then
    v2.c.xd = sys.w/2
    v2.c.yd = sys.h/2
    v2.c.handp = "gunidle"
    if v2.c.cockgunplay == false then
      v2.c.cockgun:play()
      v2.c.cockgunplay = true
    end
  elseif v2.c.chat.msgs == 19 then
    v2.c.xd = sys.w/4
    v2.c.yd = sys.h/4
    v2.c.handp = "gunpoint"
    antivirus.scanning = true
  end
end
function drawPopup(id)
  love.graphics.setCanvas(v2.pop.p[id].cvs)
  drawUpBox(0, 0, v2.pop.p[id].w, v2.pop.p[id].h, 4)
  love.graphics.setColor(255,255,255)
  love.graphics.draw(window.bar, 3, 3, 0, (v2.pop.p[id].w-6)/643, 1)
  drawXBox(v2.pop.p[id].w-22, 5)
  --drawMinBox(v2.pop.p[id].w-40, 5)
  love.graphics.setColor(240, 240, 240)
  if v2.pop.p[id].ad == 1 then
    love.graphics.print("FREE PHONE!!!", 28, 9)
  elseif v2.pop.p[id].ad == 2 then
    love.graphics.print("CURE FOOT FUNGUS!!", 28, 9)
  elseif v2.pop.p[id].ad == 3 then
    love.graphics.print("YOU WON!!!", 28, 9)
  elseif v2.pop.p[id].ad == 4 then
    love.graphics.print("BIG PENIS!!!", 28, 9)
  elseif v2.pop.p[id].ad == 5 then
    love.graphics.print("SEXY SINGLES!!!", 28, 9)
  elseif v2.pop.p[id].ad == 6 then
    love.graphics.print("VIRUS ALERT!!!", 28, 9)
  elseif v2.pop.p[id].ad == 7 then
    love.graphics.print("SHOOT THE TABLET!!", 28, 9)
  elseif v2.pop.p[id].ad == 8 then
    love.graphics.print("POPUP BLOCKER!!!", 28, 9)
  elseif v2.pop.p[id].ad == 9 then
    love.graphics.print("A Letter for You.", 28, 9)
  elseif v2.pop.p[id].ad == 10 then
    love.graphics.print("PC BOOSTER!!!", 28, 9)
  end
  love.graphics.setColor(256, 256, 256)
  love.graphics.draw(win[2].icon16, 6, 5)
  drawDownBox(8, 31, v2.pop.p[id].w-16, v2.pop.p[id].h-39, 4)
  love.graphics.draw(v2.pop.a[v2.pop.p[id].ad], 8, 31, 0, (v2.pop.p[id].w-16)/640, (v2.pop.p[id].h-39)/400)
  love.graphics.setCanvas()
end
function addPopup(rand, x, y, w, h, ad, dup, m)
  if notification.sound3:isPlaying() == true then
    notification.sound3:rewind()
  else
    notification.sound3:play()
  end
  if rand == true then
    table.insert(v2.pop.p, 1, {
      w = math.random(300,800),
      ad = math.random(1,10),
      d = false,
      s = 0.2,
      exit = false,
      add = false,
      dup = true
    })
    v2.pop.p[1].h = v2.pop.p[1].w/math.random(1.4,1.6,1.8,2)
    v2.pop.p[1].x = math.random(0,sys.w-v2.pop.p[1].w)
    v2.pop.p[1].y = math.random(0,sys.h-v2.pop.p[1].h)
    v2.pop.p[1].cvs = love.graphics.newCanvas(v2.pop.p[1].w, v2.pop.p[1].h)
    if v2.pop.p[1].d == false then
      drawPopup(1)
      v2.pop.p[1].d = true
    end
  elseif rand == false then
    table.insert(v2.pop.p, 1, {x=x,y=y,w=w,h=h,ad=ad,d=false,s=0.2,exit=false,add=false,dup=dup,m=m})
    v2.pop.p[1].cvs = love.graphics.newCanvas(v2.pop.p[1].w, v2.pop.p[1].h)
    if v2.pop.p[1].d == false then
      drawPopup(1)
      v2.pop.p[1].d = true
    end
  end
end
function drawPopups()
  v2.pop.hov = 0
  for i=1,#v2.pop.p do
    love.graphics.setColor(255,255,255)
    love.graphics.draw(v2.pop.p[i].cvs, v2.pop.p[i].x,v2.pop.p[i].y,0,v2.pop.p[i].s)
  end
  for i=#v2.pop.p, 1, -1 do
    if v2.pop.hov == 0 and sys.mouse.x >= v2.pop.p[i].x and sys.mouse.x <= v2.pop.p[i].x+v2.pop.p[i].w
    and sys.mouse.y >= v2.pop.p[i].y and sys.mouse.y <= v2.pop.p[i].y+v2.pop.p[i].h then
      v2.pop.hov = i
    end
  end
  for i=1,#v2.pop.p do
    if v2.pop.p[i].s < 1 and v2.pop.p[i].exit == false then
      v2.pop.p[i].s = v2.pop.p[i].s + (0.075/v2.pop.p[i].s)*sys.s
      if v2.pop.p[i].s > 1 then
        v2.pop.p[i].s = 1
      end
    elseif v2.pop.p[i].s > 0 and v2.pop.p[i].exit == true then
      v2.pop.p[i].s = v2.pop.p[i].s - (0.4*v2.pop.p[i].s)*sys.s
      if v2.pop.p[i].s < 0.1 then
        v2.pop.p[i].s = 0
      end
    end
    if mouseClick(v2.pop.p[i].x+v2.pop.p[i].w-22, v2.pop.p[i].y+5, 16, 16) == true and v2.pop.p[i].exit == false and v2.pop.hov == i then
      v2.pop.p[i].exit = true
      if v2.pop.p[i].m == true then
        music.tension2:play()
        scene = 3
        for i=1,#v2.pop.p do
          v2.pop.p[i].exit = true
        end
      end
    elseif mouseClick(v2.pop.p[i].x+8, v2.pop.p[i].y+31, v2.pop.p[i].w-16, v2.pop.p[i].h-39) == true
    and v2.pop.p[i].exit == false and v2.pop.hov == i and v2.pop.p[i].dup == true then
      v2.pop.p[i].exit = true
      if #v2.pop.p <= 6 then
        v2.pop.add = true
      end
    end
    if v2.pop.p[i].exit == true and v2.pop.p[i].s <= 0 then
      table.remove(v2.pop.p, i)
      collectgarbage("collect")
      break
    end
  end
  if v2.pop.add == true and #v2.pop.p <= 6 then
    addPopup(true)
    addPopup(true)
    v2.pop.add = false
  end
end
function drawVirus2()
  love.graphics.setColor(255,255,255)
  playAnimation(v2.c.idle, true, v2.c.x, v2.c.y, v2.c.r, v2.c.s, 125, 125, 0.5)
  love.graphics.stencil(drawVirus2Stencil, "replace", 1)
  love.graphics.setStencilTest("greater", 0)
  love.graphics.draw(v2.c.pupil, v2.c.x-26+math.random(-0.7,0.7),v2.c.y-57+math.random(-0.7,0.7),v2.c.r,v2.c.s)
  love.graphics.draw(v2.c.pupil, v2.c.x+21+math.random(-0.7,0.7),v2.c.y-57+math.random(-0.7,0.7),v2.c.r,v2.c.s)
  love.graphics.setStencilTest()
  v2.c.sp = math.sqrt(math.abs(v2.c.xd - v2.c.x)*2 + math.abs(v2.c.yd - v2.c.y)*2)/5
  v2.c.angle = math.atan2((v2.c.yd - v2.c.y), (v2.c.xd - v2.c.x))
  v2.c.spx = v2.c.sp * math.cos(v2.c.angle)
  v2.c.spy = v2.c.sp * math.sin(v2.c.angle)
  if v2.c.x > v2.c.xd then
    if v2.c.x + v2.c.spx <= v2.c.xd then
      v2.c.x = v2.c.xd
    else
      v2.c.x = v2.c.x + v2.c.spx
    end
  elseif v2.c.x < v2.c.xd then
    if v2.c.x + v2.c.spx >= v2.c.xd then
      v2.c.x = v2.c.xd
    else
      v2.c.x = v2.c.x + v2.c.spx
    end
  end
  if v2.c.y > v2.c.yd then
    if v2.c.y + v2.c.spy <= v2.c.yd then
      v2.c.y = v2.c.yd
    else
      v2.c.y = v2.c.y + v2.c.spy
    end
  elseif v2.c.y < v2.c.yd then
    if v2.c.y + v2.c.spy >= v2.c.yd then
      v2.c.y = v2.c.yd
    else
      v2.c.y = v2.c.y + v2.c.spy
    end
  end
  handOpa("idle",v2.c.handsOp)
  handOpa("fist",v2.c.fistOp)
  handOpa("gunup",v2.c.gunupOp)
  handOpa("gunfront",v2.c.gunfrontOp)
  handOpa("gunidle",v2.c.gunidleOp)
  handOpa("gunpoint",v2.c.gunpointOp)
  if v2.c.handsOp ~= 0 then
    love.graphics.setColor(256,256,256,v2.c.handsOp)
    love.graphics.draw(v2.c.idle.hands, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125)
  end
  if v2.c.fistOp ~= 0 then
    love.graphics.setColor(256,256,256,v2.c.fistOp)
    love.graphics.draw(v2.c.idle.fist, v2.c.x+math.random(-0.2,0.2), v2.c.y+math.random(-0.2,0.2), v2.c.r, v2.c.s, v2.c.s, 125, 125)
  end
  if v2.c.gunidleOp ~= 0 then
    love.graphics.setColor(256,256,256,v2.c.gunidleOp)
    love.graphics.draw(v2.c.idle.gunidle, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125)
  end
  if v2.c.gunfrontOp ~= 0 then
    love.graphics.setColor(256,256,256,v2.c.gunfrontOp)
    love.graphics.draw(v2.c.gunfront, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125)
  end
  if v2.c.gunupOp ~= 0 then
    love.graphics.setColor(256,256,256,v2.c.gunupOp)
    love.graphics.draw(v2.c.gunup, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125)
  end
  if v2.c.gunpointOp ~= 0 then
    v2.gun.rt = math.atan2((win[4].y+win[4].h/2 - v2.c.y), (win[4].x+win[4].w/2 - v2.c.x))
    if v2.gun.r > v2.gun.rt then
      if v2.gun.r - math.rad((2*sys.s)*di) < v2.gun.rt then
        v2.gun.r = v2.gun.rt
      else
        v2.gun.r = v2.gun.r - math.rad((2*sys.s)*di)
      end
    elseif v2.gun.r < v2.gun.rt then
      if v2.gun.r + math.rad((2*sys.s)*di) > v2.gun.rt then
        v2.gun.r = v2.gun.rt
      else
        v2.gun.r = v2.gun.r + math.rad((2*sys.s)*di)
      end
    end
    love.graphics.setColor(256,256,256,v2.c.gunpointOp)
    love.graphics.draw(v2.c.idle.handright, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125)
    love.graphics.draw(v2.c.gunleft, v2.c.x-82, v2.c.y+35, v2.gun.r+math.rad(-100), 1.2, 1.2, 45, 10)
  end
  v2.mTime = v2.mTime + delta
  if v2.mTime > 6 and v2.c.chat.msgs == 17 and win[4].ex == true then
    nextChatv2(18)
  elseif win[4].ex == false and v2.c.chat.msgs >= 17 and v2.c.chat.msgs <= 18 then
    nextChatv2(19)
  elseif v2.mTime > 1 and v2.c.chat.msgs == 19 and win[4].ex == false then
    nextChatv2(20)
  elseif v2.c.chat.msgs == 21 and av.transform == true then
    nextChatv2(22)
  end
  if v2.c.chat.time >= 2 and v2.msgs[v2.c.chat.msgs] ~= nil then
    drawBubble(v2.c.x+50, v2.c.y-160, 300, 115, v2.c.chat.msg)
    if mouseClick(v2.c.x+50,v2.c.y-160,300,110) == true and v2.c.chat.next == false and v2.c.chat.msgs ~= 18 then
      nextChatv2()
    end
    if v2.msgs[v2.c.chat.msgs] ~= nil then
      if string.len(v2.msgs[v2.c.chat.msgs]) ~= string.len(v2.c.chat.msg) then
        v2.c.chat.char = v2.c.chat.char + v2.c.chat.sp*(60/love.timer.getFPS())
        v2.c.chat.msg = string.sub(v2.msgs[v2.c.chat.msgs], 1, math.floor(v2.c.chat.char))
      end
    end
  else
    v2.c.chat.time = v2.c.chat.time + delta
  end
end
function drawVirus2Stencil()
  love.graphics.setShader(mask_effect)
  playAnimation(v2.c.idle.mask, true, v2.c.x, v2.c.y, v2.c.r, v2.c.s, 125, 125, 0.5)
  love.graphics.setShader()
end
function handOpa(hand,opa)
  if v2.c.handp == hand then
    if opa < 256 then
      if hand == "idle" then
        v2.c.handsOp = v2.c.handsOp + 16
      elseif hand == "fist" then
        v2.c.fistOp = v2.c.fistOp + 16
      elseif hand == "gunfront" then
        v2.c.gunfrontOp = v2.c.gunfrontOp + 16
      elseif hand == "gunidle" then
        v2.c.gunidleOp = v2.c.gunidleOp + 16
      elseif hand == "gunup" then
        v2.c.gunupOp = v2.c.gunupOp + 16
      elseif hand == "gunpoint" then
        v2.c.gunpointOp = v2.c.gunpointOp + 16
      end
    end
  else
    if opa > 0 then
      if hand == "idle" then
        v2.c.handsOp = v2.c.handsOp - 16
      elseif hand == "fist" then
        v2.c.fistOp = v2.c.fistOp - 16
      elseif hand == "gunfront" then
        v2.c.gunfrontOp = v2.c.gunfrontOp - 16
      elseif hand == "gunidle" then
        v2.c.gunidleOp = v2.c.gunidleOp - 16
      elseif hand == "gunup" then
        v2.c.gunupOp = v2.c.gunupOp - 16
      elseif hand == "gunpoint" then
        v2.c.gunpointOp = v2.c.gunpointOp - 16
      end
    end
  end
end
function drawAntivirusV2()
  orderWindows()
  if av.transform == true then
    love.graphics.draw(antivirus.body, win[4].x+138/2+99+av.shakex, win[4].y+5+av.shakey, 0, win[4].s, win[4].s, 80)
    love.graphics.draw(antivirus.left, win[4].x+av.shakex, win[4].y+av.shakey)
    love.graphics.draw(antivirus.right, win[4].x+95+av.shakex, win[4].y+av.shakey)
  elseif v2.c.chat.msgs < 21 or av.transform == false then
    love.graphics.draw(win[4].cvs, win[4].x+av.shakex, win[4].y+av.shakey, 0, win[4].s)
  end
  if antivirus.status == "VIRUS FOUND!" then
    av.transform = true
  end
end
function nextChatv2(messag)
  v2.c.chat.next = true
  if messag == nil then
    v2.c.chat.msgs = v2.c.chat.msgs + 1
  else
    v2.c.chat.msgs = messag
  end
  v2.c.chat.char = 0
  v2.c.chat.msg = ""
  v2.mTime = 0
end