Hello
I have created an entity which is essentially a thought bubble. It derives it's coordinates from the actors position on the screen.
Now it works well in the foreground, and appears in the correct position, however in the background it appears to at the below the actor, even though looking at the thing in the debugger the entities X and Y values seems to be correct.
Can anyone suggest the probably blatantly obvious mistake that I made. One thought is that it might be caused by the floor
Please see the code for the method below.
method thought(texti,soundfile)
{
Game.Interactive = false;
actor.Interactive = false;
var thinking = Scene.CreateEntity();
thinking.Scalable=false;
var actorscale = Scene.GetScaleAt(actor.X,actor.Y);
if (actor.X > (Game.ScreenWidth/2))
{ thinking.X = actor.X-200;
thinking.SetSprite("interface\thought\thoughtright.png");
if(actor.Direction==DI_LEFT)thinking.X = thinking.X -30;
}
else
{ thinking.X = actor.X+25;
if(actor.Direction==DI_LEFT)thinking.X = thinking.X -30;
thinking.SetSprite("interface\thought\thoughtleft.png");
}
if ((actorscale >40) && (actorscale < 60))
{
thinking.Y = actor.Y - 100;
}
if ((actorscale >59) && (actorscale < 70))
{
thinking.Y = actor.Y - 150;
}
if ((actorscale >69) && (actorscale < 80))
{thinking.Y = actor.Y - 380;
}
if ((actorscale >79) && (actorscale < 90))
{thinking.Y = actor.Y - 400;
}
if ((actorscale > 89) && (actorscale <95))
{thinking.Y = actor.Y - 430;
}
if (actorscale >94)
{
thinking.Y = actor.Y - 450;
}
var ypos;
var textlen = new String(texti);
if(textlen.Length < 20) ypos = 80;
if((textlen.Length > 19) && (textlen.Length < 40)) ypos = 85;
if(textlen.Length >39) ypos = 95;
thinking.SetFont("fonts\admono12.font");
thinking.SubtitlesPosRelative;
thinking.SubtitlesWidth=100;
thinking.SubtitlesPosXCenter=true;
thinking.SubtitlesPosX=90;
thinking.SubtitlesPosY =ypos;
thinking.Talk(texti,soundfile);
while(thinking.IsTalking==true);
{
Game.Interactive=false;
Sleep(20);
}
Game.UnloadObject(thinking);
Game.Interactive = true;
actor.Interactive= true;
}
Just an additional thought, might this work better as a window than an entity. Switched it to an entity in a container in a window, this works, although it might just have been my imbecilic maths that was faulty.