Page 1 of 1

how to make a box be a certain color

Posted: Mon Aug 24, 2009 9:24 am
by enrico123
i want to make a box red and another box green but i dont know how to do it,can someone help

Re: how to make a box be a certain color

Posted: Mon Aug 24, 2009 10:23 am
by anomaly
here are two ways to make colored boxes

Code: Select all


## first method using materials
material 
	name red
	diffuse 1 0 0 1
end

material
	name green
	diffuse 0 1 0 1
end

box
	position -100 0 0
	size 20 20 20
	matref red
end

box
	position 100 0 0
	size 20 20 20
	matref green
end

## second method using 'tint' keyword
define colored_box
	meshbox
		size 20 20 20
	end
enddef


group colored_box # red box
	tint 1 0 0 1
	shift 0 -100 0
end

group colored_box # green box
	tint 0 1 0 1
	shift  0 100 0
end

1. create materials that are the colors you want and apply them to the boxes or whatever objects you want.
2. another way is to "tint" a meshbox. Tinting will shade the box texture a certain color.

You probably should have posted this in the "Help: Map Making" section.

Re: how to make a box be a certain color

Posted: Mon Aug 24, 2009 6:10 pm
by blast
(Moved to the proper forum)

You should also be able to use named colors instead of providing 4 numbers.

BZFlag Wiki - Color(BZW)

Re: how to make a box be a certain color

Posted: Tue Aug 25, 2009 2:19 pm
by enrico123
How do you apply that material that you put at the top of the page to a box

Re: how to make a box be a certain color

Posted: Tue Aug 25, 2009 3:01 pm
by joevano
Look at ALL the code provided. It is a complete example...

Re: how to make a box be a certain color

Posted: Wed Sep 02, 2009 11:09 am
by optic delusion
Matref

here's the color names
http://my.bzflag.org/w/Color%28BZW%29

Re: how to make a box be a certain color

Posted: Wed Sep 02, 2009 12:19 pm
by enrico123
how do you make it see through

Re: how to make a box be a certain color

Posted: Wed Sep 02, 2009 5:04 pm
by mrapple
enrico123 wrote:how do you make it see through
if you want a transparent box, you would add this to the mesh box:

Code: Select all

addtexture boxwall
diffuse 1 1 1 0.5
the last number (0.5) is the transparency. the lower it goes, the more transparent.

if you wanted for example, a transparent pyramid, you would do this:

Code: Select all

pyramid
   position 0 0 0
   size 10 10 10
   rotation 0
   diffuse 1 1 1 0.5
   addtexture pyrawall
end
the "addtexture pyrawall" tells it to use the local pyramid wall texture that comes with bzflag. local clients will then load this texture, then the diffuse 1 1 1 0.5 tells it to make it transparent.

hope this helps