Adding Objects Through Talents and setting the alpha

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Adding Objects Through Talents and setting the alpha

#1 Post 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,
		}

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

Re: Adding Objects Through Talents and setting the alpha

#2 Post by darkgod »

What do you mean set the alpha ?
[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 ;)

Zonk
Sher'Tul
Posts: 1067
Joined: Sat Mar 01, 2003 4:01 pm

Re: Adding Objects Through Talents and setting the alpha

#3 Post 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..
ToME online profile: http://te4.org/users/zonk
Addons (most likely obsolete): Wights, Trolls, Starting prodigy, Alternate save/resistance system

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Adding Objects Through Talents and setting the alpha

#4 Post 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.
<DarkGod> lets say it's intended

edge2054
Retired Ninja
Posts: 3756
Joined: Fri May 28, 2010 4:38 pm

Re: Adding Objects Through Talents and setting the alpha

#5 Post 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.

Post Reply