Hey people.
I'm having trouble with clicking on some hotspots. Here's the code I'm using...
Code: ags
Now, the problem is on the screens where cCharacter is in the same room as cEgo.
Most of the time it works as it should, but sometimes the character just walks over to the hotspot and it doesn't process the click afterwards. I've also got rep_exec telling the cursor to change its graphic when over a hotspot, so I know the game knows there's a hotspot there, it just sometimes chooses to ignore it. Furthermore, from what I can tell, the closer the mouse is to the centre of the hotspot, the more likely it is to not register.
Any ideas on why this is happening and maybe how to stop it?
Thanks in advance.
I'm having trouble with clicking on some hotspots. Here's the code I'm using...
function on_mouse_click(MouseButton button)
{
if (IsGamePaused()==1) { }
else if (gInventory.Visible==true && GUI.GetAtScreenXY(mouse.x, mouse.y)==null) {gInventory.Visible=false;}
else if (button==eMouseLeft) {
if (cCharacter.Room==cEgo.Room && GUIControl.GetAtScreenXY(mouse.x, mouse.y)==null) {
cCharacter.Walk(mouse.x, mouse.y, eBlock, eWalkableAreas);
cCharacter.FaceLocation(mouse.x, cCharacter.y, eNoBlock);
}
ProcessClick(mouse.x, mouse.y, eModeInteract);
}
<snipped>
}
Now, the problem is on the screens where cCharacter is in the same room as cEgo.
Most of the time it works as it should, but sometimes the character just walks over to the hotspot and it doesn't process the click afterwards. I've also got rep_exec telling the cursor to change its graphic when over a hotspot, so I know the game knows there's a hotspot there, it just sometimes chooses to ignore it. Furthermore, from what I can tell, the closer the mouse is to the centre of the hotspot, the more likely it is to not register.
Any ideas on why this is happening and maybe how to stop it?
Thanks in advance.