[Solved] SayBackground Y position

Started by Dave Gilbert, Wed 30/08/2017 17:55:26

Previous topic - Next topic

Dave Gilbert

Hi hive mind.

I have a room in my game where a bunch of characters are sitting on subway seats. You can select which character goes with you on a mission by clicking on them. When you click on them, they play an animation where they stand up. So far so straightforward.

I added some background banter conversation between the characters, using the SayBackground command. When the characters are seated, it displays normally:



But after I click on a character and they stand up, the text is always displayed at the "seated" Y position, covering the talking character:



How does SayBackground determine the Y position? Can it be changed or adjusted in any way? I'm sure the solution to this is something obvious that I am missing, but any light shedding is appreciated!

Thanks,

-Dave

edit: To clarify, I am not clicking on the character while the text is being displayed. The character is already standing when the SayBackground command is called.

Kitty Trouble

After experimenting with this I have learned the following about Y position:

1) It is based on the height of the 1st frame of the view
2) It will re-calculate when you switch views, but not during animations.

Hope that helps!

Dave Gilbert

Ahhh. I adjusted the height of the 1st frame to match but now the text is way too high when they are sitting. :)



Is there a clever way around this or am I going to have to switch in and out of views?

Either way, I will fiddle. Thanks!

Kitty Trouble

I'm not experienced with AGS but it doesn't seem like you can do it without switching views, unless you want to go the route of having invisible characters and write a custom function.

Kitty Trouble

Code: ags
  ViewFrame *currentFrame = Game.GetViewFrame(cEgo.View, cEgo.Loop, cEgo.Frame);
  ViewFrame *firstFrame = Game.GetViewFrame(cEgo.View, cEgo.Loop, 0);
  firstFrame.Graphic = currentFrame.Graphic;
  cEgo.SayBackground("Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello ");


Here are a few lines of script that could solve this problem, of course you'd need to re-set the first frame before you started animating again.

Monsieur OUXX

Another workaround : create 4 dummy invisible characters that you place above each real character, and adjust those characters' Y position as needed.
Less classy than Morgan's solution, but less risk to mix up the frames and have a faulty 1st frame.

 

Snarky

Yeah, I was gonna say: overwriting frames in the loop seems like something that has a high risk of causing weird bugs elsewhere in your game, unless you're very careful to encapsulate the code and always restore the frame properly afterwards.

Kitty Trouble

It was just an idea, as I mentioned before having invisible "dummy" characters and creating a new view would both also do the trick, just depends on how you wanna go about it.

Dave Gilbert

Huh. Some neat ideas! Changing the first frame of the loop shouldn't effect things TO much, since visually the frame won't change. Thanks for the tip. I'll give it a whirl now.

Dave Gilbert


SMF spam blocked by CleanTalk