Int X and Character Animation question

Started by LeChuck, Thu 06/10/2005 03:42:28

Previous topic - Next topic

LeChuck

I can't believe I can't make this work... I am so angry I'm about to pop a fuse! In a rooms repeatedly execute:

Code: ags

if (i = 320) {
Ã,  SetCharacterView(JUBALON, 23);
Ã,  AnimateCharacter(JUBALON, 0, 3, 1);
Ã,  while (character[JUBALON].animating) Wait(1);
Ã,  ReleaseCharacterView(JUBALON);
Ã,  i = 0;
Ã,  }

i++;
}



My problem is where to define integers start value?

It's supposed to be an Idle animation, where a person is sipping soda from a bottle. When the animation is running, the bottle, Object 0, should vanish.

I've tried using the Idle animation thing, but that doesn't let me turn an object off, or does it? (Actually I tried playing an empty sound file during one frame of the animation to remove Object(0) (With the help of a bit of code in rep execute), but, since AGS can't distinguish one sound from another, it didn't work correctly. If a command like IsSoundPlaying(8) would be available, it would save a lot of trouble.

Or, perhaps there is a command that reports back if a spesific View is being used? If the program could report back if my character is using view 23 I'd sure appreciate someone telling it to me.Ã,  :-X

Kweepa

Firstly, you should write
Code: ags
if (i == 320)
rather than
Code: ags
if (i = 320)

Secondly, if you're using v2.7+, you can write
Code: ags

if (oSodaBottle.Visible && gJubalon.View == 23 && gJubalon.Frame == 5) oSodaBottle.Visible = false;

in repeatedly_execute.
Still waiting for Purity of the Surf II

LeChuck

That last piece of code certainly did the trick! Thank you! :)

monkey0506

Quote from: SteveMcCrea on Thu 06/10/2005 04:21:33
Code: ags

if (oSodaBottle.Visible && gJubalon.View == 23 && gJubalon.Frame == 5) oSodaBottle.Visible = false;

in repeatedly_execute.

I'm not sure if it would take longer to check the value or to assign it (even though it will take a fraction of a second), but even if oSodaBottle.Visible is false, you can still set it to false, so unless it saves time to check it instead of just setting the value, the check is not necessary.  And just to clarify, isn't Jubalon a character, meaning it would be cJubalon, not gJubalon?

Kweepa

Good point. Seems he got it working anyway!
Still waiting for Purity of the Surf II

SMF spam blocked by CleanTalk