Acho que consegui corrigi a ponta das armas
[Projeto-PCG.git] / weaponmanager.lua
blob7c8dadf316779d981da226a22af52fad812dfdfc
1 function Weapon(t)
2 local w = regweapon(t.righthand[1],t.righthand[2],
3 t.lefthand[1],t.lefthand[2],
4 t.name,t.firerate,
5 t.tip[1],t.tip[2])
6 regfirefunction(w,t.whenfire)
7 for i = 1, #t.sprite do
8 regspriteline(w,t.sprite[i][1],t.sprite[i][2],t.sprite[i][3],t.sprite[i][4])
9 end
10 return t
11 end
13 function Line(t)
14 return t
15 end
17 function default(t,k,v)
18 if t[k] == nil then
19 t[k] = v
20 end
21 end
23 function Shot(t)
24 default(t,"gravity",0)
25 default(t,"duration",3000)
26 default(t,"speed",10)
27 local s = createshot(t.x,t.y,t.angle,t.duration,t.weapon,t.gravity,t.speed)
28 for i = 1, #t.sprite do
29 regspritelineshot(s,t.sprite[i][1],t.sprite[i][2],t.sprite[i][3],t.sprite[i][4])
30 end
31 end