Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: flikkering lights  (Read 7338 times)

0 Members and 1 Guest are viewing this topic.

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
flikkering lights
« on: July 16, 2004, 11:55:17 AM »

Hello again. I am trying to make a game with wintermute and i am very pleased with the engine. Wow, very impressive Workl !!!
My strenghth lies in making 3D Renderings, but i am very new to scripting. So excuse me if this has been asked before or is absolutelly easy to do.

I have many light sources in the scene. all are rendered in two ways. light on and light out. so i want the sprites with the light on to flikker. so no fade out and no fade in.
maybe i can define a list of alpha values to be used fpr displaying the sprite. i do not want to render every state of the light.

Can you provide me al little script. that displayes a sprite in this way referring on a list of predefined alpha values...

I would be very gratefull, really , maybe i show you some of my rendered backgrounds ........... .. . .    just joking

i hope you understand my problem. i am not used to communicate in english..

thanks al lot,
stucki
 

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: flikkering lights
« Reply #1 on: July 17, 2004, 08:51:11 AM »

Umm, I don't know if I understand correctly. So basically you want to set several different colors to a scene entity. Create your lights as entities in the scene (using SceneEdit) then create a new script file with following content and attach that script to your entities.

Code: [Select]
  #include "scripts\base.inc"
 
 
var AlphaColors = new Array( RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255) );
var i = 0;

while(true)
{
this.AlphaColor = AlphaColors[i];
Sleep(500);

i = i + 1;
if(i>=AlphaColors.Length) i = 0;
}


Of course, you will want to change the actual RGB values (you can add more of them to the list) and the Sleep command specifies the frequency of flickering.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: flikkering lights
« Reply #2 on: July 17, 2004, 12:32:55 PM »

first of all thanks for answering so fast.

Have to try this now, but i am not sure if i made myself clear ?

I have a background image where the light is rendered off
then i have a sprite image where the light is rendered on
now i put the light-on sprite exacly over the light-off image and i want to change the transparency of the light-on spite with a list of values. i want to get a flickering light. maybe
there can be a random variable that defines the amount of more or less transparency .....

if i understand correctly in your script you change the rgb-values. can i also change the grade of transparency ???

thanks
stucki
 

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: flikkering lights
« Reply #3 on: July 17, 2004, 12:48:14 PM »

Oh, I see. You can set transparency by the optional fourth parameter of the RGB() function. For example:

RGB(255, 255, 255, 128)

will set half-transparency. In your case, set the R, G and B values to 255 (->white) and set the fourth parameter in range from 0 (fully transparent) to 255 (opaque).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: flikkering lights
« Reply #4 on: July 17, 2004, 01:36:39 PM »

thanks a lot, now i think i wil get it

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: flikkering lights
« Reply #5 on: July 19, 2004, 08:43:03 AM »

hi its me again. its working wnderful !!!! thanks a lot. now i have another one ....... stupid me

i ant to place a circular shadow beneath the main character. a sprite that is locateted exactly under the main character and is scaled like it. Do i have to put it manually in photoshop under each frame of the animation. or is there another easier way. ??

stucki

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re: flikkering lights
« Reply #6 on: July 19, 2004, 08:52:47 AM »

Hi Stucki,

i ant to place a circular shadow beneath the main character. a sprite that is locateted exactly under the main character and is scaled like it. Do i have to put it manually in photoshop under each frame of the animation. or is there another easier way. ??

Well, you COULD write e.g. a script in an endless loop, which verifies the actor's position and sets the shadow's sprite position... or write you own GoTo method, etc., but for quite sure this is the harder way.

The best and easiest way is IMHO the one you already answered yourself - add the shadow to your animation sprites and for a better look the shadow should be somewhat semi-transparent (use of alpha-channel) and that's it. By this way, you also avoid problems with the scaling.

Good luck. :)
Logged
Mooh!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: flikkering lights
« Reply #7 on: July 19, 2004, 08:23:25 PM »

The best and easiest way is IMHO the one you already answered yourself - add the shadow to your animation sprites and for a better look the shadow should be somewhat semi-transparent (use of alpha-channel) and that's it. By this way, you also avoid problems with the scaling.

OR you can have the shadow in a separate image and add it to every frame as a "subframe" in SpriteEdit.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: flikkering lights
« Reply #8 on: July 20, 2004, 01:41:24 PM »

Hi again.
I have problems with  the alpha channel of the png-format. i work with photoshop. but even if my alpha channel is made of 256 colors greyscale, i only get tranparent or not transparent in the game.
is it possible to work with a greyscaled aplhamap for different transparencies and how is it done ???

thanks
stucki

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: flikkering lights
« Reply #9 on: July 20, 2004, 01:48:59 PM »

okay i can add the shadow via subframe in the spriteeditor, but it always stays in front of the charackter. is it possible to change this ??
thanks
stucki

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: flikkering lights
« Reply #10 on: July 20, 2004, 01:50:33 PM »

Make sure you are running the game in accelerated mode (in the startup settings dialog there is the "Use hardware acceleration" checkbox). If it doesn't help you can send me the picture, I'll look at it.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: flikkering lights
« Reply #11 on: July 20, 2004, 01:54:40 PM »

sorry i am a blind man. fixed the problem in the spriteeditor myself. stupid me ....
 

Page created in 0.039 seconds with 24 queries.