SOLVED: Dialog box problem. Character appear x position

Started by Slasher, Wed 22/11/2017 03:59:38

Previous topic - Next topic

Slasher

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

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..


Khris

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
Code: ags
  cTingwellP.x = 40 + GetViewportX();
  cCadfaelP.x = 280 + GetViewportX();


where 40 and 280 are the screen coordinates of where you want them to appear.

Slasher

Thank you for your reminder Khris...(nod)

All up and working...

cheers....

SMF spam blocked by CleanTalk