<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Duck+Mim</id>
	<title>MiniScript Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Duck+Mim"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/wiki/Special:Contributions/Duck_Mim"/>
	<updated>2026-05-13T09:13:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1391</id>
		<title>MathUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1391"/>
		<updated>2025-04-04T20:29:05Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: degToRad(&amp;quot;radians&amp;quot;) ----&amp;gt; degToRad(''degrees'')&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional math-related functions and constants.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mathUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mathUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constant ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| mathUtil.e || [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's number], roughly 2.718; base of natural logarithms&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are normally accessed via the &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; prefix, e.g. &amp;lt;c&amp;gt;mathUtil.radToDeg(pi)&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| ln(''x'') || natural logarithm of ''x''&lt;br /&gt;
|-&lt;br /&gt;
| radToDeg(''radians'') || converts ''radians'' into degrees&lt;br /&gt;
|-&lt;br /&gt;
| degToRad(''degrees'') || converts ''degrees'' into radians&lt;br /&gt;
|-&lt;br /&gt;
| moveTowards(''num'', ''targetNum'', ''maxChange''=1) || returns a value closer to ''targetNum'' from ''num'', differing from ''num'' by no more than ''maxChange'')&lt;br /&gt;
|-&lt;br /&gt;
| moveTowardsXY(''mover'', ''target'', ''maxDist''=1) || like &amp;lt;c&amp;gt;moveTowards&amp;lt;/c&amp;gt;, but mutates map ''mover'' to approach ''target'', each with ''x'' and ''y'' properties (e.g., a [[Sprite]])&lt;br /&gt;
|-&lt;br /&gt;
| distance(''p1'', ''p2'') || find the distance between two points; each may be a map containing ''x'' and ''y', or an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| lerp(''a'', ''b'', ''t'') || returns a value some portion ''t'' of the way from ''a'' to ''b''&lt;br /&gt;
|-&lt;br /&gt;
| lerp2d(''p1'', ''p2'', ''t'') || same as &amp;lt;c&amp;gt;lerp&amp;lt;/c&amp;gt;, but on 2d points (maps or lists)&lt;br /&gt;
|-&lt;br /&gt;
| proportionAlongLine(''endA'', ''endB'', ''p'') || returns how far ''p'' is along the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLine(''endA'', ''endB'', ''p'') || returns closest point to ''p'' on the line from ''endA'' to ''endB'' as an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;nearestPointOnLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLine(''endA'', ''endB'', ''p'') || returns distance from ''p'' to the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| polyPerimeter(''polygon'') || returns total distance around ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| polyArea(''polygon'') || returns area of ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| pointInPoly(''point'', ''polygon'') || returns true if ''point'' (an [''x'', ''y''] point) is contained within ''polygon''; or if ''point'' is a list of ['x'', ''y''] points, returns true if any of those points are within ''polygon''&lt;br /&gt;
|-&lt;br /&gt;
| offsetPoly(''polygon'', ''delta'') || returns a new polygon by insetting/growing ''polygon'' by the given amount&lt;br /&gt;
|-&lt;br /&gt;
| shiftPoly(''polygon'', ''dx'', ''dy'') || returns a new polygon by translating ''polygon'' by the given amounts&lt;br /&gt;
|-&lt;br /&gt;
| rotatePoly(''polygon'', ''degrees'') || returns a new polygon by rotating ''polygon'' by ''degrees'' clockwise&lt;br /&gt;
|-&lt;br /&gt;
| randNormal(''mean''=0, ''stddev''=1) || returns a [https://en.wikipedia.org/wiki/Normal_distribution normally-distributed] random number&lt;br /&gt;
|-&lt;br /&gt;
| randRange(''min'', ''max'') || returns a random number between ''min'' and ''max''&lt;br /&gt;
|-&lt;br /&gt;
| dice(''numberOfDice''=1, ''sides''=6) || roll ''numberOfDice'' dice, each with values from 1 to ''sides'', and return the sum&lt;br /&gt;
|-&lt;br /&gt;
| clamp(''x'', ''minval''=0, ''maxval'=1) || return ''x'' limited to the range ''minval'' to ''maxval''&lt;br /&gt;
|-&lt;br /&gt;
| numToStr(''n'', ''precision'') || convert ''n'' to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following program creates a sprite, then uses &amp;lt;c&amp;gt;mathUtil.moveTowardsXY&amp;lt;/c&amp;gt; to make it chase the mouse.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
s = new Sprite&lt;br /&gt;
s.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push s&lt;br /&gt;
while true&lt;br /&gt;
	mathUtil.moveTowardsXY s, mouse, 10&lt;br /&gt;
	yield&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay&amp;diff=1369</id>
		<title>TileDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay&amp;diff=1369"/>
		<updated>2025-03-28T10:27:41Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: Added value column and divided into 3 categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;TileDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that holds and draws a grid of tiles, small images taken from a larger image called a ''tile set''.&lt;br /&gt;
&lt;br /&gt;
No display is configured as a tile display by default.  But you can make any display layer a tile display by setting its [[Display.mode|mode]] to &amp;lt;c&amp;gt;displayMode.tile&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Tile Indexing ==&lt;br /&gt;
&lt;br /&gt;
The tiles within the tile-set are referred to by index.&lt;br /&gt;
&lt;br /&gt;
Note that in contrast to all other Mini Micro coordinates (which originate bottom-left) the tiles in a tile-set file are indexed from '''top-left to bottom-right'''.&lt;br /&gt;
&lt;br /&gt;
The tile with index 0 will refer to the leftmost image in the first row, index 1 to the one to its right, and so on, until the last image in the row. The next index number will refer to the first / leftmost image in the second row, and so on. The last image in the tile set will be the rightmost of the last row.&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
|-|&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Read only'''&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.cell]](''x'', ''y'') || get the tile index of cell ''x'', ''y'' || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.cellTint]](''x'', ''y'') || get the tint color of cell ''x'', ''y'' || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.cellTransform]](''x'', ''y'') || get the transform (0-7) of cell at ''x'', ''y'' || number&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Edit and read'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.extent]] ''[columns, rows]'' || display size || pair of numbers&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.tileSet]]  || [[Image]] containing tiles to draw from || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.tileSetTileSize]] || size of tiles in `tileSet` || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.cellSize]] || size of tiles on screen || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.overlap]] || cell overlap, in pixels || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.oddRowOffset]] || amount to shift odd rows horizontally; use 0.5 for hex rows || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.oddColOffset]] || amount to shift odd columns vertically; use 0.5 for hex columns || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.scrollX]] || horizontal scroll amount, in pixels || number&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.scrollY]] || vertical scroll amount, in pixels || number&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Run'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.clear]] ''toIndex'' || set all tiles to null (the default) or the given index&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.setCell]] ''x'', ''y'', ''idx'' || set the tile index of cell ''x'', ''y'' to ''idx''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.setCellTint]] ''x'', ''y'', ''c'' || set the tint of cell ''x'', ''y'' to color ''c''&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.setCellTransform]] ''x'', ''y'', ''t'' || set the transform of cell ''x'', ''y'' to value ''t''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following example shows how to set up a TileDisplay, load an initial pattern tiles, and then dynamically change the tiles shown over time.  (The main loop cycles through all 64 tiles in the demo tile set, changing the tile shown in the center of the display every 0.1 seconds.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare the display&lt;br /&gt;
clear&lt;br /&gt;
display(5).mode = displayMode.tile&lt;br /&gt;
td = display(5)&lt;br /&gt;
td.tileSet = file.loadImage(&amp;quot;/sys/pics/TileShapes.png&amp;quot;)&lt;br /&gt;
td.tileSetTileSize = 64  // size of each tile in the image&lt;br /&gt;
td.extent = [15, 10]  // columns, rows on screen&lt;br /&gt;
&lt;br /&gt;
// set up the initial tile pattern&lt;br /&gt;
td.clear 20  // clear to tile 20 (dark blue circle)&lt;br /&gt;
for row in range(0, 9)&lt;br /&gt;
	td.setCell 0, row, 6 // tile 6 is a yellow square&lt;br /&gt;
	td.setCell 14, row, 6&lt;br /&gt;
end for&lt;br /&gt;
for col in range(0, 14)&lt;br /&gt;
	td.setCell col, 0, 1  // tile 1 is a gray square&lt;br /&gt;
	td.setCell col, 9, 1&lt;br /&gt;
end for&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
cellIdx = 0&lt;br /&gt;
while true&lt;br /&gt;
	td.setCell 7, 5, cellIdx&lt;br /&gt;
	cellIdx = (cellIdx + 1) % 64&lt;br /&gt;
	wait 0.1&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:TileDisplayExample.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1368</id>
		<title>PixelDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1368"/>
		<updated>2025-03-28T10:07:14Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: Synchronize order with another page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;PixelDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that represents a rectangular pixel buffer, with methods to efficiently draw lines, shapes, images, and text.&lt;br /&gt;
&lt;br /&gt;
By default, [[display]] 5 is configured as a pixel display, and is in fact the pixel display to which the [[gfx]] global refers (unless you change it).  But you can make any display layer a pixel display by setting its [[Display.mode|mode]] to &amp;lt;c&amp;gt;displayMode.pixel&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A PixelDisplay is 960 x 640 pixels by default (see [[screen coordinates]]), though this may be changed via the [[PixelDisplay.clear|clear]] method.&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
|-|&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Edit and read'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.color]] || get or set the default drawing color, used when color is not otherwise specified || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scale]] || scaling factor used to magnify (or shrink) the pixel display on screen || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollX]] || get or set a horizontal shift applied to the entire display || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollY]] || get or set a vertical shift applied to the entire display ||  number&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Read only'''&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.width]] || number of columns in the the pixel buffer || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.height]] || number of rows in the the pixel buffer || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.pixel]] ''x '', ''y'' || get the color of a particular pixel || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.getImage]](''left'', ''bottom'', ''width'', ''height'') || get a portion of the pixel buffer as an [[Image]] || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
|-|&lt;br /&gt;
| colspan=3  style=&amp;quot;text-align: center;&amp;quot;| '''Run'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.clear]] ''[color]'', ''[width]'', ''[height]'' || clear/reset the pixel buffer width: number; height: number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.setPixel]] ''x'', ''y'', ''[color]'' || set the color of a particular pixel&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.line]] ''x1'', ''y1'', ''x2'', ''y2'', ''[color]'', ''[penSize]'' || draw a line&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw a rectangle outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled rectangle&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw an ellipse outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled ellipse&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawPoly]] ''points'', ''[color]'', ''[penSize]'' || draw a polygon outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillPoly]] ''points'', ''[color]'' || draw a filled polygon&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawImage]] ''img'', ''left'', ''bottom'', ''[width]'', ''[height]'', ''[srcLeft]'', ''[srcBottom]'', ''[srcWidth]'', ''[srcHeight]'' || draw an [[Image]] (or portion thereof) &lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.print]] ''str'', ''x'', ''y'', ''[color]'', ''[font]'' || draw a string&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation Note ==&lt;br /&gt;
&lt;br /&gt;
For performance reasons, a PixelDisplay under the hood is made up of 256x256 pixel tiles.  These are initialized to the color passed to [[PixelDisplay.clear]].  As a result, if your width or height is not an even multiple of 256, then this initial clear color will extend beyond the usable area.  As an example, try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;gfx.clear color.red, 200,200&lt;br /&gt;
gfx.fillRect 0,0,gfx.width,gfx.height, color.blue&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This displays a 200x200 blue square (the official size of the pixel display) with an additional red area extending 256x256 (one full tile) in size.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sprite&amp;diff=1291</id>
		<title>Sprite</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sprite&amp;diff=1291"/>
		<updated>2025-01-29T17:19:18Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: Fixing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;Sprite&amp;lt;/c&amp;gt; is a built-in class in the [[Mini Micro]] API.  It represents an image which can be added to a [[SpriteDisplay]], enabling it to be drawn to the screen very efficiently while also being scaled, rotated, or tinted, and layered consistently with other sprites and the surrounding displays.&lt;br /&gt;
&lt;br /&gt;
== Methods and properties used with Sprite objects ==&lt;br /&gt;
&lt;br /&gt;
Use these methods on Sprite instances, created with &amp;lt;c&amp;gt;[[new]] Sprite&amp;lt;/c&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Edit and read'''&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.image]] || image displayed  by the sprite || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.x]] || horizontal position of the sprite || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.y]] || vertical position of the sprite || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.scale]] || sprite scale (default 1.0) || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.rotation]] || sprite rotation (degrees counter-clockwise) || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.tint]] || tint color (defaults to white) || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.localBounds]] || stores the local bounds of the sprite || [[Bounds]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Read only'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.worldBounds]] || computes world bounds from local bounds and current position || pare of numbers&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.contains]](''x'', ''y'') || return whether the sprite contains the given world point || bool&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.overlaps]](''other'') || return whether this sprite is touching another sprite or [[Bounds]] || bool&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.corners]] || return &amp;lt;c&amp;gt;[x,y]&amp;lt;/c&amp;gt; screen positions of the four corners of this sprite, counter-clockwise from bottom left || 4 pares of numbers&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3  style=&amp;quot;text-align: center;&amp;quot;| '''Run'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.setCorners]] ''corners''|| set new screen positions for the four sprite corners (counter-clockwise from bottom left)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage Notes (Soda) ==&lt;br /&gt;
&lt;br /&gt;
In [[Soda]] there is currently only one, implicit, [[Display]].  So to add sprites to this display, push them onto a global list called &amp;lt;c&amp;gt;sprites&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Soda]] does not currently support [[Sprite.corners]] or [[Sprite.setCorners]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example creates a sprite, loads it into display 4 (which by default is a [[SpriteDisplay]]), and rotates it through 360 degrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;spr = new Sprite&lt;br /&gt;
spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push spr&lt;br /&gt;
spr.x = 480&lt;br /&gt;
spr.y = 320&lt;br /&gt;
for r in range(0,360)&lt;br /&gt;
   spr.rotation = r&lt;br /&gt;
   yield&lt;br /&gt;
end for&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[How to move a sprite forward]]&lt;br /&gt;
* [[How to detect a click on a sprite]]&lt;br /&gt;
* [[How to move a sprite with directional inputs]]&lt;br /&gt;
* [[How to load a sprite from the web]]&lt;br /&gt;
* [[How to make a sprite translucent]]&lt;br /&gt;
* [[How to move a sprite towards a target]]&lt;br /&gt;
* [[How to point a sprite at a target]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Mini Micro]]&lt;br /&gt;
[[Category: Soda]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sprite&amp;diff=1290</id>
		<title>Sprite</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sprite&amp;diff=1290"/>
		<updated>2025-01-29T17:18:48Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: /* Methods and properties used with Sprite objects */ Better look&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;Sprite&amp;lt;/c&amp;gt; is a built-in class in the [[Mini Micro]] API.  It represents an image which can be added to a [[SpriteDisplay]], enabling it to be drawn to the screen very efficiently while also being scaled, rotated, or tinted, and layered consistently with other sprites and the surrounding displays.&lt;br /&gt;
&lt;br /&gt;
== Methods and properties used with Sprite objects ==&lt;br /&gt;
&lt;br /&gt;
Use these methods on Sprite instances, created with &amp;lt;c&amp;gt;[[new]] Sprite&amp;lt;/c&amp;gt;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Edit and read'''&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.image]] || image displayed  by the sprite || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.x]] || horizontal position of the sprite || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.y]] || vertical position of the sprite || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.scale]] || sprite scale (default 1.0) || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.rotation]] || sprite rotation (degrees counter-clockwise) || number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.tint]] || tint color (defaults to white) || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.localBounds]] || stores the local bounds of the sprite || [[Bounds]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Read only'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.worldBounds]] || computes world bounds from local bounds and current position || pare of numbers&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.contains]](''x'', ''y'') || return whether the sprite contains the given world point || bool&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.overlaps]](''other'') || return whether this sprite is touching another sprite or [[Bounds]] || bool&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.corners]] || return &amp;lt;c&amp;gt;[x,y]&amp;lt;/c&amp;gt; screen positions of the four corners of this sprite, counter-clockwise from bottom left || 4 pares of numbers&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3  style=&amp;quot;text-align: center;&amp;quot;| '''Run'''&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.setCorners]] ''corners''|| set new screen positions for the four sprite corners (counter-clockwise from bottom left)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage Notes (Soda) ==&lt;br /&gt;
&lt;br /&gt;
In [[Soda]] there is currently only one, implicit, [[Display]].  So to add sprites to this display, push them onto a global list called &amp;lt;c&amp;gt;sprites&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Soda]] does not currently support [[Sprite.corners]] or [[Sprite.setCorners]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example creates a sprite, loads it into display 4 (which by default is a [[SpriteDisplay]]), and rotates it through 360 degrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;spr = new Sprite&lt;br /&gt;
spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push spr&lt;br /&gt;
spr.x = 480&lt;br /&gt;
spr.y = 320&lt;br /&gt;
for r in range(0,360)&lt;br /&gt;
   spr.rotation = r&lt;br /&gt;
   yield&lt;br /&gt;
end for&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[How to move a sprite forward]]&lt;br /&gt;
* [[How to detect a click on a sprite]]&lt;br /&gt;
* [[How to move a sprite with directional inputs]]&lt;br /&gt;
* [[How to load a sprite from the web]]&lt;br /&gt;
* [[How to make a sprite translucent]]&lt;br /&gt;
* [[How to move a sprite towards a target]]&lt;br /&gt;
* [[How to point a sprite at a target]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Mini Micro]]&lt;br /&gt;
[[Category: Soda]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1289</id>
		<title>PixelDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1289"/>
		<updated>2025-01-29T16:45:06Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: /* Methods and Properties */ Better looking&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;PixelDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that represents a rectangular pixel buffer, with methods to efficiently draw lines, shapes, images, and text.&lt;br /&gt;
&lt;br /&gt;
By default, [[display]] 5 is configured as a pixel display, and is in fact the pixel display to which the [[gfx]] global refers (unless you change it).  But you can make any display layer a pixel display by setting its [[Display.mode|mode]] to &amp;lt;c&amp;gt;displayMode.pixel&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A PixelDisplay is 960 x 640 pixels by default (see [[screen coordinates]]), though this may be changed via the [[PixelDisplay.clear|clear]] method.&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Read only'''&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.width]] || number of columns in the the pixel buffer || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.height]] || number of rows in the the pixel buffer || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.pixel]] ''x '', ''y'' || get the color of a particular pixel || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.getImage]](''left'', ''bottom'', ''width'', ''height'') || get a portion of the pixel buffer as an [[Image]] || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
|-|&lt;br /&gt;
| colspan=3 style=&amp;quot;text-align: center;&amp;quot; | '''Edit and read'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.color]] || get or set the default drawing color, used when color is not otherwise specified || string (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scale]] || scaling factor used to magnify (or shrink) the pixel display on screen || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollX]] || get or set a horizontal shift applied to the entire display || number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollY]] || get or set a vertical shift applied to the entire display ||  number&lt;br /&gt;
|-&lt;br /&gt;
|-|&lt;br /&gt;
| colspan=3  style=&amp;quot;text-align: center;&amp;quot;| '''Run'''&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.clear]] ''[color]'', ''[width]'', ''[height]'' || clear/reset the pixel buffer width: number; height: number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.setPixel]] ''x'', ''y'', ''[color]'' || set the color of a particular pixel&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.line]] ''x1'', ''y1'', ''x2'', ''y2'', ''[color]'', ''[penSize]'' || draw a line&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw a filled rectangle&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled rectangle&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw an ellipse outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled ellipse&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawPoly]] ''points'', ''[color]'', ''[penSize]'' || draw a polygon outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillPoly]] ''points'', ''[color]'' || draw a filled polygon&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawImage]] ''img'', ''left'', ''bottom'', ''[width]'', ''[height]'', ''[srcLeft]'', ''[srcBottom]'', ''[srcWidth]'', ''[srcHeight]'' || draw an [[Image]] (or portion thereof) &lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.print]] ''str'', ''x'', ''y'', ''[color]'', ''[font]'' || draw a string&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation Note ==&lt;br /&gt;
&lt;br /&gt;
For performance reasons, a PixelDisplay under the hood is made up of 256x256 pixel tiles.  These are initialized to the color passed to [[PixelDisplay.clear]].  As a result, if your width or height is not an even multiple of 256, then this initial clear color will extend beyond the usable area.  As an example, try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;gfx.clear color.red, 200,200&lt;br /&gt;
gfx.fillRect 0,0,gfx.width,gfx.height, color.blue&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This displays a 200x200 blue square (the official size of the pixel display) with an additional red area extending 256x256 (one full tile) in size.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sprite&amp;diff=1288</id>
		<title>Sprite</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sprite&amp;diff=1288"/>
		<updated>2025-01-29T16:13:33Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: /* Methods and properties used with Sprite objects */  Add feedback features&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;Sprite&amp;lt;/c&amp;gt; is a built-in class in the [[Mini Micro]] API.  It represents an image which can be added to a [[SpriteDisplay]], enabling it to be drawn to the screen very efficiently while also being scaled, rotated, or tinted, and layered consistently with other sprites and the surrounding displays.&lt;br /&gt;
&lt;br /&gt;
== Methods and properties used with Sprite objects ==&lt;br /&gt;
&lt;br /&gt;
Use these methods on Sprite instances, created with &amp;lt;c&amp;gt;[[new]] Sprite&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Edit and Read ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.image]] || image displayed  by the sprite || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.x]] || horizontal position of the sprite || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.y]] || vertical position of the sprite || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.scale]] || sprite scale (default 1.0) || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.rotation]] || sprite rotation (degrees counter-clockwise) || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.tint]] || tint color (defaults to white) || String (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.localBounds]] || stores the local bounds of the sprite || [[Bounds]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
=== Read only ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.worldBounds]] || computes world bounds from local bounds and current position || Pare of numbers&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.contains]](''x'', ''y'') || return whether the sprite contains the given world point || Bool&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.overlaps]](''other'') || return whether this sprite is touching another sprite or [[Bounds]] || Bool&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.corners]] || return &amp;lt;c&amp;gt;[x,y]&amp;lt;/c&amp;gt; screen positions of the four corners of this sprite, counter-clockwise from bottom left || 4 pares of numbers&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
=== Run ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.setCorners]] ''corners''|| set new screen positions for the four sprite corners (counter-clockwise from bottom left)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage Notes (Soda) ==&lt;br /&gt;
&lt;br /&gt;
In [[Soda]] there is currently only one, implicit, [[Display]].  So to add sprites to this display, push them onto a global list called &amp;lt;c&amp;gt;sprites&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Soda]] does not currently support [[Sprite.corners]] or [[Sprite.setCorners]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example creates a sprite, loads it into display 4 (which by default is a [[SpriteDisplay]]), and rotates it through 360 degrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;spr = new Sprite&lt;br /&gt;
spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push spr&lt;br /&gt;
spr.x = 480&lt;br /&gt;
spr.y = 320&lt;br /&gt;
for r in range(0,360)&lt;br /&gt;
   spr.rotation = r&lt;br /&gt;
   yield&lt;br /&gt;
end for&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[How to move a sprite forward]]&lt;br /&gt;
* [[How to detect a click on a sprite]]&lt;br /&gt;
* [[How to move a sprite with directional inputs]]&lt;br /&gt;
* [[How to load a sprite from the web]]&lt;br /&gt;
* [[How to make a sprite translucent]]&lt;br /&gt;
* [[How to move a sprite towards a target]]&lt;br /&gt;
* [[How to point a sprite at a target]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Mini Micro]]&lt;br /&gt;
[[Category: Soda]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1287</id>
		<title>PixelDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1287"/>
		<updated>2025-01-29T16:07:30Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: /* Methods and Properties */ Add feedback features&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;PixelDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that represents a rectangular pixel buffer, with methods to efficiently draw lines, shapes, images, and text.&lt;br /&gt;
&lt;br /&gt;
By default, [[display]] 5 is configured as a pixel display, and is in fact the pixel display to which the [[gfx]] global refers (unless you change it).  But you can make any display layer a pixel display by setting its [[Display.mode|mode]] to &amp;lt;c&amp;gt;displayMode.pixel&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A PixelDisplay is 960 x 640 pixels by default (see [[screen coordinates]]), though this may be changed via the [[PixelDisplay.clear|clear]] method.&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
&lt;br /&gt;
=== Read only ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Type&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.width]] || number of columns in the the pixel buffer || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.height]] || number of rows in the the pixel buffer || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.pixel]] ''x '', ''y'' || get the color of a particular pixel || String (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.getImage]](''left'', ''bottom'', ''width'', ''height'') || get a portion of the pixel buffer as an [[Image]] || [[Image]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Edit and read ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.color]] || get or set the default drawing color, used when color is not otherwise specified || String (color)&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scale]] || scaling factor used to magnify (or shrink) the pixel display on screen || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollX]] || get or set a horizontal shift applied to the entire display || Number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollY]] || get or set a vertical shift applied to the entire display ||  Number&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
=== Run ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.clear]] ''[color]'', ''[width]'', ''[height]'' || clear/reset the pixel buffer&lt;br /&gt;
width: number; height: number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.setPixel]] ''x'', ''y'', ''[color]'' || set the color of a particular pixel&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.line]] ''x1'', ''y1'', ''x2'', ''y2'', ''[color]'', ''[penSize]'' || draw a line&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw a filled rectangle&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled rectangle&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw an ellipse outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled ellipse&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawPoly]] ''points'', ''[color]'', ''[penSize]'' || draw a polygon outline&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillPoly]] ''points'', ''[color]'' || draw a filled polygon&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawImage]] ''img'', ''left'', ''bottom'', ''[width]'', ''[height]'', ''[srcLeft]'', ''[srcBottom]'', ''[srcWidth]'', ''[srcHeight]'' || draw an [[Image]] (or portion thereof) &lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.print]] ''str'', ''x'', ''y'', ''[color]'', ''[font]'' || draw a string&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation Note ==&lt;br /&gt;
&lt;br /&gt;
For performance reasons, a PixelDisplay under the hood is made up of 256x256 pixel tiles.  These are initialized to the color passed to [[PixelDisplay.clear]].  As a result, if your width or height is not an even multiple of 256, then this initial clear color will extend beyond the usable area.  As an example, try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;gfx.clear color.red, 200,200&lt;br /&gt;
gfx.fillRect 0,0,gfx.width,gfx.height, color.blue&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This displays a 200x200 blue square (the official size of the pixel display) with an additional red area extending 256x256 (one full tile) in size.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sprite&amp;diff=1285</id>
		<title>Sprite</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sprite&amp;diff=1285"/>
		<updated>2025-01-29T11:26:22Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: /* Methods and properties used with Sprite objects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;Sprite&amp;lt;/c&amp;gt; is a built-in class in the [[Mini Micro]] API.  It represents an image which can be added to a [[SpriteDisplay]], enabling it to be drawn to the screen very efficiently while also being scaled, rotated, or tinted, and layered consistently with other sprites and the surrounding displays.&lt;br /&gt;
&lt;br /&gt;
== Methods and properties used with Sprite objects ==&lt;br /&gt;
&lt;br /&gt;
Use these methods on Sprite instances, created with &amp;lt;c&amp;gt;[[new]] Sprite&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Edit and Read ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.image]] || image displayed  by the sprite || Input: image&lt;br /&gt;
Output: image&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.x]] || horizontal position of the sprite || Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.y]] || vertical position of the sprite || Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.scale]] || sprite scale (default 1.0) || Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.rotation]] || sprite rotation (degrees counter-clockwise) || Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.tint]] || tint color (defaults to white) || Input: color&lt;br /&gt;
Output: color&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.localBounds]] || stores the local bounds of the sprite || Input: [[Bounds]]&lt;br /&gt;
Output: [[Bounds]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
=== Read only ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.worldBounds]] || computes world bounds from local bounds and current position || Input: NULL&lt;br /&gt;
Output: pare of numbers&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.contains]](''x'', ''y'') || return whether the sprite contains the given world point || Input: x: number; y: number&lt;br /&gt;
Output: true/false&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.overlaps]](''other'') || return whether this sprite is touching another sprite or [[Bounds]] || Input: [[Sprite]]&lt;br /&gt;
Output: true/false&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.corners]] || return &amp;lt;c&amp;gt;[x,y]&amp;lt;/c&amp;gt; screen positions of the four corners of this sprite, counter-clockwise from bottom left || Input: NULL&lt;br /&gt;
Output: 4 pares of numbers&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
=== Run ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.setCorners]] ''corners''|| set new screen positions for the four sprite corners (counter-clockwise from bottom left) || Input: 4 pares of numbers&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage Notes (Soda) ==&lt;br /&gt;
&lt;br /&gt;
In [[Soda]] there is currently only one, implicit, [[Display]].  So to add sprites to this display, push them onto a global list called &amp;lt;c&amp;gt;sprites&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Soda]] does not currently support [[Sprite.corners]] or [[Sprite.setCorners]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example creates a sprite, loads it into display 4 (which by default is a [[SpriteDisplay]]), and rotates it through 360 degrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;spr = new Sprite&lt;br /&gt;
spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push spr&lt;br /&gt;
spr.x = 480&lt;br /&gt;
spr.y = 320&lt;br /&gt;
for r in range(0,360)&lt;br /&gt;
   spr.rotation = r&lt;br /&gt;
   yield&lt;br /&gt;
end for&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[How to move a sprite forward]]&lt;br /&gt;
* [[How to detect a click on a sprite]]&lt;br /&gt;
* [[How to move a sprite with directional inputs]]&lt;br /&gt;
* [[How to load a sprite from the web]]&lt;br /&gt;
* [[How to make a sprite translucent]]&lt;br /&gt;
* [[How to move a sprite towards a target]]&lt;br /&gt;
* [[How to point a sprite at a target]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Mini Micro]]&lt;br /&gt;
[[Category: Soda]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1284</id>
		<title>PixelDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=PixelDisplay&amp;diff=1284"/>
		<updated>2025-01-29T10:06:11Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: /* Methods and Properties */  added value column and divided into 3 categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;PixelDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that represents a rectangular pixel buffer, with methods to efficiently draw lines, shapes, images, and text.&lt;br /&gt;
&lt;br /&gt;
By default, [[display]] 5 is configured as a pixel display, and is in fact the pixel display to which the [[gfx]] global refers (unless you change it).  But you can make any display layer a pixel display by setting its [[Display.mode|mode]] to &amp;lt;c&amp;gt;displayMode.pixel&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A PixelDisplay is 960 x 640 pixels by default (see [[screen coordinates]]), though this may be changed via the [[PixelDisplay.clear|clear]] method.&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
&lt;br /&gt;
=== Read only ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.width]] || number of columns in the the pixel buffer || Input: NULL&lt;br /&gt;
Output: number &lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.height]] || number of rows in the the pixel buffer || Input: NULL&lt;br /&gt;
Output: number &lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.pixel]] ''x '', ''y'' || get the color of a particular pixel || Input: x: number; y: number&lt;br /&gt;
Output: color&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.getImage]](''left'', ''bottom'', ''width'', ''height'') || get a portion of the pixel buffer as an [[Image]] || Input: left: number; bottom: number; width: number; height: number&lt;br /&gt;
Output: image&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Edit and read ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.color]] || get or set the default drawing color, used when color is not otherwise specified || Input: color&lt;br /&gt;
Output: color&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scale]] || scaling factor used to magnify (or shrink) the pixel display on screen || Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollX]] || get or set a horizontal shift applied to the entire display || Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.scrollY]] || get or set a vertical shift applied to the entire display ||  Input: number&lt;br /&gt;
Output: number&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
=== Run ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose !! Value&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.clear]] ''[color]'', ''[width]'', ''[height]'' || clear/reset the pixel buffer || Input: color: color&lt;br /&gt;
width: number; height: number&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.setPixel]] ''x'', ''y'', ''[color]'' || set the color of a particular pixel || Input: x: number; y: number; color: color&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.line]] ''x1'', ''y1'', ''x2'', ''y2'', ''[color]'', ''[penSize]'' || draw a line || Input: x1: number; y1: number; x2: number; x2: number;  color: color; penSize: num&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw a rectangle outline || Input: left: number; bottom: number; width: number; height: number;  color: color; penSize: num&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillRect]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled rectangle ||&lt;br /&gt;
Input: left: number; bottom: number; width: number; height: number;  color: color&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'', ''[penSize]'' || draw an ellipse outline || Input: left: number; bottom: number; width: number; height: number;  color: color; penSize: num&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillEllipse]] ''left'', ''bottom'', ''width'', ''height'', ''[color]'' || draw a filled ellipse || Input: left: number; bottom: number; width: number; height: number;  color: color&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawPoly]] ''points'', ''[color]'', ''[penSize]'' || draw a polygon outline || Input: points: list of pare of nums; color: color; penSize: num&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.fillPoly]] ''points'', ''[color]'' || draw a filled polygon || Input: points: list of pare of nums; color: color&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.drawImage]] ''img'', ''left'', ''bottom'', ''[width]'', ''[height]'', ''[srcLeft]'', ''[srcBottom]'', ''[srcWidth]'', ''[srcHeight]'' || draw an [[Image]] (or portion thereof) || Input: img: image; left: number; bottom: number; width: number; height: number; scrWidth: number; scrHeight&lt;br /&gt;
|-&lt;br /&gt;
| [[PixelDisplay.print]] ''str'', ''x'', ''y'', ''[color]'', ''[font]'' || draw a string || Input: str: string; x: number; y: number; color: color; font: font&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implementation Note ==&lt;br /&gt;
&lt;br /&gt;
For performance reasons, a PixelDisplay under the hood is made up of 256x256 pixel tiles.  These are initialized to the color passed to [[PixelDisplay.clear]].  As a result, if your width or height is not an even multiple of 256, then this initial clear color will extend beyond the usable area.  As an example, try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;gfx.clear color.red, 200,200&lt;br /&gt;
gfx.fillRect 0,0,gfx.width,gfx.height, color.blue&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This displays a 200x200 blue square (the official size of the pixel display) with an additional red area extending 256x256 (one full tile) in size.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=PixelDisplay.clear&amp;diff=1283</id>
		<title>PixelDisplay.clear</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=PixelDisplay.clear&amp;diff=1283"/>
		<updated>2025-01-28T19:01:56Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: Add &amp;quot;Examples&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[PixelDisplay]].clear&amp;lt;/c&amp;gt; clears, resets, and resizes this pixel display.&lt;br /&gt;
&lt;br /&gt;
=== Arguments ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter Name !! Type !! Default Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| ''color'' || color ||  color.clear || color to fill the display with&lt;br /&gt;
|-&lt;br /&gt;
| ''width'' || number || 960 || new display width&lt;br /&gt;
|-&lt;br /&gt;
| ''height'' || number || 640 || new display height&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
=== Usage Notes ===&lt;br /&gt;
In addition to clearing the color and setting the size, this method&lt;br /&gt;
also resets the scale to 1, and scrollX and scrollY to 0.  If you wish to clear only the color without resetting scale and scroll, use something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;gfx.fillRect 0, 0, gfx.width, gfx.height, myColor&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
&lt;br /&gt;
gfx.fillRect 10,10,700,600,&amp;quot;#aaaaaa&amp;quot;    // Draw rect&lt;br /&gt;
&lt;br /&gt;
wait 1&lt;br /&gt;
&lt;br /&gt;
gfx.clear &amp;quot;#556677&amp;quot;, 100, 100    // Clear window and set window size 100x100&lt;br /&gt;
gfx.fillRect 10,10,700,600,&amp;quot;#aaaaaa&amp;quot;    // Draw same rect on resize window &amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Gfx&amp;diff=1282</id>
		<title>Gfx</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Gfx&amp;diff=1282"/>
		<updated>2025-01-28T11:56:25Z</updated>

		<summary type="html">&lt;p&gt;Duck Mim: Fixed the bottom link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;gfx&amp;lt;/c&amp;gt; is a global reference to a [[PixelDisplay]].  It is assigned &amp;lt;c&amp;gt;[[display]](5)&amp;lt;/c&amp;gt; by the &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; command.  Users may reassign it as desired.&lt;br /&gt;
&lt;br /&gt;
Note that unlike &amp;lt;c&amp;gt;[[text]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;gfx&amp;lt;/c&amp;gt; has no special significance to the Mini Micro runtime.  It is provided only as a convenience to the user, and to facilitate sharing of small scripts that do pixel drawing.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Duck Mim</name></author>
		
	</entry>
</feed>