Facebook
From HereIsHow_, 3 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 211
  1.  
  2.  
  3.  
  4. function line(a, c, xh, vertical)
  5.  
  6.     if a < c and vertical == false then
  7.         for i = 0,c,1
  8.         do
  9.             bullet = CreateProjectile( "collision", i,  xh, -1)
  10.         end
  11.     end
  12.  
  13.     if c < a and vertical == false then
  14.         for i = 0,a,1
  15.         do
  16.             bullet = CreateProjectile( "collision", i,  xh, -1)
  17.         end
  18.     end
  19.  
  20.     if vertical == true and a < c then
  21.         for i = a,c,1
  22.         do
  23.             bullet = CreateProjectile( "collision", xh,  i, -1)
  24.         end
  25.     end
  26.     if vertical == true and c < a then
  27.         for i = c,a,1
  28.         do
  29.             bullet = CreateProjectile( "collision", xh,  i, -1)
  30.         end
  31.     end
  32.  
  33.     bullet.ppcollision = true
  34. end
  35.  
  36. function box(a,b,c,d)
  37.     line(a,c,b,false)
  38.     line(a,c,d,false)
  39.     line(b,d,a,true)
  40.     line(b,d,c,true)
  41. end
  42.  
  43. function OnHit(bullet)
  44.     if Input.Up > 0 then
  45.         Player.Move( 0,  -2, false)
  46.     end
  47.  
  48.     if Input.Down > 0 then
  49.         Player.Move( 0,  2, false)
  50.     end
  51.  
  52.     if Input.Left > 0 then
  53.         Player.Move( 2,  0, false)
  54.     end
  55.  
  56.     if Input.Right > 0 then
  57.         Player.Move( -2,  0, false)
  58.     end
  59.  
  60. end
  61.