<?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=Making_a_Sprite_Follow_the_Mouse</id>
	<title>Making a Sprite Follow the Mouse - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Making_a_Sprite_Follow_the_Mouse"/>
	<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Making_a_Sprite_Follow_the_Mouse&amp;action=history"/>
	<updated>2026-06-18T01:28:14Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Making_a_Sprite_Follow_the_Mouse&amp;diff=1626&amp;oldid=prev</id>
		<title>Patarakin: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Making_a_Sprite_Follow_the_Mouse&amp;diff=1626&amp;oldid=prev"/>
		<updated>2022-07-21T08:33:12Z</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;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;2&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;4&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;!-- diff cache key digida:diff:1.41:old-1625:rev-1626 --&gt;
&lt;/table&gt;</summary>
		<author><name>Patarakin</name></author>
	</entry>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Making_a_Sprite_Follow_the_Mouse&amp;diff=1625&amp;oldid=prev</id>
		<title>scratch&gt;Wangat: /* Following the Mouse if a Boolean is True */ capitalization</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Making_a_Sprite_Follow_the_Mouse&amp;diff=1625&amp;oldid=prev"/>
		<updated>2022-02-06T14:03:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Following the Mouse if a Boolean is True: &lt;/span&gt; capitalization&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[File:Follow Mouse.png|thumb|176px|A sprite following the mouse.]]&lt;br /&gt;
This tutorial will explain how to &amp;#039;&amp;#039;&amp;#039;make a sprite&amp;#039;&amp;#039;&amp;#039; always be where the [[mouse]] is, &amp;#039;&amp;#039;&amp;#039;follow the mouse&amp;#039;&amp;#039;&amp;#039; indefinitely, if a button is pressed, if the mouse is too close to the sprite, or have the sprite follow at a distance.&lt;br /&gt;
&lt;br /&gt;
{{tip|These [[script]]s can make sprites follow other [[sprite]]s, not just the mouse.}}&lt;br /&gt;
&lt;br /&gt;
== Always Going to the Mouse ==&lt;br /&gt;
&lt;br /&gt;
This script makes a sprite always be at the location of the mouse:&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 (mouse-pointer v)&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[Draggable Sprite Feature]] can also be used, but this requires the user to click.&lt;br /&gt;
&lt;br /&gt;
== Following the Mouse Indefinitely ==&lt;br /&gt;
This script will make the [[sprite]] follow the mouse, but if one moves the mouse fast enough the sprite will lag behind some.&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;
  point towards (mouse-pointer v)&lt;br /&gt;
  move (10) steps&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, the following script can be used:&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;
glide (0.1) secs to x: (mouse x) y: (mouse y)&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This gives the object following the mouse a bit more of a velocity.&lt;br /&gt;
&lt;br /&gt;
== Following the Mouse if a Boolean is True ==&lt;br /&gt;
This script makes a sprite follow the mouse if the [[Boolean Block|Boolean]] is &amp;#039;&amp;#039;&amp;#039;true&amp;#039;&amp;#039;&amp;#039;.&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;
  if &amp;lt;...::grey&amp;gt; then&lt;br /&gt;
  point towards (mouse-pointer v)&lt;br /&gt;
  move (10) steps&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Following the Mouse if a Sprite Comes Close Enough ==&lt;br /&gt;
This script will make the sprite follow the mouse, but only if the mouse-pointer comes within a certain distance of the sprite.&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;
  if &amp;lt;(distance to (mouse-pointer v)) &amp;lt; [100]&amp;gt; then&lt;br /&gt;
  point towards (mouse-pointer v)&lt;br /&gt;
  move (10) steps&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Following the Mouse at a Distance ==&lt;br /&gt;
This script will make the sprite follow the mouse indefinitely, but will never come to touch the mouse. One thing to notice about the script is that there is that there is a cushion zone. If the distance is between 50 and 70 then nothing will happen. This is designed so that the sprite will not jump or bounce erratically.&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;
  point towards (mouse-pointer v)&lt;br /&gt;
  if &amp;lt;(distance to (mouse-pointer v)) &amp;lt; [50]&amp;gt; then&lt;br /&gt;
    move (-10) steps&lt;br /&gt;
  end&lt;br /&gt;
  if &amp;lt;(distance to (mouse-pointer v)) &amp;gt; [70]&amp;gt; then&lt;br /&gt;
    move (10) steps&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Following the Mouse Quicker as the Mouse Moves Away ==&lt;br /&gt;
This script will make the sprite follow the mouse indefinitely. As the mouse gets farther away from the sprite, the sprite will speed up until it gets closer again, and then slow down again.&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;
  point towards (mouse-pointer v)&lt;br /&gt;
  move ((distance to (mouse-pointer v)) / (12)) steps&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note|The number 12 can be increased to make the sprite follow more slowly, or decreased to make the sprite faster.}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;br /&gt;
[[ja:マウスを追いかけるスプライト]]&lt;/div&gt;</summary>
		<author><name>scratch&gt;Wangat</name></author>
	</entry>
</feed>