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: Fade in/out actor?  (Read 5945 times)

0 Members and 1 Guest are viewing this topic.

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Fade in/out actor?
« on: May 05, 2005, 09:08:46 PM »

Hi all,

Is there a way to fade the main actor in and out in a scene?

I want to have an actor that just has a single frame for each direction. When someone clicks on the floor etc. I want to be able to fade actor out, SkipTo wherever, fade actor in, instead of having animation and using the GoTo. I don't want to have to make the fades into animated sprites.

Possible?

Thanks.
« Last Edit: May 05, 2005, 10:28:30 PM by TheDerman »
Logged

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: Fade in/out actor?
« Reply #1 on: May 05, 2005, 09:47:49 PM »

There is an AlphaColor attribute for the actor object.
So all you have to do is use this line
actor.AlphaColor = MakeRGBA(255, 255, 255, x);
and make x goes from 255 to 0 with a loop to make the character fade out and the opposite for fade in.
Logged
fl*p

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Fade in/out actor?
« Reply #2 on: May 05, 2005, 10:59:49 PM »

Thanks.

How do I set a variable to equal the actor?

Like, var ActorVar = WHAT???

 ???
Logged

MMR

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 349
  • http://mmrdeveloper.wordpress.com/
    • View Profile
    • TinyWME
Re: Fade in/out actor?
« Reply #3 on: May 05, 2005, 11:24:37 PM »

var actorVar = Game.LoadActor("the_actor_path.actor");
Logged

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Fade in/out actor?
« Reply #4 on: May 05, 2005, 11:40:24 PM »

Code: [Select]
function GoToObject()
{
  var ActorFade = Game.LoadActor("actors\my_actor\my_actor.actor");
  for(var i=1; i=>10; i=i+1)
   {
    ? ActorFade.AlphaColor = MakeRGB(255, 255, 255, 25*i);
    ? Sleep(100);
   }
  ActorFade.AlphaColor = MakeRGB(255, 255, 255, 0);
  actor.SkipTo(696, 523);
  actor.Direction = DI_UP;
}

This is just for the fade-out (I think).

This is what I have on the GoToObject function in an entity script, but the syntax checker says NO CHANCE - there is an error on the var ActorFade line.

Any ideas?
Logged

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Fade in/out actor?
« Reply #5 on: May 06, 2005, 05:07:50 AM »

Thanks to everyone - managed to get it working perfectly.

If anyone is interested:

Code: [Select]
on "LeftClick"
{
  for(var i=10; i>=1; i=i-1)
   {
    actor.AlphaColor = MakeRGBA(255, 255, 255, 25*i);
    Sleep(100);
   }
  actor.AlphaColor = MakeRGBA(255, 255, 255, 0);
  actor.GoTo(Scene.MouseX, Scene.MouseY);

  for(i=1; i<=10; i=i+1)
   {
    actor.AlphaColor = MakeRGBA(255, 255, 255, 25*i);
    Sleep(100);
   }
  actor.AlphaColor = MakeRGBA(255, 255, 255, 255);
}

This goes in the scene.script in the main "scripts" folder. It fades the character out, then I used a single frame "walk" sprite with a large "move by" value on that single frame to move the now invisible character quickly to the clicked spot on the floor, and then the character fades in. Perfect.

Thanks.
« Last Edit: May 06, 2005, 05:13:23 AM by TheDerman »
Logged
 

Page created in 0.571 seconds with 24 queries.