-- 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