Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Wed 22/11/2017 03:59:38

Title: SOLVED: Dialog box problem. Character appear x position
Post by: Slasher on Wed 22/11/2017 03:59:38
Hi,

I have a room 640 x 200 in a 320 x 200 res game.

I have a added a dialog options when the main character talks to a npc which is placed at 410 x.
Code (ags) Select

function cTingwell_Talk()
{
  cCadfael.Walk(cTingwell.x-30,  cTingwell.y+2, eBlock, eWalkableAreas);
  cCadfael.Loop=2;
  cTingwellP.x =cTingwellP.x  +GetViewportX(); // character head at the top of the screen that talks
  cCadfaelP.x =cCadfaelP.x +GetViewportX();    // main character head at the top of the screen that talks
  dTingwell1.Start();
}


When the dialogs are open i can select a return option and all is fine. However, when i stop the dialogs and again talk to the npc the position of the talking heads do not remain in their X position. The main character x appears further than center of screen whilst you do not see the npc's head...

ags 3.4.0.14
320 x 200
32 bit color
3d 9
Custom dialog gui at bottom of screen..

Title: Re: Dialog box problem. Character appear x position
Post by: Khris on Wed 22/11/2017 08:06:36
That function will increase the x coordinates of both characters by the current GetViewportX() whenever it is called.
Which means talking to Tingwell repeatedly will move the portrait characters further and further to the right.

What you want is something like
  cTingwellP.x = 40 + GetViewportX();
  cCadfaelP.x = 280 + GetViewportX();


where 40 and 280 are the screen coordinates of where you want them to appear.
Title: SOLVED: Dialog box problem. Character appear x position
Post by: Slasher on Wed 22/11/2017 10:21:56
Thank you for your reminder Khris...(nod)

All up and working...

cheers....