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
function thecode.bublegun.ray.move(id,fx)
rot=math.deg(math.atan2(projectiles[id].sx,-projectiles[id].sy))
if (fx==1) then
particle(p_smoke,projectiles[id].x-math.sin(math.rad(rot))*7,projectiles[id].y+math.cos(math.rad(rot))*7)
particlespeed(math.random(-2,2)*0.1,math.random(-2,2)*0.1)
particlefadealpha(0.01)
particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
particle(p_lightpuff,projectiles[id].x-math.sin(math.rad(rot))*6,projectiles[id].y+math.cos(math.rad(rot))*6)
particlefadealpha(0.04)
particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
end
projectiles[id].sx=projectiles[id].sx+getwind()
projectiles[id].sy=projectiles[id].sy+getgravity()
msubt=math.ceil(math.max(math.abs(projectiles[id].sx),math.abs(projectiles[id].sy))/3)
msubx=projectiles[id].sx/msubt
msuby=projectiles[id].sy/msubt
for i=1,msubt,1 do
projectiles[id].x=projectiles[id].x+msubx
projectiles[id].y=projectiles[id].y+msuby
if collision(col3x3,projectiles[id].x+math.sin(math.rad(rot))*20,projectiles[id].y-math.cos(math.rad(rot))*20,1,1)==1 then
angledelta(15,158)
if terraincollision()==1 or playercollision()~=projectiles[id].ignore then
if playercollision()~=0 then
playerdamage(playercollision(),0+math.random(0,10))
end
playsound(cc.gammagun.sfx_impact)
particle(p_smoke,projectiles[id].x+math.sin(math.rad(rot))*5,projectiles[id].y-math.cos(math.rad(rot))*5)
particlefadealpha(0.006)
particle(p_muzzle,projectiles[id].x+math.sin(math.rad(rot))*5,projectiles[id].y-math.cos(math.rad(rot))*5)
particlesize(1.5,1.5)
particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
particlefadealpha(0.01)
for j=1,20,1 do
particle(p_lightpuff,projectiles[id].x+math.sin(math.rad(rot))*5,projectiles[id].y-math.cos(math.rad(rot))*5)
particlespeed(math.random(-20,20)*0.1,math.random(-20,20)*0.1)
particlefadealpha(0.04)
particlesize(math.random(40,70)*0.1,math.random(40,70)*0.1)
particlecolor(1+math.random(0,255),1+math.random(0,255),1+math.random(0,255))
end
grey=math.random(0,40)
if math.random(0,1)==1 then
terrainalphaimage(gfx_crater100,projectiles[id].x,projectiles[id].y,math.random(6,9)*0.1,grey,grey,grey)
else
terrainalphaimage(gfx_crater125,projectiles[id].x,projectiles[id].y,math.random(6,9)*0.1,grey,grey,grey)
end
freeprojectile(id)
return 1
end
else
projectiles[id].ignore=0
end
if (projectiles[id].y)>getwatery()+5 then
projectiles[id].sy=-projectiles[id].sy
particle(p_waterhit,projectiles[id].x,projectiles[id].y)
playsound(sfx_hitwater1)
freeprojectile(id)
return 1
end
end
scroll(projectiles[id].x,projectiles[id].y)
end