Page 1 of 1

Adding Objects Through Talents and setting the alpha

Posted: Thu Nov 25, 2010 4:30 am
by edge2054
Is there any way to set the alpha when I create an object with a talent?

For instance I want to create a portal for jumpgate but it's putting a black box around it like we get around stairs.

So is there a way to add objects and set the alpha like other objects are set? (Say swords, runes, and what not.)

Here's the code I'm using for reference.

Code: Select all

local e = Object.new{
			old_feat = game.level.map(game.player.x, game.player.y, Map.TERRAIN),
			name = "jumpgate two",
			display = '&', color=colors.PURPLE,
			always_remember = true,
			block_move = false,
			block_sight = false,
			canAct = false,
				act = function(self)
				self:useEnergy()
				local t = game.player:getTalentFromId(game.player.T_JUMPGATE)
				if game.player:isTalentCoolingDown(t) then
					print("[[gate]] removed ", gate_x, " :: ", gate_y)
					game.level.map(gate_x, gate_y, engine.Map.TERRAIN, self.old_feat)	
					game.level:removeEntity(self)
					game.level.map:redisplay()
				end
			end,
			summoner_gain_exp = true,
			summoner = self,
		}

Re: Adding Objects Through Talents and setting the alpha

Posted: Thu Nov 25, 2010 8:44 pm
by darkgod
What do you mean set the alpha ?

Re: Adding Objects Through Talents and setting the alpha

Posted: Thu Nov 25, 2010 9:01 pm
by Zonk
darkgod wrote:What do you mean set the alpha ?
I assume he means the 'background' for the object. Objects have a transparent background by default..

Re: Adding Objects Through Talents and setting the alpha

Posted: Thu Nov 25, 2010 9:36 pm
by yufra
I believe you want add_displays, which is how stairs are placed on top of floor images in Viral Resistance. Specifically you can look at viralresistance/data/general/grids/basic.lua.

Code: Select all

	image = "terrain/floor_office.png",
	add_displays = {
		engine.Entity.new{
			display_on_seen = true,
			display_on_remember = true,
			image = "terrain/stairs_up.png",
		},
	},
You could probably set up a portal to simply add to the end of add_displays and then remove them later.

Re: Adding Objects Through Talents and setting the alpha

Posted: Fri Nov 26, 2010 3:46 pm
by edge2054
Yeah, what Zonk said is what I was shooting for. I want the portal object I'm creating to have a transparent background and showing up on the tile rather then replacing it.