Interaction with an image, an idea I can't carry out

Started by Chomba, Fri 13/11/2020 09:16:29

Previous topic - Next topic

Chomba

Hello again,

I was thinking about an idea a few days ago, but I couldn't get the desired effect.

Here's the thing:

I have my character in a room, and when he interacts with an object he gets close to it and bends down to observe it.

Then an image that I separated into two different objects appears (one for the background and another for the interactive part of the image: the hand of the dead man).

(once the correct interaction is done it will not vary or anything in the image, it will only activate the option to pick up the gun outside the image that will not appear again)


So far so good. The character comes walking up, I have the animation where he bends down, the image appears and I can even use objects with my hand. The problem is that if I click somewhere else the character keeps moving (obviously with the lockview on). And what I want is that it does not move until I interact with another button (which I will do) to exit the image.

I tried to use *Stopmoving but it didn't do the trick.

Khris

In general, closeups usually put something transparent in the background that catches room clicks.
There's a bunch of other possible approaches:
1) limit the mouse to the close-up area
2) use a separate room for the close-up
3) catch these clicks by adding this to your room script:

Code: ags
function on_mouse_click(MouseButton button) {
  if (oCloseUp.Visible) {
    if (mouse.Mode == eModeWalkto) ClaimEvent();
    if (mouse.Mode == eModeInteract && Object.GetAtScreenXY(mouse.x, mouse.y) != oHand) ClaimEvent();
  }
}

ClaimEvent();  tells AGS to not process the click any further.

Chomba

Thanks again, Khris,

The second room was my way to go if I didn't get any answers. But I knew there had to be another way.

I'll go with the first option this time, but I'll save the script for later!

Again, thank you very much! Almost everything I'm learning about AGS beyond the basics was thanks to these forums and the people who vouch for these places!

Edit to avoid another post:
I did the transparency thing and it worked fine, at first it didn´t until I noticed that the object has to be on "Clickable" mode :P

SMF spam blocked by CleanTalk