Solved...How to Animate my TV

Started by NickyNyce, Sun 01/05/2011 02:56:48

Previous topic - Next topic

NickyNyce

Hello everyone, I'm having a bit of trouble with animating my TV. I'm trying to make a simple animation of turning my TV on and having someone talk for a short period of time and then the TV shuts off.

I created a new view #5 with 5 frames and have an object of a blacked out TV screen, when i interact with the blacked out TV the animation works, butI'm now having trouble shutting the TV off.
My code looks like this

function oTelevision_Interact()
{
object[5].SetView(5);
object[5].SetView(5, 0, 2);
 object[5].Animate(0, 5);
object[5].Animate(0, 3, eRepeat, eNoBlock, eBackwards);
cGuy.Say(".....");
object[5].SetView( ? )
}
I changed the view of the object but am now unaware how to change back to the original view.I would like to have the blacked out screen reappear at the end of the segment to shut the TV off,I'm confused on what view that would be to change it back ? .
sorry for the noobness, first time animating objects...thanks

monkey0506

You don't use the SetView function to set it to a static graphic instead of a view, you just set its Graphic. Also, why are you calling SetView twice to set it to view 5? If you look, the manual is just showing two different examples.

Code: ags
function oTelevision_Interact()
{
  int oldGraphic = oTelevision.Graphic;
  oTelevision.SetView(5, 0, 2);
  oTelevision.Animate(0, 5);
  oTelevision.Animate(0, 3, eRepeat, eNoBlock, eBackwards);
  cGuy.Say(".....");
  oTelevision.Graphic = oldGraphic;
}


Oh, and there's no need to use the object array in a room script. You only have to use that in the global script because the individual object pointers, like oTelevision, don't exist outside the room they belong to.

NickyNyce

I appreciate the help monkey, i did go through the manual and attempted to do this before just asking about it, This is my first time attempting to animate an object and im far from  good at scripting.

That was a copy and paste job i did there from the manual, Im sorry for wasting your time here but im still wet behind the ears. Thanks again

SMF spam blocked by CleanTalk