Advertisement
Bob_the_Hamster

Untitled

Feb 28th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. define constant(1, flashlight timer)
  2.  
  3. plotscript, flashlight circle of light, begin
  4. lights are off()
  5. setup flashlight
  6.  
  7. variable (room which called script)
  8. room which called script := current map
  9.  
  10. flashlight iteration()
  11. end
  12.  
  13. plotscript, cancel flashlight, begin
  14. stop timer(flashlight timer)
  15. #free slice (flashlight circle)
  16. flashlight circle := 0
  17. flashlight circle of light()
  18. end
  19.  
  20. script, flashlight iteration, begin
  21. if (current map <> room which called script) then (
  22. cancel flashlight
  23. exit script
  24. )
  25.  
  26. # Keep moving above all other map slices, because the order could change when
  27. # the map changes
  28. if (flashlight circle <> last child (parent slice (flashlight circle))) then (
  29. move slice above (flashlight circle, last child (lookup slice (sl:map root)))
  30. )
  31.  
  32. # Because the slice is parented to the maproot its
  33. # position is in map coordinates
  34. put slice (flashlight circle, hero pixel x, hero pixel y)
  35.  
  36. # call this script again on the next tick
  37. set timer(flashlight timer, 0, 1, @flashlight iteration)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement