how to make a box be a certain color

Questions and answers about the how and why of making maps.
Post Reply
User avatar
enrico123
Private First Class
Private First Class
Posts: 91
Joined: Tue Jul 14, 2009 10:49 am
Contact:

how to make a box be a certain color

Post by enrico123 »

i want to make a box red and another box green but i dont know how to do it,can someone help
"See a need fill a need"-(Bigweld from the movie "Robots")
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Re: how to make a box be a certain color

Post 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.
User avatar
blast
General
General
Posts: 4933
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: how to make a box be a certain color

Post 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)
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
enrico123
Private First Class
Private First Class
Posts: 91
Joined: Tue Jul 14, 2009 10:49 am
Contact:

Re: how to make a box be a certain color

Post by enrico123 »

How do you apply that material that you put at the top of the page to a box
"See a need fill a need"-(Bigweld from the movie "Robots")
User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Re: how to make a box be a certain color

Post by joevano »

Look at ALL the code provided. It is a complete example...
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1054
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: how to make a box be a certain color

Post by optic delusion »

Matref

here's the color names
http://my.bzflag.org/w/Color%28BZW%29
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
User avatar
enrico123
Private First Class
Private First Class
Posts: 91
Joined: Tue Jul 14, 2009 10:49 am
Contact:

Re: how to make a box be a certain color

Post by enrico123 »

how do you make it see through
"See a need fill a need"-(Bigweld from the movie "Robots")
User avatar
mrapple
Sergeant Major
Sergeant Major
Posts: 460
Joined: Wed May 27, 2009 11:59 am
Location: Unknown
Contact:

Re: how to make a box be a certain color

Post 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
Image
Post Reply