Mercurial > vanillian
diff main.lua @ 23:d16e33662aa0
define music in the map
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sat, 15 Dec 2012 20:57:28 +0100 |
| parents | 57eeed74a575 |
| children | 5e21e27942c7 8891a036fb23 |
line wrap: on
line diff
--- a/main.lua Sat Dec 15 20:44:13 2012 +0100 +++ b/main.lua Sat Dec 15 20:57:28 2012 +0100 @@ -13,6 +13,7 @@ local GRID = anim8.newGrid(64, 64, 128, 256) local scroll_speed = 250 local scroll_margin = 64 +local MUSIC function newMob(x, y, cells) @@ -69,9 +70,6 @@ SHADOW_IMAGE = love.graphics.newImage('shadow.png') MOBS_IMAGE = love.graphics.newImage('mobs.png') load_map('level01.tmx') - local music = love.audio.newSource('walktune.xm', 'static') - music:setLooping(true) - music:play() end function load_map(filename) @@ -80,6 +78,11 @@ MAP = ATL.Loader.load(filename) MAP.drawObjects = false MAP.layers['control'].visible = false + if MAP.properties.music then + MUSIC = love.audio.newSource(MAP.properties.music, 'static') + MUSIC:setLooping(true) + MUSIC:play() + end for i, data in pairs(MAP.layers['mobs'].objects) do if data.name == 'villain' then makeVillain(newMob(data.x, data.y, '1-2,1'))
