How to use blink view?

Started by fovmester, Wed 05/10/2005 11:56:05

Previous topic - Next topic

fovmester

How do you get the characters to blink when you've given them a blink view?
I stood beside one of my "blinking" characters and she never blinks!

What have I missed!? Doesn't it work sort of like idle-view?

Ishmael

The blinking view is displayed every BlinkInterval during the character's speech, and thinking if BlinkWhileThinking is true. It's a bit confusingly said in the manual, but it is there...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

fovmester

so if I want my character to blink when he's not talking I have to use idle-view?

strazer

Or, if you want all characters to have an idle view as well as blinking, you can try out this early version of a script module for AGS v2.7 I have been working on.

Import the script module via menu "Script" -> "Module manager...".

Put the blinking animation for each direction into the character's normal (walking) view, beginning at loop 8:
loop 8: blinking down
loop 9: blinking left
loop 10: blinking right
loop 11: blinking up
loop 12: down-right
...
and so on.

Then, to start the blinking (in game_start for example):

Code: ags

  CharacterBlinking.Enable(cRoger);


- The blinking delay is randomized between 2 and 5 seconds
- The blinking will only play when the character not moving, not animating and not playing the idle animation
- Use CharacterBlinking.Disable to stop a character from blinking

The module has not been fully tested yet, so there may still be bugs to work out.

fovmester

Sounds exactly like what I want to accomplish! Thanks, strazer!! :)

fovmester

I tried your module out, and it was sweet. I found a bug though: After finishing blinking, it does change the loop back to the old one, but not the frame. Fix:

Code: ags

function repeatedly_execute_always() {

	int charid = 0; // start with character 0
	while (charid < GetGameParameter(GP_NUMCHARACTERS, 0, 0, 0)) { // loop for each character

		if (cbCharacter[charid].blinking == true) { // if character has blinking enabled

			if ((character[charid].Moving == false) && (character[charid].Animating == false) && (character[charid].View != character[charid].IdleView)) {
			  // if character is not walking, not animating (blinking) and not playing idle animation

				if ((character[charid].Loop >= BLINKING_LOOP) && (character[charid].Loop <= (BLINKING_LOOP+3))) { // if character was blinking
					character[charid].Loop = cbCharacter[charid].blinkoldloop; // restore old loop
					character[charid].Frame = 0;   // <<<<<<<< ADDED THIS ROW. /FOVMESTER
				}

				if (cbCharacter[charid].blinkdelay == 0) { // if delay until next blink has elapsed
					cbCharacter[charid].blinkoldloop = character[charid].Loop; // store current loop for restoring after the blink
					character[charid].Animate(character[charid].Loop + BLINKING_LOOP, 0, eOnce, eNoBlock); // animate using blinking loops of normal view
						// Using loops of the normal view avoids the need for seperate blinking views and unlocking the blinking view
					cbCharacter[charid].blinkdelay = (BLINKING_DELAY_MIN + Random(BLINKING_DELAY_MAX - BLINKING_DELAY_MIN)) * GetGameSpeed();
					  // randomize delay until next blink
				}
				else cbCharacter[charid].blinkdelay--; // if blinking delay has NOT yet elapsed, decrease it

			}

		}

		charid++; // loop to next character
	}

}

strazer

Thanks. Above version now contains your fix.

SMF spam blocked by CleanTalk