Problem with interact on hotspot

Started by theoneelectronic, Fri 13/09/2013 11:37:04

Previous topic - Next topic

theoneelectronic

Hello to everybody.
I have an annoying problem with a simple interaction with a hotspot.
As you can see my game hasn't good graphics. Please don't be though on me. I'm currently making a game for my little kid using his own drawing as setting.


https://docs.google.com/file/d/0B74cisQ-2QTOQmwtRXhqc0xOS00/edit?usp=sharing

By the way, as you can see from the attachments, I created a hotspot along the stairs. What I wanto to do is that when the chatacter clicks on the hotspot it walks automatically atop the stairs.
For that I tried both the following functions but neither of them work.

Code: ags

function R2StairsTransition_Interact()
{
player.Walk(351, 226, eBlock);
}


Code: ags

function R2StairsTransition_AnyClick()
{
player.Walk(351, 226, eBlock);
}


Previously I had used the _Interact() function on an object with the same intent and, in this case, it worked flawlessly.
Thank you in advance for your help.
Cheers.

Khris

Did you also draw a walkable area leading up there? Because unless you add the eAnywhere parameter to your player.Walk() call, the character won't leave walkable areas.

Also, what I would do is draw a thick straight line instead of the zigzag one, both for the hotspot and the walkable area.

In case your problem is that the game simply doesn't react to the interact with stairs click, have you properly linked the function to the event (as opposed to writing function R2StairsTransition_Interact() yourself)?

theoneelectronic

Hi Khris,
I indeed created a walkable area which works perfectly fine.
Why would you draw a straigth line? How would you create the effect of walking on the steps in this case?
For the code part I'd probably either done something weird or I miss some other steps in plain light.
In any case I include another image showing the event part.

https://docs.google.com/file/d/0B74cisQ-2QTOQWc3dEo5QlFnaFk/edit?usp=sharing

And here below all the code pertaining to that room at the moment.

Code: ags

// room script file

function R2StairsTransition_Interact()
{
player.Walk(351, 226, eBlock);
}

function R2TransitionLeft_WalkOn()
{
SetNextScreenTransition(eTransitionFade);  
cChar1.ChangeRoom(1, 774, 570);
}


Thank you for your support.

Khris

First, try adding Display("works"); to your Interact() function to make sure it is actually called.
Are you using some kind of "mouse is over active area" indicator? Because maybe you're simply missing the hotspot when clicking.
That's why I suggested to make the area bigger.
The walkable area, too, because leaving it like that will make the character walk right, then up, then right, then up, which won't look like climbing stairs anyway.

So what actually happens when you interact with the stair hotspot? All I know is that there's a problem, but you never said what does or doesn't happen.

theoneelectronic

Khris,
I added the method Display() and when I click on the hotspot area it shows "works".
What it happens when I interact with the hotspot is nothing. It's like I'd click on the background.

Khris

So it looks like the .Walk command is called but has no effect.
Can you walk up the stairs when you click at their top with the walk cursor?

theoneelectronic

Khris,
despite the walkable area isn't very big, as you also noticed, the walk command with the walk cursor works fine, with the character hiking up the stairs as he's meant to do.

theoneelectronic

It seems that I solved the problem.
I didn't do anything special except adding more walkable area around the stairs and setting the Walk to Point property of the hotspot.
I don't know if this latter did the trick or what.
However I've noticed that the cursor clicks are extremely precise and it's somethimes difficult to point to small areas or objects. I suppose this has also to do with the cursor shape. I'm using the default Sierra style interface. I've yet to figure out which part of the cursor is the sensitive one: center, top...

Stupot

Did you know you can set which part of any cursor is the responsive pixel.
Forgive me if you already know this but:
In the Editor, simply click on the 'Mouse Cursors' branch on the project tree, then select the cursor you want.  You will see a little blue cross-hair somewhere in the image of the cursor.  This shows the exact part of the cursor that interacts with the game, and it can be set to any part of the cursor image.  (For example, on the 'hand' cursor I always move the cross-hair to the tip of the index finger).
MAGGIES 2024
Voting is over  |  Play the games

theoneelectronic

Stupot+ Thank you very much for your hint.
I'm currently a complete noob learning my chore by following the tutorial and experimenting trying make something on my own.
I didn't know about the cursor responsive part yet. I changed some of them and now the interaction is much better for me. The look cursor was especially annoying.
Thanks again!
Cheers

SMF spam blocked by CleanTalk