Hello!
In the game, I have several
panoramic views where the cursor can
scroll left/right.
I have created an inteface with left and right arrows to show the player that it is possible to scroll in these scenes.
I would like to hide the left arrow when the left border is reached. Then, when the player scrolls to the right, it should show the left arrow again if it was hidden already (and same on the right).
The left (and right) arrow has a condition true/false to display it. The arrows are in an interface, because they should not move on the screen. In the scene of the panorama, I have created a script that looks for the cursor position (see below). The scene is 4000 pixels large, so at 0 px the left arrow should be hidden and at 4000 px the right arrow should be hidden.
The game resolution is 1920 px large, so when the x cursor position is over 1920 px, it should show the left arrow again (in case it was hidden after reaching the very left border).
-- left part
-- acquire left cursor position
local posleft = getCursorPos()
-- hide left cursor if left screen border reached
if posleft.x < 5
then
local cond = getObject("Conditions[Show_Left_Arrow?]")
cond:setValue(VConditionValue, false)
end
-- show left arrow if cursor scrolls to the right
if posleft.x > 1920
then
local cond = getObject("Conditions[Show_Left_Arrow?]")
cond:setValue(VConditionValue, true)
end
-- right part
-- acquire right cursor position
local posright = getCursorPos()
-- hide right cursor if right screen border reached
if posright.x > 3995
then
local cond = getObject("Conditions[Show_Right_Arrow?]")
cond:setValue(VConditionValue, false)
end
-- show right arrow if cursor scrolls to the left
if posright.x < 2080
then
local cond = getObject("Conditions[Show_Right_Arrow?]")
cond:setValue(VConditionValue, true)
end
However this code doesn't work, the arrows in the interface never hide.
I forgot to say that this script is called at the beginning of the scene, then there is a Jump to #1 in order to make it loop. And at the end of the scene, the loop is stopped.
Help! \o/