Is there any way that, whenever a scene is entered, a hotspot will randomly change its position? (x, or y or both)
And that it was kept in a margin of positions x, y predetermined?
Random hotspot
-
-
Of course. There is an action for this random
Only it should be ath, atv -
Here is an example, in onstart, define the limits for x and y
Code
Display More<action name="startup" autorun="onstart"> ... set(Xmax,500); set(Xmin,200); set(Ymax,500); set(Ymin,200); </action> <scene name="scene_1" onstart="delayedcall(0.1,test());" ... <hotspot name="spot" type="text" width="20.00" height="20.00" edge="center" bgcolor="0xFF0000" bgalpha="1" bgroundedge="10 10 10 10" /> <action name="test" > mul(valX, random, Xmax); if(valX LE Xmin, test(); , mul(valY, random, Ymax); if(valY LE Ymin,test(); , screentosphere(valX,valY, toh, tov); set(hotspot[spot].ath, get(toh)); set(hotspot[spot].atv, get(tov)); ); ); </action> </scene>
-
Or such an option
Code
Display More<scene name="scene_1" onstart="delayedcall(0.1,test(500,50,100,50));" ... <hotspot name="spot" type="text" width="20.00" height="20.00" bgcolor="0xFF0000" /> <!-- test(X max,X min,Y max,Y min); --> <action name="test" scope="localonly" args="Xmax, Xmin, Ymax, Ymin"> mul(valX, global.random, get(Xmax)); mul(valY, global.random, get(Ymax)); if(valX LE Xmin, test(get(Xmax), get(Xmin), get(Ymax), get(Ymin)); , if(valY LE Ymin, test(get(Xmax), get(Xmin), get(Ymax), get(Ymin)); , screentosphere(valX,valY, global.hotspot[spot].ath, global.hotspot[spot].atv); ); ); </action>
-
Thank you.
The first option does work for me, but I don't understand the maximum or minimum values, if they are around the initial position of the hotspot and in which units they are expressed in the startup.
The second option doesn't work for me. You may not have understood correctly -
Thanks Sergey.
The problem is that I don't know how to incorporate this into a hotspot of the type: <hotspot name = "detail1038" handcursor = "true" distorted = "true" onclick = ""
url = "imag_escape / detail1038.jpg" scale = "0.1" ath = "0"
atv = "0" /> -
And that it was kept in a margin of positions x, y predetermined?
These are your set conditions, which means a rectangular area of screen coordinates, within which a hot spot should be located. And this rectangle is described by the maximum and minimum values of x and y
The first option does work for me, but I don't understand the maximum or minimum values, if they are around the initial position of the hotspot and in which units they are expressed in the startup.
The second option doesn't work for me. You may not have understood correctlyI checked both options before posting - both workers. Hotspot changes its position each time it enters the scene within the described area in screen coordinates.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!