Skip to content
Snippets Groups Projects
Commit 3539ef52 authored by dg's avatar dg
Browse files

Added rain to the old forest

git-svn-id: http://svn.net-core.org/repos/t-engine4@1619 51575b47-30f0-44d4-a5cc-537603b46e54
parent 96a21fbd
No related branches found
No related tags found
No related merge requests found
......@@ -490,16 +490,15 @@ function _M:display()
self.player:playerFOV()
end
-- Level background
if self.level.data.background then
self.level.data.background(self.level)
end
-- Display using Framebuffer, sotaht we can use shaders and all
if self.fbo then
self.fbo:use(true)
if self.level.data.background then self.level.data.background(self.level, 0, 0) end
self.level.map:display(0, 0)
self.target:display(0, 0)
if self.level.data.foreground then self.level.data.foreground(self.level, 0, 0) end
self.fbo:use(false)
_2DNoise:bind(1, false)
self.fbo:toScreen(
......@@ -510,8 +509,10 @@ function _M:display()
-- Basic display
else
if self.level.data.background then self.level.data.background(self.level, self.level.map.display_x, self.level.map.display_y) end
self.level.map:display()
self.target:display()
if self.level.data.foreground then self.level.data.foreground(self.level, self.level.map.display_x, self.level.map.display_y) end
end
if not self.zone_name_s then
......
game/modules/tome/data/gfx/particle_drop.png

324 B

-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
dir = math.rad(110)
return { generator = function()
local x, y = rng.range(-width/2, width), rng.range(-height/2, height)
local vel = rng.float(32, 48)
return {
life = 30,
size = rng.float(3, 6), sizev = 0, sizea = 0,
x = x, xv = 0, xa = 0,
y = y, yv = 0, ya = 0,
dir = dir, dirv = blur, dira = 0,
vel = vel, velv = 0, vela = 0,
r = 0.6, rv = 0, ra = 0,
g = 0.7, gv = 0, ga = 0,
b = 0.7, bv = 0, ba = 0,
a = rng.float(0.6, 0.9), av = 0, aa = 0,
}
end, },
function(self)
if first then
self.ps:emit(700)
else
self.ps:emit(1)
end
first = false
end,
1000,
"particle_drop"
......@@ -28,6 +28,8 @@ return {
-- all_remembered = true,
all_lited = true,
persistant = "zone",
color_shown = {0.6, 0.6, 0.6, 1},
color_obscure = {0.6*0.6, 0.6*0.6, 0.6*0.6, 1},
ambiant_music = "Woods of Eremae.ogg",
generator = {
map = {
......@@ -67,4 +69,15 @@ return {
}, },
},
},
post_process = function(level)
local Map = require "engine.Map"
level.foreground_particle = require("engine.Particles").new("raindrops", 1, {width=Map.viewport.width, height=Map.viewport.height})
end,
foreground = function(level, x, y)
local Map = require "engine.Map"
level.foreground_particle:update()
level.foreground_particle.ps:toScreen(x, y, true, 1)
end,
}
......@@ -65,9 +65,9 @@ return {
level.background_particle = require("engine.Particles").new("starfield", 1, {width=Map.viewport.width, height=Map.viewport.height})
end,
background = function(level)
background = function(level, x, y)
local Map = require "engine.Map"
level.background_particle:update()
level.background_particle.ps:toScreen(Map.display_x, Map.display_y, true, 1)
level.background_particle.ps:toScreen(x, y, true, 1)
end,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment