Raising tint gradually? (SOLVED)

Started by R4L, Sun 29/10/2006 01:22:48

Previous topic - Next topic

R4L

I want to do a special effect, to make the screen tint to white, but gradually start from normal, then slowly tint to white. I tried to put this under dialog_request (b/c it goes with a dialog)

function dialog_request (int xvalue) {
Ã,  if (x == 1){
Ã,  int x = TintScreen(0,0,0);
Ã,  StopDialog();
Ã,  while (x < 100){
Ã,  x++;
Ã,  wait(1);
Ã,  }
FadeOut(1);
Wait(30);
cEgo.ChangeRoom(1);
}

Obviously this doesn't work, because you can't convert a void to an int. Is there a work-around to this?



nihilyst

Does this work?

while (x < 100){
  TintScreen(x,x,x)
  x++;
  wait(1);
}

R4L

Yes, thanks Nihilyst. Just one more question. It only seems to tint the screen with a hint of white, which doesn't really add to the effect. Is there another way that I don't see or is it not possible?

GarageGothic

#3
I'm not sure exactly what you need in the manner of tinting. But you do realize that you can also FadeOut to white by using SetFadeColor(255, 255, 255? An alternative is to make a full-screen GUI with a white background color. Then gradually change its transparency from 100 to 0 using a while loop similar to the one used above.

R4L

#4
Wow thanks alot GarageGothic! I looked in the manual for everything, but I didn't even see SetFadeColor. Ill try it out.

EDIT: Perfect! Thanks alot Garage! I also have to say thanks to Nihilyst for helping as well.  :)

gypsysnail

Just been reading this thread :) and wondered if this tinting would be good for night time - as in my game I will be needing the day to change to night time each night for 7 days and would this have to happen by event_handler? Let me know, that be great thanks :)
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

TintScreen might be what you're after - it's really a case of playing around with the parameters and seeing if it looks how you want.

You might also be able to use the Background Frames (if you're not already using them for animation). At the most basic, just change between frames to show different 'times' of day, or you could use RawDrawFrameTransparent for a more gradual transition. SetAmbientTint would probably be better to use with this, as it won't affect the backgrounds.

Not sure what "would this have to happen by event_handler" means.
I know what you're thinking ... Don't think that.

Khris

AFAIK, it's not possible to darken the screen using TintScreen, because TintScreen(0,0,0) won't do anything at all, TintScreen(5,5,5) will tint it with a hint of white, aso.
Darkening the whole screen is achieved best by using a transparent DynamicSprite that holds a black rectangle.

Regarding the event_handler stuff:
Gypsysnail propably wanted to know how to code it so that the screen gets gradually darker while game-time is passing from midday to evening, e.g.
This can be done using Timers, look up SetTimer in the manual.

A timer-loop could look like this:
Code: ags

int hour=1;Ã,  // 1 pm

// room's rep_ex
Ã,  if (IsTimerExpired(1)) {
Ã,  Ã,  
Ã,  Ã,  // darken screen, change bg frame, etc.

Ã,  Ã,  hour++;
Ã,  Ã,  if (hour<10) {Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  // reset timer if not 10 pm game-time yet
Ã,  Ã,  Ã,  SetTimer(1, 40*60*3);Ã,  Ã,  Ã, // 3 minutes = 1 hour game-time
Ã,  Ã,  }
Ã,  }


(This code isn't usable as-is, only meant as a guideline)

gypsysnail

Thanks KhrisMUC :) I will go and try this after work :). I will look up timer stuff in manual and if have any probs I will post here if thats cool.
Cheers
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

SMF spam blocked by CleanTalk