<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Mouse_Scrolling</id>
	<title>Mouse Scrolling - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Mouse_Scrolling"/>
	<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Mouse_Scrolling&amp;action=history"/>
	<updated>2026-04-21T09:37:38Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Mouse_Scrolling&amp;diff=1834&amp;oldid=prev</id>
		<title>Patarakin: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Mouse_Scrolling&amp;diff=1834&amp;oldid=prev"/>
		<updated>2022-07-21T08:33:17Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 11:33, 21 июля 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Patarakin</name></author>
	</entry>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Mouse_Scrolling&amp;diff=1833&amp;oldid=prev</id>
		<title>scratch&gt;Jvvg в 21:34, 6 июня 2022</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Mouse_Scrolling&amp;diff=1833&amp;oldid=prev"/>
		<updated>2022-06-06T21:34:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Mouse scrolling&amp;#039;&amp;#039;&amp;#039; is a form of [[scrolling]], but can be simpler due to there being less code required than regular scrolling.&lt;br /&gt;
&lt;br /&gt;
==Mouse Scrolling Engine==&lt;br /&gt;
===Setting Up===&lt;br /&gt;
To set up the project with the ability to scroll using only a mouse pointer, two [[sprite]]s, and four [[variable]]s are needed. The four variables required are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sb&amp;gt;(x)&amp;lt;/sb&amp;gt;&lt;br /&gt;
* &amp;lt;sb&amp;gt;(y)&amp;lt;/sb&amp;gt;&lt;br /&gt;
* &amp;lt;sb&amp;gt;(pos x)&amp;lt;/sb&amp;gt;&lt;br /&gt;
* &amp;lt;sb&amp;gt;(pos y)&amp;lt;/sb&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After creating these variables, the two sprites need to be created. The map and the character. The map can be made of any size. If the map sprite cannot get very large, please refer to [[Overriding the Costume Size Limit|this]] to learn how to bypass the size limit.&lt;br /&gt;
&lt;br /&gt;
==Coding==&lt;br /&gt;
===Coding the Map===&lt;br /&gt;
For coding the map of the project, the following code is needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
define update map&lt;br /&gt;
set [pos x v] to (((x) - ((x) * [2])) / (10)&lt;br /&gt;
set [pos y v] to (((y) - ((y) * [2])) / (10)&lt;br /&gt;
&lt;br /&gt;
when green flag clicked&lt;br /&gt;
forever&lt;br /&gt;
update map&lt;br /&gt;
go to x: (pos x) y: (pos y)&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Coding the Player===&lt;br /&gt;
The scripts are as shown:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when green flag clicked&lt;br /&gt;
set [x v] to (0)&lt;br /&gt;
set [y v] to (0)&lt;br /&gt;
forever&lt;br /&gt;
movement//defined later&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
define movement&lt;br /&gt;
point towards (mouse-pointer v)&lt;br /&gt;
change [x v] by ((mouse x)/ (3)&lt;br /&gt;
change [y v] by ((mouse y)/ (3)&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding Objects To Scrolling Games==&lt;br /&gt;
Sometimes in a scrolling game, interactive objects are added. The &amp;lt;sb&amp;gt;go to x: () y: ()&amp;lt;/sb&amp;gt; block can be used but the object(s) will just stay right on the screen. Here are a couple different methods on how to put objects in a set location on a scrolling game:&lt;br /&gt;
&lt;br /&gt;
===A Singular Object===&lt;br /&gt;
In order to have a single object stay in place on a scrolling game, a certain code is needed to that the object will not stick to a set location on the screen. First, only 2 local variables are needed:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;sb&amp;gt;(x)&amp;lt;/sb&amp;gt;&lt;br /&gt;
* &amp;lt;sb&amp;gt;(y)&amp;lt;/sb&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have those required variables, all you need to do now is give the object the code that will make it stay in one location (not on the screen) and will give it the ability to go on and off the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when green flag clicked&lt;br /&gt;
forever&lt;br /&gt;
go to x:((x) - (pos x)) y:((y) - (pos y))&lt;br /&gt;
	if &amp;lt;&amp;lt;((x) - (pos x)) = (x position)&amp;gt; and&amp;lt;((y) - (pos y)) = (y position)&amp;gt;&amp;gt; then&lt;br /&gt;
	show&lt;br /&gt;
	else&lt;br /&gt;
	hide&lt;br /&gt;
	end&lt;br /&gt;
	...//anything else can go here or just start another line of code somewhere else&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cloning The Same Object===&lt;br /&gt;
The other way to add multiple objects to a project is by cloning them. For this sprite, the x and y variable are needed.&lt;br /&gt;
&lt;br /&gt;
A custom block is the preferred method for cloning the sprite to prevent errors in the coding:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
define clone at (x) (y)//run without screen refresh&lt;br /&gt;
set [x v] to (x)&lt;br /&gt;
set [y v] to (y)&lt;br /&gt;
create clone of (myself v)&lt;br /&gt;
&lt;br /&gt;
when green flag clicked&lt;br /&gt;
clone at () ()//change these two labels to the clone coordinates&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then for the positioning for the clones objects, it is the same thing as the singular object except replace the &amp;lt;sb&amp;gt;when gf clicked&amp;lt;/sb&amp;gt; with &amp;lt;sb&amp;gt;when I start as a clone&amp;lt;/sb&amp;gt; [[Hat Blocks|hat block]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when I start as a clone&lt;br /&gt;
forever&lt;br /&gt;
go to x:((x) - (pos x)) y:((y) - (pos y))&lt;br /&gt;
	if &amp;lt;&amp;lt;((x) - (pos x)) = (x position)&amp;gt; and&amp;lt;((y) - (pos y)) = (y position)&amp;gt;&amp;gt; then&lt;br /&gt;
	show&lt;br /&gt;
	else&lt;br /&gt;
	hide&lt;br /&gt;
	end&lt;br /&gt;
	...//anything else can go here or just start another line of code somewhere else&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example Projects==&lt;br /&gt;
* [[projects:474147261|Rhinoland MASSIVE UPDATE]]&lt;br /&gt;
* [[projects:476063959|mouse scroller engine]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Project Types]]&lt;br /&gt;
[[Category:Scripting Tutorials|Mouse Scrolling]]&lt;/div&gt;</summary>
		<author><name>scratch&gt;Jvvg</name></author>
	</entry>
</feed>