Advertisement
Katchau01

bullettest_chaserorb.lua

Aug 18th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. -- The chasing attack from the documentation example.
  2. chasingbullet = CreateProjectile('Wandering_Eye normal', Arena.width/16, Arena.height/16)
  3. chasingbullet.SetVar('xspeed', 0)
  4. chasingbullet.SetVar('yspeed', 0)
  5.  
  6. function Update()
  7.     local xdifference = Player.x - chasingbullet.x
  8.     local ydifference = Player.y - chasingbullet.y
  9.     local xspeed = chasingbullet.GetVar('xspeed') / 2 + xdifference / 50
  10.     local yspeed = chasingbullet.GetVar('yspeed') / 2 + ydifference / 50
  11.     chasingbullet.Move(xspeed, yspeed)
  12.     chasingbullet.SetVar('xspeed', xspeed)
  13.     chasingbullet.SetVar('yspeed', yspeed)
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement