Code: function onInit() ambientlight = 0x1A1A1AFF lightmap = rpg.graphics.newImage(320, 240) lightmap:setBlendMode "add" lightsource = rpg.graphics.newImage(100, 100) lightsource:drawCircle(true, 50, 50, 50, 0xFFFFFFFF, 0x000000FF) end function onFrame() if rpg.scene == "map" then lightmap:clear(ambientlight) local hero_x, hero_y = rpg.map.hero:getScreenPosition() lightmap:draw(lightsource, hero_x - 50, hero_y - 60) for i = 1, #rpg.map.events do local event_x, event_y = rpg.map.events[i]:getScreenPosition() lightmap:draw(lightsource, event_x - 50, event_y - 60) end rpg.graphics.setBlendMode "multiply" rpg.graphics.draw(lightmap, 0, 0) if rpg.keyboard.isDown "o" then local screenshot = rpg.graphics.copyRect(0, 0, 320, 240) rpg.graphics.writeImage(screenshot, "Save/screenshot.png") end end end
function onInit() ambientlight = 0x1A1A1AFF lightmap = rpg.graphics.newImage(320, 240) lightmap:setBlendMode "add" lightsource = rpg.graphics.newImage(100, 100) lightsource:drawCircle(true, 50, 50, 50, 0xFFFFFFFF, 0x000000FF) end function onFrame() if rpg.scene == "map" then lightmap:clear(ambientlight) local hero_x, hero_y = rpg.map.hero:getScreenPosition() lightmap:draw(lightsource, hero_x - 50, hero_y - 60) for i = 1, #rpg.map.events do local event_x, event_y = rpg.map.events[i]:getScreenPosition() lightmap:draw(lightsource, event_x - 50, event_y - 60) end rpg.graphics.setBlendMode "multiply" rpg.graphics.draw(lightmap, 0, 0) if rpg.keyboard.isDown "o" then local screenshot = rpg.graphics.copyRect(0, 0, 320, 240) rpg.graphics.writeImage(screenshot, "Save/screenshot.png") end end end
Foren-Regeln