Advertisement
Guest User

Attack21

a guest
Apr 13th, 2023
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Encounter.SetVar("wavetimer", 20)
  2. spawntimer = 0
  3. bullets = {}
  4. sprite3 = "SwordDownOrange"
  5. sprite2 = "SwordUpOrange"
  6. Arena.Resize(300,128)
  7.  
  8. function Update()
  9. spawntimer = spawntimer + 1
  10. if spawntimer%10 == 0 then
  11. local number = math.random(1,2)
  12. local posx = -200
  13. local posy = -30
  14. local bullet = CreateProjectile(sprite2, posx, posy)
  15. bullet.SetVar('type', "SwordUpOrange")
  16. bullet.SetVar('xspeed', 5)
  17. bullet.SetVar('yspeed', 0)
  18. table.insert(bullets, bullet)
  19. end
  20. if spawntimer%10 == 0 then
  21. local number = math.random(1,2)
  22. local posx = -200
  23. local posy = 30
  24. local bullet = CreateProjectile(sprite3, posx, posy)
  25. bullet.SetVar('type', "SwordDownOrange")
  26. bullet.SetVar('xspeed', 5)
  27. bullet.SetVar('yspeed', 0)
  28. table.insert(bullets, bullet)
  29. end
  30. for i=1, #bullets do
  31. local bullet = bullets[i]
  32. local xdifference = Player.x - bullet.x
  33. local ydifference = Player.y - bullet.y
  34. local xpos = bullet.x + bullet.GetVar('xspeed')
  35. local ypos = bullet.x + bullet.GetVar('yspeed')
  36. local xspeed = bullet.GetVar('xspeed')
  37. local yspeed = bullet.GetVar('yspeed')
  38. bullet.Move(xspeed, yspeed)
  39. bullet.SetVar('xspeed', xspeed)
  40. bullet.SetVar('yspeed', yspeed)
  41. end
  42. end
  43.  
  44. function OnHit(bullet)
  45. local damage = 1
  46. local color = bullet.GetVar("type")
  47. if color == "SwordDownOrange" and not Player.isMoving then
  48. Player.Hurt(1,0.02)
  49. Encounter.Call("AddKR")
  50. elseif color == "SwordUpOrange" and not Player.isMoving then
  51. Player.Hurt(1,0.02)
  52. Encounter.Call("AddKR")
  53. end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement