Hello, everyone starts their post this way, but I cannot find a solution to my problem in the manual and the forums (I've searched both).
TLDR: how do I interact with "popover" objects after the cEgo.LockView is called and before the cEgo.UnlockView is called?
I have a sprite, which is the inside of a wastebasket. Additionally, there is a wastebasket hotspot in the room. Here is the game logic:
- player interacts with the wastebasket hotspot
- the interact with event is fired
- the character walks to the wastebasket
- the character bends down
- while the character is still bent, the inside of the wastebasket object becomes visible and remains until the player interacts with the inside of the wastebasket object
- the interact with event is fired for the inside of the wastebasket object
- the character stands up
- the player resumes normal control of the character
My issue is after calling cEgo.LockView(), the cursor becomes "disabled" along with the nav bar. While cEgo is locked, how to allow the cursor to be usable.
The following is my attempt at the problem:
Code: ags
TLDR: how do I interact with "popover" objects after the cEgo.LockView is called and before the cEgo.UnlockView is called?
I have a sprite, which is the inside of a wastebasket. Additionally, there is a wastebasket hotspot in the room. Here is the game logic:
- player interacts with the wastebasket hotspot
- the interact with event is fired
- the character walks to the wastebasket
- the character bends down
- while the character is still bent, the inside of the wastebasket object becomes visible and remains until the player interacts with the inside of the wastebasket object
- the interact with event is fired for the inside of the wastebasket object
- the character stands up
- the player resumes normal control of the character
My issue is after calling cEgo.LockView(), the cursor becomes "disabled" along with the nav bar. While cEgo is locked, how to allow the cursor to be usable.
The following is my attempt at the problem:
bool wastebasketClicked = false;
function wastebasket_Interact(Hotspot *theHotspot, CursorMode mode)
{
int destX = 57;
int destY = 148;
cEgo.Walk(destX, destY, eBlock);
cEgo.LockView(CLARA_MAIN_CABIN);
cEgo.x = 49;
cEgo.y = 147;
cEgo.Animate(0, 5, eOnce, eBlock);
oInsideWasteBasket.Visible = true;
wastebasketClicked = false;
// this is my attempt, but the cursor remains disabled from the LockView function call
mouse.EnableMode(eModeInteract);
mouse.Mode = eModeInteract;
while (!wastebasketClicked) {
Wait(1);
}
oInsideWasteBasket.Visible = false;
cEgo.Animate(1, 5, eOnce, eBlock);
cEgo.x = destX;
cEgo.y = destY;
cEgo.UnlockView();
}
function oInsideWasteBasket_Interact(Object *theObject, CursorMode mode)
{
wastebasketClicked = true; // Set the flag to allow the script to proceed
Display("You see something inside the wastebasket.");
// Optionally, hide the object again after the click
oInsideWasteBasket.Visible = false;
}