(Solved) Keep Verb Coin in position during smooth scrolling background

Started by Le Woltaire, Wed 30/10/2013 20:37:56

Previous topic - Next topic

Le Woltaire

My verb coin moves when the background is scrolling.
This causes that sometimes while the background is scrolling a hotspot doesn't react because the voin has moved forward...
How can I keep it exactly in position over the hotspot even though the background is scrolling?



Khris

When the verb coin is displayed, store the Viewport coordinates.
In repeatedly_execute always, whenever the viewport changes, adjust the GUI's position.
Example: Current viewport x is now last frame's viewport x + 3 => substract 3 from GUI's x.

Afaik a GUI can't move completely off screen, so you have to add a check for that.

Le Woltaire

ok that worked thanks you.
Is there a similar way to parallely leave the mouse cursor into the same
position during scrolling without permanently hanging it up?



Ali

An alternative is to leave the verbcoin where it is, but work calculate the co-ordinates of the original click based on the change in room offset.

I think that could be preferable, because you might not want the verbcoin moving underneath the mouse. It could result in the player choosing the wrong option by accident.

Le Woltaire

i didn't get the last point.

by offset do you mean manipulate the variables in the smooth scroll module?

perfect would be to fix mouse cursor and coin together leave them in position for about a quarter second until scrolling is over and then
leave the choice to the player where to go...



Ali

Sorry if I wasn't clear. I think it would be a bit weird for the game to move the mouse pointer. It's the kind of thing that could irritate or confuse a player.

When I used a verbcoin with my module, I modified the verbcoin script to take note of the ViewportX/Y at the point of opening the verbcoin. Then take note of the Viewport X/Y at the point of executing the command, to calculate how much the screen has scrolled in that time. Then use that offset to calculate where the click ought to be processed.

Le Woltaire

Ok, I came to the same conclusion before.
But in my case it doesn't work or I did something wrong...

Script for a process command for verbcoin look action is:

Code: ags

ProcessClick(mausx + (viewportx - GetViewportX()), mausy + (viewporty - GetViewportY()), eModeLookat);


Where mausx and mausy are the stored xy coordinates right before verbcoin opened
while viewportxy are the stored viewports while coin opened.




Le Woltaire

Thank you I solved the issue yesterday night.

There was an integer on right click event that caused a delay of 8 time loops on right click events.

int right_click = WaitMouseKey(8)*IsButtonDown(RIGHT);

This caused a delay in the scrolling reaction and the storage of all variables.
I removed this integer now since it was never used again.
I hope it didn't have any importance...

It now seems to work pretty good and even all right clicks are a tick faster!



SMF spam blocked by CleanTalk