Mirror Speech Reflection

Started by Herooftime1000, Thu 16/10/2014 01:29:34

Previous topic - Next topic

Herooftime1000

All right. Here is the deal.



A few months ago, I was content on how I made the reflection on the mirror using an object image. It would play certain animations depending on the protaganist's mood and speech view shown on the green box by playing to animations simultaneously. There was little bit of desynchronization at the end of the speech, but it would fix itself. It was simplistic, at best, but it worked for me.

That is, only when the speeches run on a timer.

I've responded to people playing my demo who wanted to move the text along on their own accord by turning the timer off. Now, it seems that after she is finished with a speech, the character in the mood box would stop talking, but the reflection would continue with its animation.

I'm not very skilled with this program yet, but I've learned that maybe dynamic sprites could fix the problem. But the thing is, I don't know where to start. I'd get rid of the object, draw the sprite up, and update it using the execute repeatedly function, but I don't know if it would work correctly. The mood box and reflection are two separate sprites and if I were to simply copy what's on the mood box, I would probably get bordered sprite with a colored background on the mirror.

What should I do?

Thank you.

Cassiebsg

Just a sugestion, and not really a solution to your problem: But you could try the Easy Mirrors module?
There are those who believe that life here began out there...

Herooftime1000

Quote from: Cassiebsg on Thu 16/10/2014 17:11:20
Just a sugestion, and not really a solution to your problem: But you could try the Easy Mirrors module?

I'll try it out and see what I can do. Thanks!

Herooftime1000

Well, I tried to run it, but my game is being made using AGS v3.2.1, and v3.3.0 is required to run this script properly.

I don'y know what to do. I've made it so the reflection was a separate character and told them one to speak in the background while the other talked, but that won't work. I'm very confused. Please help me, someone, I'm mulling over the best way to do this...

ThreeOhFour

Instead of calling the animations at the same time, you can have AGS automatically get the exact frame that the player is on each game loop and change the reflection's sprite to that. If you have both characters view set up the same way (which is what it sounds like you've done) then you can do:

Code: ags

function repeatedly_execute_always()
{
  if (player.Speaking)
  {
    cReflect.ChangeView(Put here the speaking view of the reflection);
  }
  else cReflect.ChangeView(Put here the normal view of the reflection);
  cReflect.Loop = player.Loop;
  cReflect.Frame = player.Frame;
}


This code can go directly in that room's script. You can quite easily use a dynamic sprite instead, of course, but if you've got this already set up then this seems the easiest way to me.


Herooftime1000

BRILLIANT! I never thought to think outside the box like that. It works perfectly! I'm going to have to do some further tweaking to accomodate for the multiple speech views the character has, but this put me on the right track!

ThreeOhFour, you are officially on the credits list. Thank you SO much for this insight.

ThreeOhFour

#6
Glad I could help. :smiley:

It shouldn't be too hard to add support for multiple speaking views, you can check it with player.SpeechView and work from there.

Also, I just realized this may be happening in multiple rooms. If so, you can use this code in the globalscript instead, without having to change anything.

SMF spam blocked by CleanTalk