Re: a nice cavern filled with lava
Posted: Tue Aug 04, 2015 10:24 pm
I tried that:
then add this in onActivate function of the timer component of the lava_effects object:
What do you think ? Is there a way to make those projectiles move with random starting angles instead of tiles orientation ?
Code: Select all
defineObject{
name = "eruption",
components = {
{
class = "Light",
offset = vec(0, -0.5, 0),
range = 10,
color = vec(2.8, 1.2, 0.7),
brightness = 1,
fadeOut = 6,
castShadow = false,
destroyObject = true,
},
{
class = "Particle",
particleSystem = "eruption",
},
{
class = "Projectile",
spawnOffsetY = 0,
velocity = 1,
radius = 0.1,
gravity = 4,
fallingVelocity = 4,
destroyOnImpact = false,
onProjectileHit = function(self, what, entity)
self.go.particle:stop()
end,
onInit = function(self)
self.go:setSubtileOffset(math.random()-0.5, math.random()-0.5)
self:setFallingVelocity(math.random()*2+3)
self:setVelocity(math.random()*2)
end,
},
--{
--class = "Sound",
--sound = "fire_pit",
--volume = 0.5,
--},
},
placement = "floor",
editorIcon = 88,
}
defineParticleSystem{
name = "eruption",
emitters = {
-- star
{
--spawnBurst = true,
emissionRate = 200,
emissionTime = 3,
maxParticles = 700,
boxMin = {0,0,0},
boxMax = {0,0,0},
sprayAngle = {0,0},
velocity = {0,0},
objectSpace = false,
texture = "assets/textures/particles/candle_glow.tga",
lifetime = {1,1},
color0 = {4, 0.4, 0.2},
opacity = 1,
fadeIn = 0,
fadeOut = 1,
size = {0.05, 0.1},
gravity = {0,0,0},
airResistance = 0.1,
rotationSpeed = 5,
blendMode = "Additive",
},
}
}
Code: Select all
for f = 0,3 do spawn("eruption", self.go.level, self.go.x, self.go.y, f, self.go.elevation) end