-- The bouncing bullets attack from the documentation example.
spawntimer = 0
bullets = {}
actbt = {}
Arena.Resize(128, 512)
function Update()
spawntimer = spawntimer + 1
if spawntimer%15 == 0 then
local posx = 15 - math.random(30)
local posy = Arena.height/2
local bullet = CreateProjectile('money2', posx, posy)
bullet.SetVar('velx', 1 - 2*math.random())
bullet.SetVar('vely', 0)
table.insert(bullets, bullet)
end
--[[if spawntimer == 200 then
local posx = 15 - math.random(30)
local posy = Arena.height/2
local actBt = CreateProjectile('UI/actbt_0', posx, posy)
actBt.SetVar('velx', 1 - 2*math.random())
actBt.SetVar('vely', 0)
actBt.SetVar('harmless', true)
table.insert(actbt, actBt)
end
--]]
for i=1,#bullets do
local bullet = bullets[i]
local velx = bullet.GetVar('velx')
local vely = bullet.GetVar('vely')
local newposx = bullet.x + velx
local newposy = bullet.y + vely
vely = vely - 0.04
bullet.MoveTo(newposx, newposy)
bullet.SetVar('vely', vely)
end
for i=1,#actbt do
local actBt = actbt[i]
local velx = actBt.GetVar('velx')
local vely = actBt.GetVar('vely')
local newposx = actBt.x + velx
local newposy = actBt.y + vely
vely = vely - 0.02
actBt.sprite.rotation = actBt.sprite.rotation + 5
actBt.MoveTo(newposx, newposy)
actBt.SetVar('vely', vely)
end
function OnHit(actBt)
if actBt.GetVar('harmless') == true then
else
Player.Hurt(3)
end
end
end
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}