Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. -- Giant Book Overlay by the AlphaBirth team
  2. function getScreenCenterPosition()
  3. local room = Game():GetRoom()
  4. local centerOffset = (room:GetCenterPos()) - room:GetTopLeftPos()
  5. local pos = room:GetCenterPos()
  6. if centerOffset.X > 260 then
  7. pos.X = pos.X - 260
  8. end
  9. if centerOffset.Y > 140 then
  10. pos.Y = pos.Y - 140
  11. end
  12. return Isaac.WorldToRenderPosition(pos, false)
  13. end
  14.  
  15. local playGiantbookOverlay
  16. do
  17. local sprite
  18. local anim
  19. playGiantbookOverlay = function(filename, shake)
  20. filename = "gfx/ui/giantbook/"..filename
  21. sprite = Sprite()
  22. sprite:Load("gfx/ui/giantbook/animation_giantbook.anm2", true)
  23. sprite:ReplaceSpritesheet(0, filename)
  24. sprite:LoadGraphics()
  25. if shake then
  26. anim = "Shake"
  27. else
  28. anim = "Appear"
  29. end
  30. sprite:Play(anim, true)
  31. end
  32. local function render()
  33. if not sprite then return end
  34. local pos = getScreenCenterPosition()
  35. sprite:Render(pos, Vector(0, 0), Vector(0, 0))
  36. end
  37. Cards:AddCallback(ModCallbacks.MC_POST_RENDER, render) -- Change the "Cards" to whatever you want
  38. local function update()
  39. if not sprite then return end
  40. sprite:Update()
  41. if sprite:IsFinished(anim) then
  42. sprite = nil
  43. end
  44. end
  45. Cards:AddCallback(ModCallbacks.MC_POST_UPDATE, update) -- Change the "Cards" to whatever you want
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement