Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Fading Entities.  (Read 2813 times)

0 Members and 1 Guest are viewing this topic.

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Fading Entities.
« on: August 01, 2009, 05:01:07 AM »

Hi guys,
A quick question.
I programmed in a way to have Fading using the following:

Code: WME Script
  1. method fadeOut( ent, time ) // This will fade the entity out.
  2. {
  3.   for ( var i = 255; i > 0; i = i-1 )
  4.   { 
  5.         ent.AlphaColor = MakeRGBA (255, 255, 255, i);
  6.         Sleep ( time );
  7.   }
  8.  
  9. }
  10.  
  11. method fadeIn( ent, time ) // This will fade the entity in.
  12. {
  13.   for ( var i = 0; i < 255; i = i+1 )
  14.   { 
  15.         ent.AlphaColor = MakeRGBA (255, 255, 255, i);
  16.         Sleep ( time );
  17.   }
  18.  
  19. }

but it only works for Windows.
Is their a way to do it for Entities in the scene like sprites, objects or even 3D actors?

Help is always greatly appreciated.
Cheers  ::beer
Myles Blasonato.
« Last Edit: August 01, 2009, 02:32:16 PM by Jyujinkai »
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Fading Entities.
« Reply #1 on: August 01, 2009, 11:17:18 AM »

Hello Myles

Are you sure it doesn't work? I use that method for fading entities a lot.

BTW, I suggest you change your sleeptime so it's longer than the framerate or it won't work properly if you run the game in a window. So if you're running at 70fps, you want a sleeptime somewhere between that and 24fps, the speed of a movie, so your fade is smooth, so somewhere between 15 and 40 ms.

Cheers

Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Fading Entities.
« Reply #2 on: August 01, 2009, 09:52:36 PM »

It does work for all 2D objects. 3D objects don't support the AlphaColor property.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: Fading Entities.
« Reply #3 on: August 04, 2009, 05:39:37 AM »

Interesting...i'll give it another go and see what's up.

Cheers  ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38
 

Page created in 0.042 seconds with 21 queries.