Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Color a sprite red  (Read 4325 times)

0 Members and 1 Guest are viewing this topic.

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Color a sprite red
« on: June 22, 2009, 03:55:19 AM »

I'd like to color a sprite in the scene red while something is going on.  I searched the forum and found some script but it doesn't seem to work.

Any help is appreciated.

I found this script:

this.AlphaColor=MakeRGB("255, 255, 255, 255");


Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Darky

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 109
    • View Profile
    • Spreadcamp
Re: Color a sprite red
« Reply #1 on: June 22, 2009, 04:41:56 AM »

I don't know what your 4th value is for (it doesnt seem to be needed for RGB?), but anyway if you have a script file like with entitys you could specify it like this.

Done via WME 2D Demo, scenes/room/scr/book.script

Code: [Select]
on "LookAt"
{
this.AlphaColor=MakeRGB(255, 0, 0); // turn book red

// walk to the desk
actor.GoToObject(this);
actor.Talk("~"Wintermute Engine: User's manual.~"");
actor.TurnTo(DI_DOWN);
actor.Talk("Sounds interesting.");
actor.TurnTo(DI_UPRIGHT);

this.AlphaColor=MakeRGB(255, 255, 255); // restore full color
}

It's all about providing the right numbers :) Check a program like Photoshop to get the right RGB code of your color.
Note that 255, 255, 255 stands for pure white which from what I understand is for presenting unaltered colors as they are in your source image. That's most likely why it didn't work for you.
Also note in the code example if you abort the routine early it never will turn into full color again until you run through it again (in this case look at the book again and wait), so be careful how / where you place the restore to normal color.

Of course all this is just from a noob, so no warrantys ;) Have fun
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Color a sprite red
« Reply #2 on: June 22, 2009, 04:53:51 AM »

Thanks.  I got it to work:

this.AlphaColor = MakeRGB(255, 0, 0, 255);

which is your script without the fourth parameter so your script works fine and so does mine.  : )  I'm not sure what the fourth parameter is but will search it in the forum.  I'd like to know what each parameter represents.

Thanks. : )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Azrael

  • Regular poster
  • ***
  • Karma: 9
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • View Profile
    • Mad Orange
Re: Color a sprite red
« Reply #3 on: June 22, 2009, 07:07:27 AM »

RGBA

Red
Green
Blue
Alpha

;)
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Color a sprite red
« Reply #4 on: June 22, 2009, 05:48:39 PM »

Thanks, Azrael!    :D
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Darky

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 109
    • View Profile
    • Spreadcamp
Re: Color a sprite red
« Reply #5 on: June 22, 2009, 06:54:58 PM »

Thanks, too :)

I guess when you don't specify "Alpha" it just sets itself to a default of 255, right?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Color a sprite red
« Reply #6 on: June 22, 2009, 07:02:26 PM »

Yes, exactly.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.027 seconds with 25 queries.