Animation controlling problem (SOLVED)

Started by InCreator, Mon 13/06/2005 00:06:22

Previous topic - Next topic

InCreator

Here again, I'm trying something way over my head...  :=

Problem itself is simple, yet I'm unsure if it belongs to beginner's tech. Move it if needed.

Right. Let's say I have a sliding door. Now, while it plays slowly opening animation, I want to tint regions elsewhere on background to imitate volumetric light coming from door. Simple!

But...
The regions should go along with animation! The animation itsself should block game activity during it's play also.
An image to describe the situation:



The door is shown here. Problem is that I can't think of a way to synchronize regions to get correct RGB values as door animation frames progress further. Of course, I could just play door animation and tint regions AFTER that, but what if character stands at some of regions at the time? it would look weird. Also, since animation is quite short, I don't want player to wander around during it - it should be blocking.

How to do it?
But how to do it simply? ;)

strazer

You can animate the door non-blocking, then block the game manually like this:

Code: ags

  oDoor.SetView(3);
  oDoor.Animate(0, 20, eOnce, eNoBlock, eForwards);
  while (oDoor.Animating == true) {
    // tint the regions here
    Wait(1);
  }


Is that what you mean?

InCreator

#2
Almost...

while (oDoor.Animating==true))
{

Can I if-check somehow, which frame is currently played here and THEN tint region?

}

Something like GetCurrentFrame(object)?

EDIT: Ah, found from manual!

oObject.Graphic

CJ has thought to everything...
And thanks, strazer, for moving my thoughts to right path!



strazer

Not directly, it seems, but you could calculate which frame is currently displayed:

Code: ags

  //...
  int timepassed;
  while (oDoor.Animating == true) {
    int frame = timepassed / 20; // 20: delay used in oDoor.Animate call
    Wait(1);
    timepassed++;
    if (frame == 0) { /* tint */ }
    else if (frame == 1) { /* tint more */ }
    // etc.
  }


(Untested)

Edit: Ah, yes, or by checking the currently displayed sprite slot. Good idea.

SMF spam blocked by CleanTalk