Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local map = {}
- SaveData[Level.filename()] = SaveData[Level.filename] or {}
- local LevelData = SaveData[Level.filename()]
- LevelData.mapVisibility = LevelData.mapVisibility or {}
- local mapBackground = Graphics.loadImage(Misc.resolveFile("MapBackground.png"))
- local mapRooms = {}
- function map.setData(mapData)
- mapRooms = mapData
- end
- map.viewMap = false
- function map.Update()
- for k,v in ipairs(mapRooms) do
- if not LevelData.mapVisibility[k] and v.hitbox:collide(player) then
- LevelData.mapVisibility[k] = true
- end
- end
- end
- function map.Draw()
- if map.viewMap then
- Misc.pause()
- Graphics.drawImageWP(mapBackground,0,0,3.1)
- for k,v in ipairs(mapRooms) do
- if LevelData.mapVisibility[k] then
- Graphics.drawImageWP(v.image, v.position.x, v.position.y, 3.2)
- end
- end
- if player.keys.run then
- Misc.unpause()
- map.viewMap = false
- end
- end
- end
- return map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement