https://wiki.bennugd.org/index.php?title=Move_scroll&feed=atom&action=historyMove scroll - Revision history2024-03-29T10:07:23ZRevision history for this page on the wikiMediaWiki 1.36.2https://wiki.bennugd.org/index.php?title=Move_scroll&diff=10557&oldid=prev188.106.184.91 at 10:57, 17 July 20122012-07-17T10:57:33Z<p></p>
<p><b>New page</b></p><div>[[Category:functions]]<br />
[[Category:scrolls]]<br />
[[Category:mod_scroll]]<br />
<br />
==Definition==<br />
'''INT''' Move_scroll ( <'''INT''' scrollnumber>)<br />
<br />
The move_scroll function is a slighty more advanced function. It allow the scroll's internal coordinates x0, y0, x1 and y1 of the [[scroll|scroll structure]] to be updated in a forcefull way. This gives great flexibility when multiple [[scroll window]]s are used.<br />
<br />
For instance, in a situation where multiple scroll windows are active on screen, and one scroll is controlled by the main player, the other scrolls can be updated manually. However, the function can also be usefull when there's only one scroll active. In that case you can have any process take control over the scroll.<br />
<br />
Also called [[scroll_move]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' scrollnumber || - The ID for the scroll window to be moved<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
<br />
== Example ==<br />
<br />
<br />
<pre><br />
<br />
IMPORT "mod_video";<br />
IMPORT "mod_map";<br />
IMPORT "mod_scroll";<br />
IMPORT "mod_screen";<br />
IMPORT "mod_key";<br />
IMPORT "mod_proc";<br />
<br />
GLOBAL<br />
<br />
int graphics;<br />
int counter;<br />
<br />
PRIVATE<br />
<br />
<br />
<br />
PROCESS main();<br />
<br />
<br />
BEGIN<br />
set_fps(100, 0);<br />
graphics=load_fpg("help.fpg");<br />
start_scroll(0, graphics, 103, 102, 0, 15);<br />
<br />
scroll.camera=id; // assign the "main" process instance (this one) to the scroll's camera.<br />
priority=100;<br />
<br />
FROM counter=-2000 TO 2000 step 100;<br />
movable_process(counter);<br />
END<br />
<br />
say("Use the right and left cursors to move");<br />
<br />
graph=101;<br />
ctype=c_scroll;<br />
<br />
<br />
LOOP<br />
if (key(_right))<br />
x+=2;<br />
flags=0;<br />
END<br />
if (key(_left))<br />
x-=2;<br />
flags=1;<br />
END<br />
<br />
move_scroll(0); // Updates the scroll structure[], in this case affect scroll 0.<br />
<br />
FRAME;<br />
END<br />
END<br />
<br />
PROCESS movable_process(x_scroll);<br />
<br />
PRIVATE<br />
<br />
BEGIN<br />
ctype=c_scroll;<br />
z=100;<br />
graph=104;<br />
LOOP<br />
x=x_scroll-scroll.x0; <br />
FRAME;<br />
END<br />
END<br />
</pre><br />
<br />
<br />
== Using Scrolling ==<br />
For each [[process]] that you want to be part of a [[scroll window]], you must set the [[local variable]] [[ctype]] to value [[C_SCROLL]]. It should also be noted that the local variable [[c_number]] is used for selecting in which scroll a process should be displayed. Additionally, you must set the camera property of the [[scroll|scroll structure]] to the [[processID]] of the process you wish to be followed.</div>188.106.184.91