Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Giant Book Overlay by the AlphaBirth team
- function getScreenCenterPosition()
- local room = Game():GetRoom()
- local centerOffset = (room:GetCenterPos()) - room:GetTopLeftPos()
- local pos = room:GetCenterPos()
- if centerOffset.X > 260 then
- pos.X = pos.X - 260
- end
- if centerOffset.Y > 140 then
- pos.Y = pos.Y - 140
- end
- return Isaac.WorldToRenderPosition(pos, false)
- end
- local playGiantbookOverlay
- do
- local sprite
- local anim
- playGiantbookOverlay = function(filename, shake)
- filename = "gfx/ui/giantbook/"..filename
- sprite = Sprite()
- sprite:Load("gfx/ui/giantbook/animation_giantbook.anm2", true)
- sprite:ReplaceSpritesheet(0, filename)
- sprite:LoadGraphics()
- if shake then
- anim = "Shake"
- else
- anim = "Appear"
- end
- sprite:Play(anim, true)
- end
- local function render()
- if not sprite then return end
- local pos = getScreenCenterPosition()
- sprite:Render(pos, Vector(0, 0), Vector(0, 0))
- end
- Cards:AddCallback(ModCallbacks.MC_POST_RENDER, render) -- Change the "Cards" to whatever you want
- local function update()
- if not sprite then return end
- sprite:Update()
- if sprite:IsFinished(anim) then
- sprite = nil
- end
- end
- Cards:AddCallback(ModCallbacks.MC_POST_UPDATE, update) -- Change the "Cards" to whatever you want
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement