changing colors

Game Editor comments and discussion.

Postby DocRabbit » Sun Aug 12, 2007 8:32 am

This explanation always helped me remember colors, so I thought I would share it. This is in the terms of (RGB)=(0 to 255,0 to 255, 0 to 255). Color, as we perceive it, is the reflected light on an object. So in terms of RGB, the numbers represent reflection amount. Thus, to make something red, set green and blue to min amounts and red to max amount, (255,0,0). To make White, set all to max(255,255,255). To make black, set all to min(0,0,0).

I think if you are use to RGB values, to use Rux's paintcolor for a known RGB value, it would passthru this formula first.

RGB=Normal RGB values from 0 to 255
GEr,GEg,GEb=GameEditor Rux's paintcolor values 1 to 0.

R=abs((255*GEr)-255) and GEr=(255-R)/255
G=abs((255*GEg)-255) and GEg=(255-G)/255
B=abs((255*GEb)-255) and GEb=(255-B)/255

You may want to check my math but these should work.

Rux, I am confused on your 0 to 1 values for rgb variables, my GE seems to work on 255 values.
User avatar
DocRabbit
 
Posts: 114
Joined: Fri Oct 27, 2006 2:56 am
Score: 10 Give a positive score

Postby florafinn@yahoo.com » Sun Aug 12, 2007 12:11 pm

I am trying to make my actor change colors.
User avatar
florafinn@yahoo.com
 
Posts: 18
Joined: Sat Aug 11, 2007 7:17 pm
Score: 0 Give a positive score

Postby pixelpoop » Sun Aug 12, 2007 2:00 pm

Add a "Draw Actor" event of action "Script Editor" onto your actor. Put this in the code:
Code: Select all
r=rand(256);
g=rand(256);
b=rand(256);


now hit Add->Immediate Action
now hit Game Mode and watch the actor turn colors.

and again I suggest, if you haven't gone through the tutorials, you really should.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby florafinn@yahoo.com » Sun Aug 12, 2007 2:20 pm

sweet It worked thanks!


but is there a way for It only to change one ( not blinking ) color and it being because it toughted another actor

read my form and I hope you can answer with a good answer. :D ( game-editor.com Forum Index -> General -> Change )



Hope you understand you know mario like he changes when he toughtes stuff.
User avatar
florafinn@yahoo.com
 
Posts: 18
Joined: Sat Aug 11, 2007 7:17 pm
Score: 0 Give a positive score

Postby pixelpoop » Sun Aug 12, 2007 6:56 pm

You can set up a collision event and script in the color change to that.

and again I suggest, if you haven't gone through the tutorials, you really should.


.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Troodon » Mon Aug 13, 2007 4:49 am

You can use the actorname.r in any event where you use script editor.
If you want your actor to change colour itself randomly, you can do a timer and everytime the time happens you add the random code

actorname.r = rand(255);
actorname.g = rand(255);
actorname.b = rand(255);

If you don't use timer, the colour will chance very quickly. (Depending on your fps)

You can use almost any script math with the colours. Here is some examples:

actorname.r = yoruvariable;

actorname.r += 1;

actorname.r = actorname.g - actorname.b;

You can play with them and see what happens. :)
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Previous

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron