Animating a radio and playing sound on interaction

Started by , Sun 19/02/2006 16:35:40

Previous topic - Next topic

mmd

Hey, I looked around for an answer to this and I did find a script that partly worked after I edited it. The problem is that while the object is animating and the music plays the GUI and all movement is disabled.

Here is the script:

Code: ags
  // script for Object 3 (Radio): Interact object
  if (GetGraphicalVariable("Music") == 1) {
    SetGraphicalVariable("Music", 0);
    StopMusic();
    object[3].SetView(4);
    
  }
  else {
    SetGraphicalVariable("Music", 1);
    PlayMusic(0);
    object[3].SetView(3);
    object[3].Animate(0, 1, true);
  }


Can anyone show me how to let the character continue to move while the radio is on?

Ashen

You need to add a parameter to object[3].Animate(...) to make it non-blocking, i.e.
Code: ags

  else {
    SetGraphicalVariable("Music", 1);
    PlayMusic(0);
    object[3].SetView(3);
    object[3].Animate(0, 1, true,false);
  }


As it is, you've got the RepeatStyle parameter set to eRepeat ('true' means the same thing here) meaning the animation will play and play, and you've left the BlockingStyle parameter as the default (eBlock). This means control is suspended until the animation finishes - which it never will as it's set to repeat.
Also, you might want to call Object.StopAnimating in the GetGraphicalVariable("Music") == 1 condition - unless you want the radio to continue animating with it's new view.
I know what you're thinking ... Don't think that.

mmd


SMF spam blocked by CleanTalk