is there a new gfx particle effect b20->b25?

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

is there a new gfx particle effect b20->b25?

#1 Post by marvalis »

Did anything change from b20 to b25?
As you can see, in b25, the particle effect is all over the place. In b20 it was confined to a smaller space.
There is also a difference in the fact that the b25 version is a windows version running under linux through wine. Is this a linux (wine) related bug?
b20:
Image
b25: (bad quality due to lag in capturing the screen-shot)
Image

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: is there a new gfx particle effect b20->b25?

#2 Post by darkgod »

Particles now should correctly scale to the tile size.
If you used fixed coords in your particles make sure you define a base_size.
Also how do you attach the particle to the actor ?
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: is there a new gfx particle effect b20->b25?

#3 Post by marvalis »

Example:

Code: Select all

---------------------------------------------------------------------------------------------------------------------------
data/gfx/particles/sand_trail.lua
---------------------------------------------------------------------------------------------------------------------------
base_size = 2

local toggle = false

return { generator = function()
	local ad = rng.range(0, 360)
	local a = math.rad(ad)
	local size = rng.range(6,35)
	local halfSize = size / 2

	return {
		trail = 1,
		life = rng.range(10,35),
		size = size, sizev = rng.range(-1,2)/18, sizea = rng.range(-2,1)/18,

		x = rng.range(-engine.Map.tile_w * 0.4 - halfSize, engine.Map.tile_w * 0.4 - halfSize), xv = 0, xa = 0,
		y = rng.range(-engine.Map.tile_h * 0.4 - halfSize, engine.Map.tile_h * 0.4 - halfSize), yv = 0, ya = 0,
		dir = 10, dirv = 0, dira = 0,
		vel = 0.3, velv = -0.03, vela = 0,

		r = rng.range(46,56)/255,  rv = 0, ra = 0,
		g = rng.range(18,25)/255,  gv = 0, ga = 0,
		b = 0 / 255,  bv = 0, ba = 0,
		a = rng.range(50, 65) / 255,  av = -1/400 , aa = 0
	}
end, },
function(self)
	self.nb = (self.nb or 0) + 1
	if self.nb < 10 then
		self.ps:emit(2)
	end
end,
260

Code: Select all

newTalent{
	name = "Cloud of sand",
	type = {"sand/control", 4},
	require = sand_req3,
	points = 5,
	stamina = 10,
	cooldown = 25,
	no_energy = true,
	tactical = { DISABLE = 3, DEFEND = 3, ESCAPE = 1 },
	createCloud = function(summoner, x, y, duration)
		local e = Object.new{
			name = "sand cloud",
			block_sight=true,
			canAct = false,
			x = x, y = y,
			damage = damage,
			duration = duration,
			summoner = summoner,
			summoner_gain_exp = true,
			act = function(self)
				local Map = require "engine.Map"
				self:useEnergy()
				if self.duration <= 0 then
					-- remove it from the map
					if self.particles then game.level.map:removeParticleEmitter(self.particles) end
					game.level.map:remove(self.x, self.y, Map.TERRAIN+3)
					game.level:removeEntity(self)
				else
					self.duration = self.duration - 1
				end
			end,
		}
		game.level:addEntity(e)
		game.level.map(x, y, Map.TERRAIN+3, e)

		-- add particles
		e.particles = Particles.new("sand_cloud", 1, { })
		e.particles.x = x
		e.particles.y = y
		game.level.map:addParticleEmitter(e.particles)
	end,
	action = function(self, t)
		local getDuration = math.floor(5 + self:getTalentLevel(t)/2 + self:getTalentLevel(t)/5 * self:getWil(10))
		local getRange = self:getTalentLevelRaw(t)
		local x, y = self.x, self.y
		local negRange = -getRange
		local posRange = getRange
		t.createCloud(self, x, y, getDuration+rng.range(0, 2))
		-- make sure the player is surrounded by the cloud
		for i = -1, 1 do for j = -1, 1 do if game.level.map:isBound(x + i, y + j) then
			if not game.level.map:checkAllEntities(x + i, y + j, "block_sight") then
				t.createCloud(self, x+i, y+j, getDuration+rng.range(0, 1))
			end
		end end end
		-- make more clouds in skill range with high chance
		for i = negRange, posRange do for j = negRange, posRange do if game.level.map:isBound(x + i, y + j) then
			if not game.level.map:checkAllEntities(x + i, y + j, "block_sight") and rng.percent(90) then
				t.createCloud(self, x+i, y+j, getDuration+rng.range(0, 1))
			end
		end end end
		-- give a small chance of +1 range clouds
		for i = negRange-1, posRange+1 do for j = negRange-1, posRange+1 do if game.level.map:isBound(x + i, y + j) then
			if not game.level.map:checkAllEntities(x + i, y + j, "block_sight") and rng.percent(20) then
				t.createCloud(self, x+i, y+j, getDuration+rng.range(0, 1))
			end
		end end end
		return true
	end,
	info = function(self, t)
		return ([[You cover the area around you in a thick cloud of sand, blocking all light in a radius of %d for %d turns.]]):format(self:getTalentLevelRaw(t), math.floor(5 + self:getTalentLevel(t)/2 + self:getTalentLevel(t)/5 * self:getWil(10)))
	end,
}

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: is there a new gfx particle effect b20->b25?

#4 Post by darkgod »

base_size = 2 is wrong :)
It's in pixel, so usualy 32 or 64
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: is there a new gfx particle effect b20->b25?

#5 Post by marvalis »

fixed & thanks

Post Reply