<?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=JoeStrout</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=JoeStrout"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/wiki/Special:Contributions/JoeStrout"/>
	<updated>2026-04-12T11:31:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_mount_a_virtual_disk_in_Mini_Micro&amp;diff=1447</id>
		<title>How to mount a virtual disk in Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_mount_a_virtual_disk_in_Mini_Micro&amp;diff=1447"/>
		<updated>2026-02-08T16:26:56Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &amp;quot;virtual disk&amp;quot; is just a folder, .zip file, .minidisk file, or [[Image Disks|image disk]] which can be used with Mini Micro.  Mini Micro can mount (make use of) two virtual disks at any one time; these are called &amp;quot;/usr&amp;quot; and &amp;quot;/usr2&amp;quot; in the Mini Micro file system.&lt;br /&gt;
&lt;br /&gt;
There are two methods for mounting a virtual disk:&lt;br /&gt;
&lt;br /&gt;
== 1. Disk slot menu ==&lt;br /&gt;
&lt;br /&gt;
Click on one of the two disk slots in the lower-left corner of the Mini Micro window, below the Mini Micro screen.  Select &amp;quot;Mount Folder...&amp;quot; or &amp;quot;Mount Disk File...&amp;quot;.  Select the file or folder you want to use.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless]]&lt;br /&gt;
&lt;br /&gt;
== 2. Drag and Drop (Mac/Windows only) ==&lt;br /&gt;
&lt;br /&gt;
Have Mini Micro already running.  Grab the folder or file you want to mount in the Windows Explorer or Mac Finder.  Drag it onto the Mini Micro window, and let go.  The folder or disk file will be mounted in slot 1, i.e. &amp;quot;/usr&amp;quot;.  (It is not possible to load a disk as /usr2 using this method.)&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1446</id>
		<title>How to package a Mini Micro game</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1446"/>
		<updated>2026-02-08T16:25:51Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To &amp;quot;package&amp;quot; a [[Mini Micro]] game means to bundle up all the files into a format that end-users can download (or access on the web) and play without needing anything else.&lt;br /&gt;
&lt;br /&gt;
The basic idea is simple: Mini Micro will automatically look for a zip file (or folder) next to the executable called '''user.minidisk''', and if it finds this, it would automatically mount that as '''/usr''' and run any program it finds there as '''/usr/startup.ms'''.  So packaging amounts to taking a standard Mini Micro distribution, adding the desired '''user.minidisk''' file, and tweaking things like the app name and icon.  Exact details, though, vary with the platform you're targeting.&lt;br /&gt;
&lt;br /&gt;
Note that while the directions below include links to zip instructions/tools on the corresponding platform, it is ''not'' necessary to be on the platform you are packaging for.  In other words, it should work perfectly well to package for all platforms, from whatever platform you happen to use.  Also note that the first three steps in each section below are the same, and only need to be done once no matter how many platforms you package for.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Windows Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that runs your program.  For example, your startup.ms might contain just &amp;lt;c&amp;gt;run &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.laptopmag.com/articles/how-to-zip-files-windows-10 zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.  Test it by [[How to mount a virtual disk in Mini Micro|mounting]] this user.minidisk file in Mini Micro, and then &amp;lt;c&amp;gt;reboot&amp;lt;/c&amp;gt;; it should launch your game.&lt;br /&gt;
# Download the Windows distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''Mini Micro.exe''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''Mini Micro_Data/StreamingAssets''' subfolder.&lt;br /&gt;
# If you like, rename '''Mini Micro.exe''' to the name of your game. Note: Do not forget to change the folder '''Mini Micro_data''' to the name change with the exe with '''_data'''. example: '''strat.exe''', data folder would be '''strat_data'''.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the .exe, your '''user.minidisk''' file, and everything else that came with the original Windows distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for MacOS Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that runs your program.  For example, your startup.ms might contain just &amp;lt;c&amp;gt;run &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.lifewire.com/how-to-zip-and-unzip-files-and-folders-on-a-mac-2260188 zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.  Test it by [[How to mount a virtual disk in Mini Micro|mounting]] this user.minidisk file in Mini Micro, and then &amp;lt;c&amp;gt;reboot&amp;lt;/c&amp;gt;; it should launch your game.&lt;br /&gt;
# Download the MacOS distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.app''' file.  (If you are doing this in Windows or Linux, '''MiniMicro.app''' will appear as a folder; on a Mac, the same folder appears as an app, and the .app extension may be hidden.)&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file, and place that inside the application bundle under '''Contents/Resources/Data/StreamingAssets'''.&lt;br /&gt;
# If you like, rename '''MiniMicro.app''' to the name of your game.&lt;br /&gt;
# Zip up (or place on a [https://support.apple.com/guide/disk-utility/create-a-disk-image-dskutl11888/mac disk image]) the whole folder containing the app and your '''user.minidisk''' file.&lt;br /&gt;
&lt;br /&gt;
The resulting zip or DMG can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Linux Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that runs your program.  For example, your startup.ms might contain just &amp;lt;c&amp;gt;run &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.  Test it by [[How to mount a virtual disk in Mini Micro|mounting]] this user.minidisk file in Mini Micro, and then &amp;lt;c&amp;gt;reboot&amp;lt;/c&amp;gt;; it should launch your game.&lt;br /&gt;
# Download the Linux distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.x86_64''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''MiniMicro_Data/StreamingAssets''' folder.&lt;br /&gt;
# If you like, rename '''MiniMicro.x86_64''' to the name of your game.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the executable, your '''user.minidisk''' file, and everything else that came with the original Linux distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for the Web ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that runs your program.  For example, your startup.ms might contain just &amp;lt;c&amp;gt;run &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, zip the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.  Test it by [[How to mount a virtual disk in Mini Micro|mounting]] this user.minidisk file in Mini Micro, and then &amp;lt;c&amp;gt;reboot&amp;lt;/c&amp;gt;; it should launch your game.&lt;br /&gt;
# Download the WebGL Template from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file into the  '''StreamingAssets''' folder, replacing the (empty) user.minidisk there in the template.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that next to '''user.minidisk'''.&lt;br /&gt;
# If uploading to itch.io, zip up the whole folder containing '''Build''', '''index.html''', and '''StreamingAssets'''.&lt;br /&gt;
# Upload that archive to itch.io, or upload the folder to your web site.  If asked for viewport dimensions, use 1024 by 768 pixels.&lt;br /&gt;
&lt;br /&gt;
== Common problems ==&lt;br /&gt;
&lt;br /&gt;
* When making your '''user.minidisk''' file from a mounted folder, make sure you zip the ''contents'' of the folder, not the folder itself.&lt;br /&gt;
* Also be sure the result is actually named '''user.minidisk''', rather than '''user.minidisk.zip'''.  (Some file managers will try to &amp;quot;helpfully&amp;quot; keep the .zip extension, and just hide it from you in the UI; use a terminal window to be sure.)&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_mount_a_virtual_disk_in_Mini_Micro&amp;diff=1445</id>
		<title>How to mount a virtual disk in Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_mount_a_virtual_disk_in_Mini_Micro&amp;diff=1445"/>
		<updated>2026-02-08T16:21:01Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Created page with &amp;quot;A &amp;quot;virtual disk&amp;quot; is just a folder, .zip file, .minidisk file, or image disk which can be used with Mini Micro.  Mini Micro can mount (make use of) two virtual...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &amp;quot;virtual disk&amp;quot; is just a folder, .zip file, .minidisk file, or [[Image Disks|image disk]] which can be used with Mini Micro.  Mini Micro can mount (make use of) two virtual disks at any one time; these are called &amp;quot;/usr&amp;quot; and &amp;quot;/usr2&amp;quot; in the Mini Micro file system.&lt;br /&gt;
&lt;br /&gt;
There are two methods for mounting a virtual disk:&lt;br /&gt;
&lt;br /&gt;
== 1. Disk slot menu ==&lt;br /&gt;
&lt;br /&gt;
Click on one of the two disk slots in the lower-left corner of the Mini Micro window, below the Mini Micro screen.  Select &amp;quot;Mount Folder...&amp;quot; or &amp;quot;Mount Disk File...&amp;quot;.  Select the file or folder you want to use.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless]]&lt;br /&gt;
&lt;br /&gt;
== 2. Drag and Drop (Mac/Windows only) ==&lt;br /&gt;
&lt;br /&gt;
Have Mini Micro already running.  Grab the folder or file you want to mount in the Windows Explorer or Mac Finder.  Drag it onto the Mini Micro window, and let go.  The folder or disk file will be mounted in slot 1, i.e. &amp;quot;/usr&amp;quot;.  (It is not possible to load a disk as /usr2 using this method.)&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1444</id>
		<title>How to package a Mini Micro game</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1444"/>
		<updated>2026-02-08T15:40:41Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To &amp;quot;package&amp;quot; a [[Mini Micro]] game means to bundle up all the files into a format that end-users can download (or access on the web) and play without needing anything else.&lt;br /&gt;
&lt;br /&gt;
The basic idea is simple: Mini Micro will automatically look for a zip file (or folder) next to the executable called '''user.minidisk''', and if it finds this, it would automatically mount that as '''/usr''' and run any program it finds there as '''/usr/startup.ms'''.  So packaging amounts to taking a standard Mini Micro distribution, adding the desired '''user.minidisk''' file, and tweaking things like the app name and icon.  Exact details, though, vary with the platform you're targeting.&lt;br /&gt;
&lt;br /&gt;
Note that while the directions below include links to zip instructions/tools on the corresponding platform, it is ''not'' necessary to be on the platform you are packaging for.  In other words, it should work perfectly well to package for all platforms, from whatever platform you happen to use.  Also note that the first three steps in each section below are the same, and only need to be done once no matter how many platforms you package for.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Windows Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.laptopmag.com/articles/how-to-zip-files-windows-10 zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Windows distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''Mini Micro.exe''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''Mini Micro_Data/StreamingAssets''' subfolder.&lt;br /&gt;
# If you like, rename '''Mini Micro.exe''' to the name of your game. Note: Do not forget to change the folder '''Mini Micro_data''' to the name change with the exe with '''_data'''. example: '''strat.exe''', data folder would be '''strat_data'''.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the .exe, your '''user.minidisk''' file, and everything else that came with the original Windows distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for MacOS Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.lifewire.com/how-to-zip-and-unzip-files-and-folders-on-a-mac-2260188 zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the MacOS distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.app''' file.  (If you are doing this in Windows or Linux, '''MiniMicro.app''' will appear as a folder; on a Mac, the same folder appears as an app, and the .app extension may be hidden.)&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file, and place that inside the application bundle under '''Contents/Resources/Data/StreamingAssets'''.&lt;br /&gt;
# If you like, rename '''MiniMicro.app''' to the name of your game.&lt;br /&gt;
# Zip up (or place on a [https://support.apple.com/guide/disk-utility/create-a-disk-image-dskutl11888/mac disk image]) the whole folder containing the app and your '''user.minidisk''' file.&lt;br /&gt;
&lt;br /&gt;
The resulting zip or DMG can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Linux Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Linux distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.x86_64''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''MiniMicro_Data/StreamingAssets''' folder.&lt;br /&gt;
# If you like, rename '''MiniMicro.x86_64''' to the name of your game.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the executable, your '''user.minidisk''' file, and everything else that came with the original Linux distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for the Web ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk (folder or .minidisk) containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, zip the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the WebGL Template from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file into the  '''StreamingAssets''' folder, replacing the (empty) user.minidisk there in the template.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that next to '''user.minidisk'''.&lt;br /&gt;
# If uploading to itch.io, zip up the whole folder containing '''Build''', '''index.html''', and '''StreamingAssets'''.&lt;br /&gt;
# Upload that archive to itch.io, or upload the folder to your web site.  If asked for viewport dimensions, use 1024 by 768 pixels.&lt;br /&gt;
&lt;br /&gt;
== Common problems ==&lt;br /&gt;
&lt;br /&gt;
* When making your '''user.minidisk''' file from a mounted folder, make sure you zip the ''contents'' of the folder, not the folder itself.&lt;br /&gt;
* Also be sure the result is actually named '''user.minidisk''', rather than '''user.minidisk.zip'''.  (Some file managers will try to &amp;quot;helpfully&amp;quot; keep the .zip extension, and just hide it from you in the UI; use a terminal window to be sure.)&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1434</id>
		<title>How to package a Mini Micro game</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1434"/>
		<updated>2025-09-15T16:33:32Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To &amp;quot;package&amp;quot; a [[Mini Micro]] game means to bundle up all the files into a format that end-users can download (or access on the web) and play without needing anything else.&lt;br /&gt;
&lt;br /&gt;
The basic idea is simple: Mini Micro will automatically look for a zip file (or folder) next to the executable called '''user.minidisk''', and if it finds this, it would automatically mount that as '''/usr''' and run any program it finds there as '''/usr/startup.ms'''.  So packaging amounts to taking a standard Mini Micro distribution, adding the desired '''user.minidisk''' file, and tweaking things like the app name and icon.  Exact details, though, vary with the platform you're targeting.&lt;br /&gt;
&lt;br /&gt;
Note that while the directions below include links to zip instructions/tools on the corresponding platform, it is ''not'' necessary to be on the platform you are packaging for.  In other words, it should work perfectly well to package for all platforms, from whatever platform you happen to use.  Also note that the first three steps in each section below are the same, and only need to be done once no matter how many platforms you package for.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Windows Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.laptopmag.com/articles/how-to-zip-files-windows-10 zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Windows distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''Mini Micro.exe''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''Mini Micro_Data/StreamingAssets''' subfolder.&lt;br /&gt;
# If you like, rename '''Mini Micro.exe''' to the name of your game. Note: Do not forget to change the folder '''Mini Micro_data''' to the name change with the exe with '''_data'''. example: '''strat.exe''', data folder would be '''strat_data'''.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the .exe, your '''user.minidisk''' file, and everything else that came with the original Windows distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for MacOS Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.lifewire.com/how-to-zip-and-unzip-files-and-folders-on-a-mac-2260188 zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the MacOS distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.app''' file.  (If you are doing this in Windows or Linux, '''MiniMicro.app''' will appear as a folder; on a Mac, the same folder appears as an app, and the .app extension may be hidden.)&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file, and place that inside the application bundle under '''Contents/Resources/Data/StreamingAssets'''.&lt;br /&gt;
# If you like, rename '''MiniMicro.app''' to the name of your game.&lt;br /&gt;
# Zip up (or place on a [https://support.apple.com/guide/disk-utility/create-a-disk-image-dskutl11888/mac disk image]) the whole folder containing the app and your '''user.minidisk''' file.&lt;br /&gt;
&lt;br /&gt;
The resulting zip or DMG can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Linux Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html zip] the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Linux distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.x86_64''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''MiniMicro_Data/StreamingAssets''' folder.&lt;br /&gt;
# If you like, rename '''MiniMicro.x86_64''' to the name of your game.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the executable, your '''user.minidisk''' file, and everything else that came with the original Linux distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for the Web ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, zip the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the WebGL Template from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file into the  '''StreamingAssets''' folder, replacing the (empty) user.minidisk there in the template.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that next to '''user.minidisk'''.&lt;br /&gt;
# If uploading to itch.io, zip up the whole folder containing '''Build''', '''index.html''', and '''StreamingAssets'''.&lt;br /&gt;
# Upload that archive to itch.io, or upload the folder to your web site.  If asked for viewport dimensions, use 1024 by 768 pixels.&lt;br /&gt;
&lt;br /&gt;
== Common problems ==&lt;br /&gt;
&lt;br /&gt;
* When making your '''user.minidisk''' file from a mounted folder, make sure you zip the ''contents'' of the folder, not the folder itself.&lt;br /&gt;
* Also be sure the result is actually named '''user.minidisk''', rather than '''user.minidisk.zip'''.  (Some file managers will try to &amp;quot;helpfully&amp;quot; keep the .zip extension, and just hide it from you in the UI; use a terminal window to be sure.)&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sprite&amp;diff=1427</id>
		<title>Sprite</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sprite&amp;diff=1427"/>
		<updated>2025-08-05T22:46:18Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: add uvs and setUVs&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 || pair 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 pairs of numbers&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.uvs]] || return &amp;lt;c&amp;gt;[u,v]&amp;lt;/c&amp;gt; texture coordinates of the four corners of this sprite, counter-clockwise from bottom left || 4 pairs 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;
| [[Sprite.setCorners]] ''corners''|| set new screen positions for the four sprite corners (counter-clockwise from bottom left)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sprite.setUVs]] ''uvs''|| set new texture coordinates for the four sprite corners (counter-clockwise from bottom left)&lt;br /&gt;
|-&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;
* [[How to use a sprite sheet]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Mini Micro]]&lt;br /&gt;
[[Category: Soda]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Lua&amp;diff=1426</id>
		<title>Lua</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Lua&amp;diff=1426"/>
		<updated>2025-08-01T22:21:42Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Lists */  fix formatting typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lua is a scripting language first released in 1993, and particularly popular as an embedded language.  This article compares Lua to MiniScript, and may be useful to people coming to MiniScript with a background in Lua.&lt;br /&gt;
&lt;br /&gt;
For a side-by-side comparison on a collection of short programs, see [https://miniscript.org/compare/lua.html here].&lt;br /&gt;
&lt;br /&gt;
== Similarities ==&lt;br /&gt;
&lt;br /&gt;
=== Block Syntax ===&lt;br /&gt;
&lt;br /&gt;
Both Lua and MiniScript delineate code blocks and control structures with explicit keywords.  There are some minor differences in syntax, summarized in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Lua&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| function / end&lt;br /&gt;
| function / end function&lt;br /&gt;
|-&lt;br /&gt;
| if / elseif / end&lt;br /&gt;
| if / else if / end if&lt;br /&gt;
|-&lt;br /&gt;
| while ... do / end&lt;br /&gt;
| while / end while&lt;br /&gt;
|-&lt;br /&gt;
| for i = 1, 10, 2 do / end&amp;lt;br /&amp;gt;&lt;br /&gt;
| for i in range(1, 10, 2) / end for&amp;lt;br /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| repeat / until&lt;br /&gt;
| style=&amp;quot;font-style:italic;&amp;quot; | (no direct equivalent)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The most notable difference is that while Lua uses &amp;lt;c&amp;gt;end&amp;lt;/c&amp;gt; alone to terminate a &amp;lt;c&amp;gt;function&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;while&amp;lt;/c&amp;gt;, or &amp;lt;c&amp;gt;for&amp;lt;/c&amp;gt; block, MiniScript uses &amp;lt;c&amp;gt;end function&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;end while&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;end for&amp;lt;/c&amp;gt; respectively.  MiniScript lacks a &amp;lt;c&amp;gt;repeat&amp;lt;/c&amp;gt;-&amp;lt;c&amp;gt;until&amp;lt;/c&amp;gt; structure; the standard idiom is to use a &amp;lt;c&amp;gt;while true&amp;lt;/c&amp;gt; (infinite) loop, and [[break]] out of it when termination conditions are met.&lt;br /&gt;
&lt;br /&gt;
=== Data Types ===&lt;br /&gt;
&lt;br /&gt;
Five of the seven basic types in Lua -- nil, number, string, function, and table -- have direct equivalents in MiniScript.  '''nil''' is called &amp;lt;c&amp;gt;[[null]]&amp;lt;/c&amp;gt; in MiniScript, and tables are called ''maps''.&lt;br /&gt;
&lt;br /&gt;
Strings in both languages are immutable.  MiniScript strings are Unicode, and index by Unicode character; interpretation of Lua strings is implementation-dependent, and index by byte.  While Lua has several ways of writing string literals, in MiniScript, string literals are always enclosed in double-quotes (and if you need a double-quote inside a string literal, write it twice, as in SQL).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;greeting = &amp;quot;Hello, &amp;quot;&amp;quot;Bob&amp;quot;&amp;quot;!  Pleased to meet you.&amp;quot;&lt;br /&gt;
print greeting   // prints: Hello, &amp;quot;Bob&amp;quot;!  Pleased to meet you.&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While MiniScript maps are conceptually quite similar to Lua tables, their syntax and usage is rather different; see the section on '''Maps''' under Differences.&lt;br /&gt;
&lt;br /&gt;
== Differences ==&lt;br /&gt;
&lt;br /&gt;
=== Variable Scope ===&lt;br /&gt;
&lt;br /&gt;
In Lua, variables are always global by default; you use the &amp;lt;c&amp;gt;local&amp;lt;/c&amp;gt; keyword to explicitly declare a local variable.  In MiniScript, variables are always local by default (and are never declared; they spring into being when you assign to them).  To update a global variable in MiniScript from within a function, you would use the [[globals]] or [[outer]] prefix.&lt;br /&gt;
&lt;br /&gt;
=== Lists ===&lt;br /&gt;
&lt;br /&gt;
Perhaps the biggest difference between Lua and Python is in handling of array-like data.  MiniScript has a '''list''' data type with no direct Lua equivalent.  Readers comfortable with [[Python]] should think of it as a Python-style list; others may find the following table helpful.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Task&lt;br /&gt;
! Lua&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| Create an array literal&lt;br /&gt;
| a = {&amp;quot;one&amp;quot;, &amp;quot;two&amp;quot;, &amp;quot;three&amp;quot;}&amp;lt;br /&amp;gt;&lt;br /&gt;
| a = [&amp;quot;zero&amp;quot;, &amp;quot;one&amp;quot;, &amp;quot;two&amp;quot;]&lt;br /&gt;
|-&lt;br /&gt;
| Print the first item in an array&amp;lt;br /&amp;gt;&lt;br /&gt;
| print(a[1])&lt;br /&gt;
| print a[0]&lt;br /&gt;
|-&lt;br /&gt;
| Print the entire array&lt;br /&gt;
| print(table.concat(a, &amp;quot;, &amp;quot;))&lt;br /&gt;
| print a&lt;br /&gt;
|-&lt;br /&gt;
| Get the length of an array&lt;br /&gt;
| print(#a)&lt;br /&gt;
| print a.len&lt;br /&gt;
|-&lt;br /&gt;
| Append an item to an array&lt;br /&gt;
| table.insert(a, &amp;quot;foo&amp;quot;)&amp;lt;br /&amp;gt;&lt;br /&gt;
| a.push &amp;quot;foo&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Insert item at front of array&lt;br /&gt;
| table.insert(a, 1, &amp;quot;hey&amp;quot;)&lt;br /&gt;
| a.insert 0, &amp;quot;hey&amp;quot;&lt;br /&gt;
|- style=&amp;quot;border-color:inherit;&amp;quot;&lt;br /&gt;
| Pop the last item off the array&lt;br /&gt;
| last = table.remove(a)&lt;br /&gt;
| last = a.pop&lt;br /&gt;
|- style=&amp;quot;border-color:inherit;&amp;quot;&lt;br /&gt;
| Pull the first item off the array&lt;br /&gt;
| first = table.remove(a, 1)&amp;lt;br /&amp;gt;&lt;br /&gt;
| first = a.pull&lt;br /&gt;
|- style=&amp;quot;border-color:inherit;&amp;quot;&lt;br /&gt;
| Remove item at index ''i''&lt;br /&gt;
| table.remove(a, i)&amp;lt;br /&amp;gt;&lt;br /&gt;
| a.remove i&lt;br /&gt;
|-&lt;br /&gt;
| Get index of an array item&lt;br /&gt;
| style=&amp;quot;font-style:italic;&amp;quot; | no standard method&lt;br /&gt;
| idx = a.indexOf(&amp;quot;two&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| Get sub-array from ''i'' to ''j''&lt;br /&gt;
| style=&amp;quot;font-style:italic;&amp;quot; | no standard method&lt;br /&gt;
| print a[i:j]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key differences to note:&lt;br /&gt;
* MiniScript lists are 0-based, rather than 1-based&lt;br /&gt;
* MiniScript lists are manipulated by [[Slice|slicing]] or [[Dot syntax|dot-syntax]] methods like &amp;lt;c&amp;gt;len&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;insert&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;remove&amp;lt;/c&amp;gt;, rather than by functions in the &amp;lt;c&amp;gt;table&amp;lt;/c&amp;gt; module.&lt;br /&gt;
* MiniScript lists can safely contain [[null]].&lt;br /&gt;
* MiniScript lists can be concatenated with the &amp;lt;c&amp;gt;+&amp;lt;/c&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
=== Maps ===&lt;br /&gt;
&lt;br /&gt;
Lua tables (when used as associative arrays, not list-style arrays) are similar in purpose to MiniScript maps, but there are a number of differences.&lt;br /&gt;
&lt;br /&gt;
Maps in MiniScript can take any data type as keys.  In map literals these keys use the same syntax as in any other context (unlike in Lua, where string keys are specified without quotes if they are valid identifiers, or with square brackets plus quotes otherwise).  Instead of &amp;lt;c&amp;gt;=&amp;lt;/c&amp;gt;, MiniScript uses &amp;lt;c&amp;gt;:&amp;lt;/c&amp;gt; to separate the keys from the values.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Lua&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;pre&amp;gt;d = {one=1, two=2, three=3, [&amp;quot;forty two&amp;quot;]=42}&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &amp;lt;ms&amp;gt;d = {&amp;quot;one&amp;quot;:1, &amp;quot;two&amp;quot;:2, &amp;quot;three&amp;quot;:3, &amp;quot;forty two&amp;quot;:42}&amp;lt;/ms&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Accessing items by key is done with square-brackets in both languages.  When the keys are valid identifiers, MiniScript also allows [[dot syntax]].&lt;br /&gt;
&amp;lt;ms&amp;gt;print d[&amp;quot;one&amp;quot;]&lt;br /&gt;
d[&amp;quot;one&amp;quot;] = &amp;quot;uno&amp;quot;&lt;br /&gt;
d.two = &amp;quot;dos&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Iterating over the key-value pairs is common in both languages, but the syntax is different.  In MiniScript, iterating over a map gives you, on each iteration, a little map containing &amp;lt;c&amp;gt;key&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;value&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Lua&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;pre&amp;gt;for k,v in pairs(d)&lt;br /&gt;
   do print(k,v)&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &amp;lt;ms&amp;gt;for kv in d&lt;br /&gt;
   print kv.key + &amp;quot; &amp;quot; + kv.value&lt;br /&gt;
end for&amp;lt;/ms&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Commonly used map methods include [[len]], [[remove]], [[hasIndex]], [[indexOf]], [[indexes]], and [[values]].  Note that [[len]] returns the number of key-value pairs in the map, which is different from both &amp;lt;c&amp;gt;getn&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;#&amp;lt;/c&amp;gt; in Lua.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;print &amp;quot;This map has &amp;quot; + d.len + &amp;quot; pairs in it.&amp;quot;&lt;br /&gt;
print &amp;quot;The keys are: &amp;quot; + d.indexes&lt;br /&gt;
print &amp;quot;and values are: &amp;quot; + d.values&lt;br /&gt;
if d.hasIndex(&amp;quot;two&amp;quot;) then&lt;br /&gt;
   print &amp;quot;&amp;quot;&amp;quot;two&amp;quot;&amp;quot; is one of the indexes, and its value is &amp;quot; + d[&amp;quot;two&amp;quot;]&lt;br /&gt;
else&lt;br /&gt;
   print &amp;quot;but &amp;quot;&amp;quot;two&amp;quot;&amp;quot; is not one of the indexes.&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
print &amp;quot;The index that maps to &amp;quot;&amp;quot;uno&amp;quot;&amp;quot; is: &amp;quot; + d.indexOf(&amp;quot;uno&amp;quot;)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maps can be combined with the `+` operator.&lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
Strings in MiniScript and Lua are similar in most ways, though in MiniScript, all strings are composed of Unicode characters and indexing is always by character rather than by byte.  The table below shows common operations in both languages.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Task&lt;br /&gt;
! Lua&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| Assign a string literal&lt;br /&gt;
| s = &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
| s = &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Print the first character of a string&amp;lt;br /&amp;gt;&lt;br /&gt;
| print(string.sub(s,1,1))&lt;br /&gt;
| print s[0]&lt;br /&gt;
|-&lt;br /&gt;
| Print all but the first 2 characters&lt;br /&gt;
| print(string.sub(s,3)&lt;br /&gt;
| print s[2:]&lt;br /&gt;
|-&lt;br /&gt;
| Get the length of a string&lt;br /&gt;
| print(#s)&lt;br /&gt;
| print s.len&lt;br /&gt;
|-&lt;br /&gt;
| Combine two strings&lt;br /&gt;
| s = &amp;quot;Really... &amp;quot; .. s&lt;br /&gt;
| s = &amp;quot;Really... &amp;quot; + s&lt;br /&gt;
|-&lt;br /&gt;
| Get index of a substring&lt;br /&gt;
| idx = string.find(s, &amp;quot;world&amp;quot;)&lt;br /&gt;
| idx = s.indexOf(&amp;quot;world&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| Get substring from ''i'' to ''j''&lt;br /&gt;
| print(string.sub(i,j))&lt;br /&gt;
| print s[i:j]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Community]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=User:Darryl5137&amp;diff=1425</id>
		<title>User:Darryl5137</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=User:Darryl5137&amp;diff=1425"/>
		<updated>2025-07-28T20:40:56Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Removed spam link.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;25 year-old Account Coordinator Bevon Edmundson, hailing from Keswick enjoys watching movies like Yumurta (Egg) and Air sports. Took a trip to San Marino Historic Centre and Mount Titano and drives a S40.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1423</id>
		<title>How to package a Mini Micro game</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1423"/>
		<updated>2025-07-27T13:11:14Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Packaging for the Web */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To &amp;quot;package&amp;quot; a [[Mini Micro]] game means to bundle up all the files into a format that end-users can download (or access on the web) and play without needing anything else.&lt;br /&gt;
&lt;br /&gt;
The basic idea is simple: Mini Micro will automatically look for a zip file (or folder) next to the executable called '''user.minidisk''', and if it finds this, it would automatically mount that as '''/usr''' and run any program it finds there as '''/usr/startup.ms'''.  So packaging amounts to taking a standard Mini Micro distribution, adding the desired '''user.minidisk''' file, and tweaking things like the app name and icon.  Exact details, though, vary with the platform you're targeting.&lt;br /&gt;
&lt;br /&gt;
Note that while the directions below include links to zip instructions/tools on the corresponding platform, it is ''not'' necessary to be on the platform you are packaging for.  In other words, it should work perfectly well to package for all platforms, from whatever platform you happen to use.  Also note that the first three steps in each section below are the same, and only need to be done once no matter how many platforms you package for.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Windows Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.laptopmag.com/articles/how-to-zip-files-windows-10 zip it].  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Windows distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''Mini Micro.exe''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''Mini Micro_Data/StreamingAssets''' subfolder.&lt;br /&gt;
# If you like, rename '''Mini Micro.exe''' to the name of your game. Note: Do not forget to change the folder '''Mini Micro_data''' to the name change with the exe with '''_data'''. example: '''strat.exe''', data folder would be '''strat_data'''.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the .exe, your '''user.minidisk''' file, and everything else that came with the original Windows distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for MacOS Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.lifewire.com/how-to-zip-and-unzip-files-and-folders-on-a-mac-2260188 zip it].  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the MacOS distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.app''' file.  (If you are doing this in Windows or Linux, '''MiniMicro.app''' will appear as a folder; on a Mac, the same folder appears as an app, and the .app extension may be hidden.)&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file, and place that inside the application bundle under '''Contents/Resources/Data/StreamingAssets'''.&lt;br /&gt;
# If you like, rename '''MiniMicro.app''' to the name of your game.&lt;br /&gt;
# Zip up (or place on a [https://support.apple.com/guide/disk-utility/create-a-disk-image-dskutl11888/mac disk image]) the whole folder containing the app and your '''user.minidisk''' file.&lt;br /&gt;
&lt;br /&gt;
The resulting zip or DMG can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Linux Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html zip it].  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Linux distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.x86_64''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''MiniMicro_Data/StreamingAssets''' folder.&lt;br /&gt;
# If you like, rename '''MiniMicro.x86_64''' to the name of your game.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the executable, your '''user.minidisk''' file, and everything else that came with the original Linux distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for the Web ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, zip the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the WebGL Template from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file into the  '''StreamingAssets''' folder, replacing the (empty) user.minidisk there in the template.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that next to '''user.minidisk'''.&lt;br /&gt;
# If uploading to itch.io, zip up the whole folder containing '''Build''', '''index.html''', and '''StreamingAssets'''.&lt;br /&gt;
# Upload that archive to itch.io, or upload the folder to your web site.  If asked for viewport dimensions, use 1024 by 768 pixels.&lt;br /&gt;
&lt;br /&gt;
== Common problems ==&lt;br /&gt;
&lt;br /&gt;
* When making your '''user.minidisk''' file from a mounted folder, make sure you zip the ''contents'' of the folder, not the folder itself.&lt;br /&gt;
* Also be sure the result is actually named '''user.minidisk''', rather than '''user.minidisk.zip'''.  (Some file managers will try to &amp;quot;helpfully&amp;quot; keep the .zip extension, and just hide it from you in the UI; use a terminal window to be sure.)&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Apps_using_MiniScript&amp;diff=1414</id>
		<title>Apps using MiniScript</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Apps_using_MiniScript&amp;diff=1414"/>
		<updated>2025-05-27T14:13:59Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is an (incomplete) list of games and other applications (other than [[Mini Micro]]) that use MiniScript in some way that's exposed to players/end-users.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/1383570/Ballex2_The_Hanging_Gardens/ Ballex²: The Hanging Gardens]: ball-rolling skill/puzzle game.  MiniScript is used in the creation of custom levels.&lt;br /&gt;
&lt;br /&gt;
* [[Farmtronics]]: mod for Stardew Valley that adds a MiniScript-programmable home computer and farm robots.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/2027330/GoreBox/ GoreBox]: 3D physics-based sandbox game.  Uses MiniScript in the creation of custom levels.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/605230/Grey_Hack/ Grey Hack]: massively multiplayer online hacking game.  Uses MiniScript extensively as the built-in scripting language, a central part of the gameplay experience.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/2312770/Linkito/ Linkito]: gadget-building puzzle game.  MiniScript is used for advanced programmable components.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/2809460/Terminal_ESC/ Terminal/ESC]: puzzle game in a simulated computer that uses MiniScript as the programming language.&lt;br /&gt;
&lt;br /&gt;
* [https://machiaworx.net/?p=914 Re:Code]: live-coding music sequencing software; write MiniScript code to make music in real time!  ([https://www.youtube.com/watch?v=g52rHtOzGnI Demo Movie])&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/3384560/Pastopia_Demo/ Pastopia]: Third-person, open-world adventure where MiniScript coding unlocks the secrets of a forgotten world.&lt;br /&gt;
&lt;br /&gt;
[[Category:Community]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sound&amp;diff=1410</id>
		<title>Sound</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sound&amp;diff=1410"/>
		<updated>2025-04-12T17:07:41Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Methods and properties used with Sound objects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], the &amp;lt;msinline&amp;gt;Sound&amp;lt;/msinline&amp;gt; class both represents individual audio clips that can be played, and a handful of global sound-related properties and methods.&lt;br /&gt;
&lt;br /&gt;
=== Methods and properties called on Sound ===&lt;br /&gt;
&lt;br /&gt;
Use the following properties and methods directly on the Sound class itself.&lt;br /&gt;
&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;
| [[Sound.sineWave]] || represents a sine wave (pure tone)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.triangleWave]] || represents a triangle wave (almost pure)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.sawtoothWave]] || represents a sawtooth wave (slightly &amp;quot;buzzier&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.squareWave]] || represents a square wave (most buzzy/retro sound)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.noiseWave]] || creates a pseudo-random &amp;quot;static&amp;quot; waveform&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.stopAll]] || stops all currently playing sounds&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Methods and properties used with Sound objects ===&lt;br /&gt;
&lt;br /&gt;
Use these methods on Sound instances, created with &amp;lt;c&amp;gt;[[new]] Sound&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;[[file.loadSound]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&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;
| [[Sound.duration]] || length of the sound, in seconds&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.freq]] || sound frequency, i.e. how many times the waveform is repeated per second&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.envelope]] || volume over time (0 to 1)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.waveform]] || shape of waveform over an audio cycle&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.fadeIn]] || length of the fade-in period when the sound begins, in seconds&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.fadeOut]] || length of the fade-out period when the sound ends, in seconds&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.loop]] || true (1) to set the sound to repeat indefinitely until stopped&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.init]] ''duration'',''freq'',''envelope'',''waveform'' || initialize a sound with the given parameters&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.mix]] ''sound2'',''level'' || add another synthesized sound into this one&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.play]] ''volume'',''pan'',''speed'' || play this sound (looping if [[Sound.loop|.loop]] is true)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.adjust]] ''volume'',''pan'',''speed'' || change volume/pan/speed of a playing sound&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.isPlaying]] || returns true (1) while sound is playing, false (0) otherwise&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.stop]] || stop playing this sound&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also: &amp;lt;c&amp;gt;[[file.loadSound]]&amp;lt;/c&amp;gt;; &amp;lt;c&amp;gt;[[noteFreq]]&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Soda]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Bibliography&amp;diff=1408</id>
		<title>Bibliography</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Bibliography&amp;diff=1408"/>
		<updated>2025-04-10T03:23:45Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Blog Posts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists published articles that include some nontrivial mention of MiniScript or Mini Micro.&lt;br /&gt;
&lt;br /&gt;
== Primary Sources ==&lt;br /&gt;
&lt;br /&gt;
Primary sources are those written by people directly involved.  Currently, that mostly means things written by [[User:JoeStrout|Joe Strout]].&lt;br /&gt;
&lt;br /&gt;
=== Books ===&lt;br /&gt;
&lt;br /&gt;
* Strout, J (2020). ''Learn to Code in 30 Days: with MiniScript and Mini Micro''.  MiniScript Press. ISBN 978-1-7361676-0-1.  (Also available as ebook: ISBN 978-1-7361676-2-5.)&lt;br /&gt;
&lt;br /&gt;
* Strout, J (2021). ''Introduction to Computer Programming: for kids of all ages''.  MiniScript Press.  ISBN 978-1-7361676-1-8.&lt;br /&gt;
&lt;br /&gt;
=== Articles &amp;amp; Conference Proceedings ===&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://ieeexplore.ieee.org/document/9625108 MiniScript: A new language for computer programming education.]&amp;quot; [http://istem-ed.com/istem-ed2021/ iSTEM-Ed] (2021). (preprint [https://miniscript.org/files/Strout_iSTEM-Ed2021.pdf PDF])&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-coding-introduction/ Introducing Mini Micro]&amp;quot; [https://beanzmag.com/ Beanz Magazine] February 2022, p. 8-9.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-stars-experiment/ Experimental Coding]&amp;quot; [https://beanzmag.com/ Beanz Magazine] April 2022, p. 24-25.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-space-game-project/ An Apple a Day...]&amp;quot; [https://beanzmag.com/ Beanz Magazine] June 2022, p. 13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-clock-timer/ Make a Clock Timer]&amp;quot; [https://beanzmag.com/ Beanz Magazine] August 2022, p. 13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-secret-message-rot13/ Loopy Secret Messages] [https://beanzmag.com/ Beanz Magazine] October 2022, p. 12-13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics/ Auto-Code in Stardew Valley]&amp;quot; [https://beanzmag.com/ Beanz Magazine] December 2022, p. 4-5.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics-gardening-howto/ A Bot “Outstanding in its Field”]&amp;quot; [https://beanzmag.com/ Beanz Magazine] February 2023&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics-finding-your-way/ Finding Your Way]&amp;quot; [https://beanzmag.com/ Beanz Magazine] April 2023&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/minimicro-project-find-objects/ Explore Mars like a Rover]&amp;quot; [https://beanzmag.com/ Beanz Magazine] June 2023&lt;br /&gt;
&lt;br /&gt;
=== Blog Posts ===&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Why MiniScript?&amp;quot; Luminary Apps, 06 Sep. 2019, https://luminaryapps.com/blog/miniscript-why/.  Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;VT100 Escape Codes in Command-Line MiniScript&amp;quot; Luminary Apps, 03 Oct. 2021, https://luminaryapps.com/blog/vt100-codes/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Debugging with a Validate Method&amp;quot; Luminary Apps, 01 Nov. 2021, https://luminaryapps.com/blog/validate/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;String Fill and Match&amp;quot; Luminary Apps, 10 Jun. 2022, https://luminaryapps.com/blog/ms-fill-match/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Advanced Tricks with Import&amp;quot; Luminary Apps, 16 Jun. 2022, https://luminaryapps.com/blog/advanced-import/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Use GPT-3 in Mini Micro&amp;quot; Dev.to, 21 Dec. 2022, https://dev.to/joestrout/use-gpt-3-in-mini-micro-1h63.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Advent of Code 2022 Wrap-Up&amp;quot; Dev.to, 13 Jan. 2023, https://dev.to/joestrout/advent-of-code-2022-wrap-up-2402.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Image Artsification in Mini Micro&amp;quot; Dev.to, 15 Jan. 2023, https://dev.to/joestrout/image-artsification-in-mini-micro-3fh0.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Make a `rerun` command for Mini Micro&amp;quot; Dev.to, 21 Jan. 2023, https://dev.to/joestrout/make-a-rerun-command-for-mini-micro-30h1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript 1.6 Now Available&amp;quot; Dev.to, 6 Feb. 2023, https://dev.to/joestrout/miniscript-16-now-available-fc7.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;What's New in Command-Line MiniScript v1.2&amp;quot; Dev.to, 9 Feb. 2023, https://dev.to/joestrout/whats-new-in-command-line-miniscript-v12-4ce9.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript v1.6.1&amp;quot; Dev.to, 1 Jul. 2023, https://dev.to/joestrout/miniscript-v161-jka.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Customizing the Mini Micro code editor&amp;quot; Dev.to, 5 Jul. 2023, https://dev.to/joestrout/customizing-the-mini-micro-code-editor-6ji.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Converting 100 Classic BASIC Games to MiniScript&amp;quot; Dev.to, 25 Aug. 2023, https://dev.to/joestrout/converting-100-classic-basic-games-to-miniscript-4p3g.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;100 BASIC Computer Games, Ported to MiniScript&amp;quot; Dev.to, 24 Oct. 2023, https://dev.to/joestrout/100-basic-computer-games-ported-to-miniscript-3oj3.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;&amp;quot;MiniScript Mentor&amp;quot; GPT&amp;quot; Dev.to, 13 Nov. 2023, https://dev.to/joestrout/miniscript-mentor-gpt-9ig.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Join the MiniScript &amp;quot;Advent of Code&amp;quot; contest!&amp;quot; Dev.to, 29 Nov. 2023, https://dev.to/joestrout/join-the-miniscript-advent-of-code-contest-3gm5.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Using textures from /sys/pics/textures&amp;quot; Dev.to, 24 Jan. 2024, https://dev.to/joestrout/using-textures-from-syspicstextures-478m.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Demo Highlight: Asteroids&amp;quot; Dev.to, 31 Jan. 2024, https://dev.to/joestrout/demo-highlight-asteroids-250d.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript Ports&amp;quot; Dev.to, 7 Feb. 2024, https://dev.to/joestrout/miniscript-ports-jp9.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Announcing Command-Line MiniScript 1.3 (with `exec`!)&amp;quot; Dev.to, 19 Feb. 2024, https://dev.to/joestrout/announcing-command-line-miniscript-13-with-exec-477b.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript on a bare-metal Raspberry Pi&amp;quot; Dev.to, 2 Mar. 2024, https://dev.to/joestrout/miniscript-on-a-bare-metal-raspberry-pi-59p6.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Off-screen displays in Mini Micro&amp;quot; Dev.to, 6 Mar. 2024, https://dev.to/joestrout/off-screen-displays-in-mini-micro-41mb.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Announcing Mini Micro 1.2.1&amp;quot; Dev.to, 3 Apr. 2024, https://dev.to/joestrout/announcing-mini-micro-121-5e3n.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript and Micro Jam Join Forces for Mega Fun&amp;quot; Dev.to, 10 Apr. 2024, https://dev.to/joestrout/miniscript-and-micro-jam-join-forces-for-mega-fun-2b9c.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Text entry tricks in Mini Micro&amp;quot; Dev.to, 17 Apr. 2024, https://dev.to/joestrout/text-entry-tricks-in-mini-micro-1p65.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;The making of Kip and the Caves of Lava&amp;quot; Dev.to, 8 May 2024, https://dev.to/joestrout/the-making-of-kip-and-the-caves-of-lava-mk3.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Demo highlight: cardFlip&amp;quot; Dev.to, 19 May 2024, https://dev.to/joestrout/demo-highlight-cardflip-26o1.  Accessed 19 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Version Checking in MiniScript&amp;quot; Dev.to, 20 Jun 2024, https://dev.to/joestrout/version-checking-in-miniscript-gob.  Accessed 20 Jun 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe.  &amp;quot;Make a digital clock in Mini Micro&amp;quot; Dev.to, 03 Jul 2024, https://dev.to/joestrout/make-a-digital-clock-in-mini-micro-3mpl.  Accessed 03 Jul 2024&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Learn X in Y Minutes: MiniScript&amp;quot;: https://learnxinyminutes.com/docs/miniscript/.  Access 20 Jun 2024&lt;br /&gt;
&lt;br /&gt;
== Secondary Sources ==&lt;br /&gt;
&lt;br /&gt;
Secondary sources are those written by people not directly involved in the work.&lt;br /&gt;
&lt;br /&gt;
=== Magazine/Journal Articles ===&lt;br /&gt;
&lt;br /&gt;
* Slavin, Tom. &amp;quot;Make a Mini Micro Collection Game.&amp;quot;  ''Beanz'' Vol. 11, No. 3, Dec 2023. Also available online at https://kidscodecs.com/mini-micro-space-game/ (accessed 12 Dec 2023).&lt;br /&gt;
&lt;br /&gt;
=== Blog Posts ===&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. “Neo-Retro Computing.” Dev.to, 20 Nov. 2021, https://dev.to/sebnozzi/about-mini-micro-short-1g0e. Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* TopaAzul062. &amp;quot;Review of Learn to Code in 30 Days.&amp;quot; OnlineBookClub.org, 21 Oct. 2021, https://forums.onlinebookclub.org/viewtopic.php?f=24&amp;amp;t=205860.  Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* Khorne. &amp;quot;Where to begin, where to start?&amp;quot; Khornes MiniScript Journey, 2 Mar. 2022, https://khornemsjourney.blogspot.com/2023/07/where-to-begin-where-to-start.html.  Accessed 2 Aug. 2023.  (Originally located [https://khornems.blogspot.com/2022/03/where-to-begin-where-to-start.html here].)&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Counting 5-letter words&amp;quot; Dev.to, 25 Oct.2022, https://dev.to/sebnozzi/counting-5-letter-words-2cdo.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Most common word length&amp;quot; Dev.to, 26 Oct. 2022, https://dev.to/sebnozzi/most-common-word-length-e7e.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Counting word lengths (map approach)&amp;quot; Dev.to, 26 Oct. 2022, https://dev.to/sebnozzi/counting-word-lengths-map-approach-43p1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Kratt, Max. &amp;quot;Launch in Mini Micro&amp;quot;. Max Kratt's blog, 19 Jan. 2023, https://maxkratt.hashnode.dev/launch-in-mini-micro&lt;br /&gt;
&lt;br /&gt;
* Tomes, Trey. “Fluent Interfaces.”  Micro-Hack wiki, 30 Mar. 2023, https://github.com/treytomes/micro-hack/wiki/Fluent-Interfaces&lt;br /&gt;
&lt;br /&gt;
* Quinn. &amp;quot;Unleashing Creativity with Mini Micro: Code Games and More with MiniScript&amp;quot; Dev.to, 4 Aug. 2023, https://dev.to/midsubspace/unleashing-creativity-with-mini-micro-code-games-and-more-with-miniscript-2djm.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Quinn. &amp;quot;Getting Started with Farmtronics&amp;quot; Quinn's Blog, 12 Aug. 2023, https://midsubspace.hashnode.dev/getting-started-with-farmtronics&lt;br /&gt;
&lt;br /&gt;
* Lefebvre, Paul.  &amp;quot;Mini Micro and MiniScript: A Great Retro Programming Combination.&amp;quot;  Goto 10 RetroComputing, 22 Sep. 2023, https://www.goto10retro.com/p/mini-micro-and-miniscript-a-great.  Accessed 22 Sep. 2023.&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell.  &amp;quot;MiniScript Roundup #1&amp;quot; Dev.to, 8 Oct. 2023, https://dev.to/synapticbytes/miniscript-roundup-1-a7n.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell. &amp;quot;Designing the MiniScript to Godot Framework&amp;quot; Dev.to, 9 Oct. 2023, https://dev.to/synapticbytes/designing-the-miniscript-to-godot-framework-3jm1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell. &amp;quot;MiniScript in Godot Progress Report #1&amp;quot; Dev.to, 13 Oct. 2023, https://dev.to/synapticbytes/minscript-in-godot-progress-report-1-5bg1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Coin Collector Game&amp;quot; Dev.to, 4 May 2024, https://dev.to/sebnozzi/coin-collector-1lh6.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Why Miniscript&amp;quot; Dev.to, 27 Feb. 2025, https://dev.to/selfish_dev/why-miniscript-13fi.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to render a sprite in Mini Micro&amp;quot; Dev.to, 4 Mar. 2025, https://dev.to/selfish_dev/how-to-render-a-sprite-in-mini-micro-h03.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to register sprite clicks in mini micro&amp;quot; Dev.to, 8 Mar. 2025, https://dev.to/selfish_dev/how-to-register-sprite-clicks-in-mini-micro-2j42.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Bounds In Mini Micro&amp;quot; Dev.to, 7 Mar. 2025, https://dev.to/selfish_dev/bounds-in-mini-micro-3pl1.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;WTF Mini Micro!&amp;quot; Dev.to, 13 Mar. 2025, https://dev.to/selfish_dev/wtf-mini-micro-6j5.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Mini-Micro : Physics , Fixes and WTF&amp;quot; Dev.to, 15 Mar. 2025, https://dev.to/selfish_dev/mini-micro-physics-fixes-and-wtf-3gc4.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to load a sprite from web&amp;quot; Dev.to, 28 Mar. 2025, https://dev.to/selfish_dev/how-to-load-a-sprite-from-web-1kcp.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Mini Micro and the 6502: Adding retro to the neo-retro&amp;quot; Dev.to, 12 Mar. 2025, https://dev.to/bibleclinger/mini-micro-and-the-6502-adding-retro-to-the-neo-retro-3mgh.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Mini Micro and the 6502: Adding Keyboard Input&amp;quot; Dev.to, 16 Mar. 2025, https://dev.to/bibleclinger/mini-micro-and-the-6502-adding-keyboard-input-1cjm.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Does MiniScript Need Variadic Functions?&amp;quot; Dev.to, 13 Mar. 2025, https://dev.to/bibleclinger/does-miniscript-need-variadic-functions-53a0.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;MiniScript's Parent-Class Variable Pitfall&amp;quot; Dev.to, 14 Mar. 2025, https://dev.to/bibleclinger/miniscripts-parent-class-variable-pitfall-4koi.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;MiniScript's locals, outer, and globals&amp;quot; Dev.to, 6 Apr. 2025, https://dev.to/bibleclinger/miniscripts-locals-outer-and-globals-1pcn.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Kinggd. &amp;quot;How I Made Drag-and-Drop Physics in Mini Micro&amp;quot; https://medium.com/@kinggd2424, 9 Apr. 2025,&lt;br /&gt;
&lt;br /&gt;
=== Pro Journalism ===&lt;br /&gt;
&lt;br /&gt;
* Stanton, Rich.  &amp;quot;Stardew Valley mod adds farming bots.&amp;quot; PC Gamer, 01 Jan. 2022, https://www.pcgamer.com/stardew-valley-mod-adds-farming-bots/&lt;br /&gt;
&lt;br /&gt;
[[Category:Community]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Bibliography&amp;diff=1407</id>
		<title>Bibliography</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Bibliography&amp;diff=1407"/>
		<updated>2025-04-10T03:23:05Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Blog Posts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists published articles that include some nontrivial mention of MiniScript or Mini Micro.&lt;br /&gt;
&lt;br /&gt;
== Primary Sources ==&lt;br /&gt;
&lt;br /&gt;
Primary sources are those written by people directly involved.  Currently, that mostly means things written by [[User:JoeStrout|Joe Strout]].&lt;br /&gt;
&lt;br /&gt;
=== Books ===&lt;br /&gt;
&lt;br /&gt;
* Strout, J (2020). ''Learn to Code in 30 Days: with MiniScript and Mini Micro''.  MiniScript Press. ISBN 978-1-7361676-0-1.  (Also available as ebook: ISBN 978-1-7361676-2-5.)&lt;br /&gt;
&lt;br /&gt;
* Strout, J (2021). ''Introduction to Computer Programming: for kids of all ages''.  MiniScript Press.  ISBN 978-1-7361676-1-8.&lt;br /&gt;
&lt;br /&gt;
=== Articles &amp;amp; Conference Proceedings ===&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://ieeexplore.ieee.org/document/9625108 MiniScript: A new language for computer programming education.]&amp;quot; [http://istem-ed.com/istem-ed2021/ iSTEM-Ed] (2021). (preprint [https://miniscript.org/files/Strout_iSTEM-Ed2021.pdf PDF])&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-coding-introduction/ Introducing Mini Micro]&amp;quot; [https://beanzmag.com/ Beanz Magazine] February 2022, p. 8-9.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-stars-experiment/ Experimental Coding]&amp;quot; [https://beanzmag.com/ Beanz Magazine] April 2022, p. 24-25.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-space-game-project/ An Apple a Day...]&amp;quot; [https://beanzmag.com/ Beanz Magazine] June 2022, p. 13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-clock-timer/ Make a Clock Timer]&amp;quot; [https://beanzmag.com/ Beanz Magazine] August 2022, p. 13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-secret-message-rot13/ Loopy Secret Messages] [https://beanzmag.com/ Beanz Magazine] October 2022, p. 12-13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics/ Auto-Code in Stardew Valley]&amp;quot; [https://beanzmag.com/ Beanz Magazine] December 2022, p. 4-5.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics-gardening-howto/ A Bot “Outstanding in its Field”]&amp;quot; [https://beanzmag.com/ Beanz Magazine] February 2023&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics-finding-your-way/ Finding Your Way]&amp;quot; [https://beanzmag.com/ Beanz Magazine] April 2023&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/minimicro-project-find-objects/ Explore Mars like a Rover]&amp;quot; [https://beanzmag.com/ Beanz Magazine] June 2023&lt;br /&gt;
&lt;br /&gt;
=== Blog Posts ===&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Why MiniScript?&amp;quot; Luminary Apps, 06 Sep. 2019, https://luminaryapps.com/blog/miniscript-why/.  Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;VT100 Escape Codes in Command-Line MiniScript&amp;quot; Luminary Apps, 03 Oct. 2021, https://luminaryapps.com/blog/vt100-codes/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Debugging with a Validate Method&amp;quot; Luminary Apps, 01 Nov. 2021, https://luminaryapps.com/blog/validate/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;String Fill and Match&amp;quot; Luminary Apps, 10 Jun. 2022, https://luminaryapps.com/blog/ms-fill-match/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Advanced Tricks with Import&amp;quot; Luminary Apps, 16 Jun. 2022, https://luminaryapps.com/blog/advanced-import/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Use GPT-3 in Mini Micro&amp;quot; Dev.to, 21 Dec. 2022, https://dev.to/joestrout/use-gpt-3-in-mini-micro-1h63.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Advent of Code 2022 Wrap-Up&amp;quot; Dev.to, 13 Jan. 2023, https://dev.to/joestrout/advent-of-code-2022-wrap-up-2402.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Image Artsification in Mini Micro&amp;quot; Dev.to, 15 Jan. 2023, https://dev.to/joestrout/image-artsification-in-mini-micro-3fh0.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Make a `rerun` command for Mini Micro&amp;quot; Dev.to, 21 Jan. 2023, https://dev.to/joestrout/make-a-rerun-command-for-mini-micro-30h1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript 1.6 Now Available&amp;quot; Dev.to, 6 Feb. 2023, https://dev.to/joestrout/miniscript-16-now-available-fc7.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;What's New in Command-Line MiniScript v1.2&amp;quot; Dev.to, 9 Feb. 2023, https://dev.to/joestrout/whats-new-in-command-line-miniscript-v12-4ce9.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript v1.6.1&amp;quot; Dev.to, 1 Jul. 2023, https://dev.to/joestrout/miniscript-v161-jka.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Customizing the Mini Micro code editor&amp;quot; Dev.to, 5 Jul. 2023, https://dev.to/joestrout/customizing-the-mini-micro-code-editor-6ji.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Converting 100 Classic BASIC Games to MiniScript&amp;quot; Dev.to, 25 Aug. 2023, https://dev.to/joestrout/converting-100-classic-basic-games-to-miniscript-4p3g.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;100 BASIC Computer Games, Ported to MiniScript&amp;quot; Dev.to, 24 Oct. 2023, https://dev.to/joestrout/100-basic-computer-games-ported-to-miniscript-3oj3.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;&amp;quot;MiniScript Mentor&amp;quot; GPT&amp;quot; Dev.to, 13 Nov. 2023, https://dev.to/joestrout/miniscript-mentor-gpt-9ig.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Join the MiniScript &amp;quot;Advent of Code&amp;quot; contest!&amp;quot; Dev.to, 29 Nov. 2023, https://dev.to/joestrout/join-the-miniscript-advent-of-code-contest-3gm5.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Using textures from /sys/pics/textures&amp;quot; Dev.to, 24 Jan. 2024, https://dev.to/joestrout/using-textures-from-syspicstextures-478m.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Demo Highlight: Asteroids&amp;quot; Dev.to, 31 Jan. 2024, https://dev.to/joestrout/demo-highlight-asteroids-250d.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript Ports&amp;quot; Dev.to, 7 Feb. 2024, https://dev.to/joestrout/miniscript-ports-jp9.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Announcing Command-Line MiniScript 1.3 (with `exec`!)&amp;quot; Dev.to, 19 Feb. 2024, https://dev.to/joestrout/announcing-command-line-miniscript-13-with-exec-477b.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript on a bare-metal Raspberry Pi&amp;quot; Dev.to, 2 Mar. 2024, https://dev.to/joestrout/miniscript-on-a-bare-metal-raspberry-pi-59p6.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Off-screen displays in Mini Micro&amp;quot; Dev.to, 6 Mar. 2024, https://dev.to/joestrout/off-screen-displays-in-mini-micro-41mb.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Announcing Mini Micro 1.2.1&amp;quot; Dev.to, 3 Apr. 2024, https://dev.to/joestrout/announcing-mini-micro-121-5e3n.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript and Micro Jam Join Forces for Mega Fun&amp;quot; Dev.to, 10 Apr. 2024, https://dev.to/joestrout/miniscript-and-micro-jam-join-forces-for-mega-fun-2b9c.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Text entry tricks in Mini Micro&amp;quot; Dev.to, 17 Apr. 2024, https://dev.to/joestrout/text-entry-tricks-in-mini-micro-1p65.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;The making of Kip and the Caves of Lava&amp;quot; Dev.to, 8 May 2024, https://dev.to/joestrout/the-making-of-kip-and-the-caves-of-lava-mk3.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Demo highlight: cardFlip&amp;quot; Dev.to, 19 May 2024, https://dev.to/joestrout/demo-highlight-cardflip-26o1.  Accessed 19 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Version Checking in MiniScript&amp;quot; Dev.to, 20 Jun 2024, https://dev.to/joestrout/version-checking-in-miniscript-gob.  Accessed 20 Jun 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe.  &amp;quot;Make a digital clock in Mini Micro&amp;quot; Dev.to, 03 Jul 2024, https://dev.to/joestrout/make-a-digital-clock-in-mini-micro-3mpl.  Accessed 03 Jul 2024&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Learn X in Y Minutes: MiniScript&amp;quot;: https://learnxinyminutes.com/docs/miniscript/.  Access 20 Jun 2024&lt;br /&gt;
&lt;br /&gt;
== Secondary Sources ==&lt;br /&gt;
&lt;br /&gt;
Secondary sources are those written by people not directly involved in the work.&lt;br /&gt;
&lt;br /&gt;
=== Magazine/Journal Articles ===&lt;br /&gt;
&lt;br /&gt;
* Slavin, Tom. &amp;quot;Make a Mini Micro Collection Game.&amp;quot;  ''Beanz'' Vol. 11, No. 3, Dec 2023. Also available online at https://kidscodecs.com/mini-micro-space-game/ (accessed 12 Dec 2023).&lt;br /&gt;
&lt;br /&gt;
=== Blog Posts ===&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. “Neo-Retro Computing.” Dev.to, 20 Nov. 2021, https://dev.to/sebnozzi/about-mini-micro-short-1g0e. Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* TopaAzul062. &amp;quot;Review of Learn to Code in 30 Days.&amp;quot; OnlineBookClub.org, 21 Oct. 2021, https://forums.onlinebookclub.org/viewtopic.php?f=24&amp;amp;t=205860.  Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* Khorne. &amp;quot;Where to begin, where to start?&amp;quot; Khornes MiniScript Journey, 2 Mar. 2022, https://khornemsjourney.blogspot.com/2023/07/where-to-begin-where-to-start.html.  Accessed 2 Aug. 2023.  (Originally located [https://khornems.blogspot.com/2022/03/where-to-begin-where-to-start.html here].)&lt;br /&gt;
&lt;br /&gt;
* Sebastian Nozzi &amp;quot;Counting 5-letter words&amp;quot; Dev.to, 25 Oct.2022, https://dev.to/sebnozzi/counting-5-letter-words-2cdo.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Sebastian Nozzi &amp;quot;Most common word length&amp;quot; Dev.to, 26 Oct. 2022, https://dev.to/sebnozzi/most-common-word-length-e7e.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Sebastian Nozzi &amp;quot;Counting word lengths (map approach)&amp;quot; Dev.to, 26 Oct. 2022, https://dev.to/sebnozzi/counting-word-lengths-map-approach-43p1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Kratt, Max. &amp;quot;Launch in Mini Micro&amp;quot;. Max Kratt's blog, 19 Jan. 2023, https://maxkratt.hashnode.dev/launch-in-mini-micro&lt;br /&gt;
&lt;br /&gt;
* Tomes, Trey. “Fluent Interfaces.”  Micro-Hack wiki, 30 Mar. 2023, https://github.com/treytomes/micro-hack/wiki/Fluent-Interfaces&lt;br /&gt;
&lt;br /&gt;
* Quinn. &amp;quot;Unleashing Creativity with Mini Micro: Code Games and More with MiniScript&amp;quot; Dev.to, 4 Aug. 2023, https://dev.to/midsubspace/unleashing-creativity-with-mini-micro-code-games-and-more-with-miniscript-2djm.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Quinn. &amp;quot;Getting Started with Farmtronics&amp;quot; Quinn's Blog, 12 Aug. 2023, https://midsubspace.hashnode.dev/getting-started-with-farmtronics&lt;br /&gt;
&lt;br /&gt;
* Lefebvre, Paul.  &amp;quot;Mini Micro and MiniScript: A Great Retro Programming Combination.&amp;quot;  Goto 10 RetroComputing, 22 Sep. 2023, https://www.goto10retro.com/p/mini-micro-and-miniscript-a-great.  Accessed 22 Sep. 2023.&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell.  &amp;quot;MiniScript Roundup #1&amp;quot; Dev.to, 8 Oct. 2023, https://dev.to/synapticbytes/miniscript-roundup-1-a7n.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell. &amp;quot;Designing the MiniScript to Godot Framework&amp;quot; Dev.to, 9 Oct. 2023, https://dev.to/synapticbytes/designing-the-miniscript-to-godot-framework-3jm1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell. &amp;quot;MiniScript in Godot Progress Report #1&amp;quot; Dev.to, 13 Oct. 2023, https://dev.to/synapticbytes/minscript-in-godot-progress-report-1-5bg1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Coin Collector Game&amp;quot; Dev.to, 4 May 2024, https://dev.to/sebnozzi/coin-collector-1lh6.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Why Miniscript&amp;quot; Dev.to, 27 Feb. 2025, https://dev.to/selfish_dev/why-miniscript-13fi.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to render a sprite in Mini Micro&amp;quot; Dev.to, 4 Mar. 2025, https://dev.to/selfish_dev/how-to-render-a-sprite-in-mini-micro-h03.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to register sprite clicks in mini micro&amp;quot; Dev.to, 8 Mar. 2025, https://dev.to/selfish_dev/how-to-register-sprite-clicks-in-mini-micro-2j42.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Bounds In Mini Micro&amp;quot; Dev.to, 7 Mar. 2025, https://dev.to/selfish_dev/bounds-in-mini-micro-3pl1.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;WTF Mini Micro!&amp;quot; Dev.to, 13 Mar. 2025, https://dev.to/selfish_dev/wtf-mini-micro-6j5.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Mini-Micro : Physics , Fixes and WTF&amp;quot; Dev.to, 15 Mar. 2025, https://dev.to/selfish_dev/mini-micro-physics-fixes-and-wtf-3gc4.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to load a sprite from web&amp;quot; Dev.to, 28 Mar. 2025, https://dev.to/selfish_dev/how-to-load-a-sprite-from-web-1kcp.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Mini Micro and the 6502: Adding retro to the neo-retro&amp;quot; Dev.to, 12 Mar. 2025, https://dev.to/bibleclinger/mini-micro-and-the-6502-adding-retro-to-the-neo-retro-3mgh.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Mini Micro and the 6502: Adding Keyboard Input&amp;quot; Dev.to, 16 Mar. 2025, https://dev.to/bibleclinger/mini-micro-and-the-6502-adding-keyboard-input-1cjm.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Does MiniScript Need Variadic Functions?&amp;quot; Dev.to, 13 Mar. 2025, https://dev.to/bibleclinger/does-miniscript-need-variadic-functions-53a0.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;MiniScript's Parent-Class Variable Pitfall&amp;quot; Dev.to, 14 Mar. 2025, https://dev.to/bibleclinger/miniscripts-parent-class-variable-pitfall-4koi.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;MiniScript's locals, outer, and globals&amp;quot; Dev.to, 6 Apr. 2025, https://dev.to/bibleclinger/miniscripts-locals-outer-and-globals-1pcn.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Kinggd. &amp;quot;How I Made Drag-and-Drop Physics in Mini Micro&amp;quot; https://medium.com/@kinggd2424, 9 Apr. 2025,&lt;br /&gt;
&lt;br /&gt;
=== Pro Journalism ===&lt;br /&gt;
&lt;br /&gt;
* Stanton, Rich.  &amp;quot;Stardew Valley mod adds farming bots.&amp;quot; PC Gamer, 01 Jan. 2022, https://www.pcgamer.com/stardew-valley-mod-adds-farming-bots/&lt;br /&gt;
&lt;br /&gt;
[[Category:Community]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Color.lerp&amp;diff=1370</id>
		<title>Color.lerp</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Color.lerp&amp;diff=1370"/>
		<updated>2025-03-29T13:58:01Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;color.lerp&amp;lt;/c&amp;gt; is a method that implements linear interpolation between two colors. It is commonly used for changing colors over time or painting gradients.&lt;br /&gt;
&lt;br /&gt;
(The term &amp;quot;lerp&amp;quot; is short for &amp;quot;linear interpolate&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The method has this signature: &amp;lt;c&amp;gt;color.lerp c1, c2, t&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter !! Description&lt;br /&gt;
|-&lt;br /&gt;
| c1|| First color in hexcolor format&lt;br /&gt;
|-&lt;br /&gt;
| c2|| Second color in hexcolor format&lt;br /&gt;
|-&lt;br /&gt;
| t|| Variable for how far to interpolate between the two colors (t &amp;lt;= 0 retunrs c1, t &amp;gt;= 0 returns c2, 0 &amp;lt; t &amp;lt; 1 returns color inbetween)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
color.lerp color.red, color.blue, 0&lt;br /&gt;
 #FF0000FF&lt;br /&gt;
color.lerp color.red, color.blue, 1&lt;br /&gt;
 #0000FFFF&lt;br /&gt;
color.lerp color.red, color.blue, 0.5&lt;br /&gt;
 #7F007FFF&lt;br /&gt;
color.lerp color.red, color.blue, 0.25&lt;br /&gt;
 #BF003FFF&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[Color]], [[MathUtil]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Env&amp;diff=1367</id>
		<title>Env</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Env&amp;diff=1367"/>
		<updated>2025-03-24T21:15:11Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;env&amp;lt;/c&amp;gt; is a built-in map in [[Mini Micro]], [[Farmtronics]], and [[command-line MiniScript]].  It has somewhat different meaning and usage in each environment.&lt;br /&gt;
&lt;br /&gt;
== Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
In [[Mini Micro]], &amp;lt;c&amp;gt;env&amp;lt;/c&amp;gt; refers to a map of special values that affect the Mini Micro environment.  It contains at least the following keys:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| bootOpts || a complete copy of the data in the [[bootOpts.grfon]] file&lt;br /&gt;
|-&lt;br /&gt;
| curdir || current working directory (same as [[pwd]])&lt;br /&gt;
|-&lt;br /&gt;
| cmdLine || command line command that was used to launch Mini Micro (where applicable)&lt;br /&gt;
|-&lt;br /&gt;
| cmdLineArgs || command line arguments (as a [[list]]) used when Mini Micro was launched (where applicable)&lt;br /&gt;
|-&lt;br /&gt;
| importPaths || [[list]] of directories searched for [[import]] modules&lt;br /&gt;
|-&lt;br /&gt;
| prompt || [[string]] or [[function]] to use as the command-line prompt&lt;br /&gt;
|-&lt;br /&gt;
| morePrompt || [[string]] or [[function]] to use as the prompt when more input is needed&lt;br /&gt;
|-&lt;br /&gt;
| shell || path to the current [[Env.shell|shell]] program (&amp;lt;c&amp;gt;&amp;quot;&amp;quot;&amp;lt;/c&amp;gt; for the default Mini Micro shell)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Command-Line MiniScript ==&lt;br /&gt;
&lt;br /&gt;
In [[command-line MiniScript]], &amp;lt;c&amp;gt;env&amp;lt;/c&amp;gt; is a copy of the shell environment variables.  Assignments to entries of &amp;lt;c&amp;gt;env&amp;lt;/c&amp;gt; add or update environment variables.  (Deleting environment variables is not possible; you may delete from the &amp;lt;c&amp;gt;env&amp;lt;/c&amp;gt; map, but this does not actually affect the environment.)&lt;br /&gt;
&lt;br /&gt;
The exact meaning of environment variables varies with the platform.  They have many uses, such as in [http://www.cgi101.com/book/ch3/text.html CGI scripts].&lt;br /&gt;
&lt;br /&gt;
=== Windows Version ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Default !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| MS_EXE_DIR || Launch directory ||Returns the directory ([[String]]) of which the miniscript.exe was launched from&lt;br /&gt;
|-&lt;br /&gt;
| MS_IMPORT_PATH || &amp;quot;$MS_SCRIPT_DIR/lib:$MS_EXE_DIR/lib&amp;quot; ||directory listings ([[String]]) of where MiniScript files are located allowing [[Import]] to search in those for file import.&lt;br /&gt;
|-&lt;br /&gt;
| HOMEPATH || User home || Returns the home Directory ([[String]]) of the user that had launched miniscript.exe&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Linux Version===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Default !! Meaning&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Useful tips ==&lt;br /&gt;
&lt;br /&gt;
=== Adding more import paths (Windows Command Line) ===&lt;br /&gt;
To add more folders to [[Import]] from, alter or add the path with a dollar sign ('''$''') to the beginning of $MS_SCRIPT_DIR or $MS_EXE_DIR [[String]] text with a forward slash ('''/''') before the folder name like so: '''$MS_SCRIPT_DIR/sprites'''. To add multiple paths for import simply add a colon (''':''') between the designated paths to indicate multiple directories to import from. Apply the string to the [[Env|env]].MS_IMPORT_PATH like below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt; env.MS_IMPORT_PATH = &amp;quot;$MS_SCRIPT_DIR/sprites&amp;quot; // replaces the default with one folder named sprites&lt;br /&gt;
 env.MS_IMPORT_PATH = &amp;quot;$MS_SCRIPT_DIR/lib:$MS_EXE_DIR/lib:$MS_SCRIPT_DIR/sprites&amp;quot; // default plus new folder sprites&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line MiniScript]]&lt;br /&gt;
[[Category:Farmtronics]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Image_Disks&amp;diff=1366</id>
		<title>Image Disks</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Image_Disks&amp;diff=1366"/>
		<updated>2025-03-08T17:53:26Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Created page with &amp;quot;Mini Micro, since version 1.2.4, allows you to mount specially formatted PNG image files that contain an embedded minidisk, hidden inside the image via [https://en.wikiped...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Mini Micro]], since version 1.2.4, allows you to mount specially formatted PNG image files that contain an embedded minidisk, hidden inside the image via [https://en.wikipedia.org/wiki/Steganography steganography].&lt;br /&gt;
&lt;br /&gt;
(More details coming soon!)&lt;br /&gt;
&lt;br /&gt;
{{stub}}&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1365</id>
		<title>How to package a Mini Micro game</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_package_a_Mini_Micro_game&amp;diff=1365"/>
		<updated>2025-03-07T15:26:21Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Packaging for MacOS Download */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To &amp;quot;package&amp;quot; a [[Mini Micro]] game means to bundle up all the files into a format that end-users can download (or access on the web) and play without needing anything else.&lt;br /&gt;
&lt;br /&gt;
The basic idea is simple: Mini Micro will automatically look for a zip file (or folder) next to the executable called '''user.minidisk''', and if it finds this, it would automatically mount that as '''/usr''' and run any program it finds there as '''/usr/startup.ms'''.  So packaging amounts to taking a standard Mini Micro distribution, adding the desired '''user.minidisk''' file, and tweaking things like the app name and icon.  Exact details, though, vary with the platform you're targeting.&lt;br /&gt;
&lt;br /&gt;
Note that while the directions below include links to zip instructions/tools on the corresponding platform, it is ''not'' necessary to be on the platform you are packaging for.  In other words, it should work perfectly well to package for all platforms, from whatever platform you happen to use.  Also note that the first three steps in each section below are the same, and only need to be done once no matter how many platforms you package for.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Windows Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.laptopmag.com/articles/how-to-zip-files-windows-10 zip it].  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Windows distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''Mini Micro.exe''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''Mini Micro_Data/StreamingAssets''' subfolder.&lt;br /&gt;
# If you like, rename '''Mini Micro.exe''' to the name of your game. Note: Do not forget to change the folder '''Mini Micro_data''' to the name change with the exe with '''_data'''. example: '''strat.exe''', data folder would be '''strat_data'''.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the .exe, your '''user.minidisk''' file, and everything else that came with the original Windows distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for MacOS Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.lifewire.com/how-to-zip-and-unzip-files-and-folders-on-a-mac-2260188 zip it].  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the MacOS distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.app''' file.  (If you are doing this in Windows or Linux, '''MiniMicro.app''' will appear as a folder; on a Mac, the same folder appears as an app, and the .app extension may be hidden.)&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file, and place that inside the application bundle under '''Contents/Resources/Data/StreamingAssets'''.&lt;br /&gt;
# If you like, rename '''MiniMicro.app''' to the name of your game.&lt;br /&gt;
# Zip up (or place on a [https://support.apple.com/guide/disk-utility/create-a-disk-image-dskutl11888/mac disk image]) the whole folder containing the app and your '''user.minidisk''' file.&lt;br /&gt;
&lt;br /&gt;
The resulting zip or DMG can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for Linux Download ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, [https://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html zip it].  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the Linux distribution of Mini Micro from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file next to the '''MiniMicro.x86_64''' file.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that in the '''MiniMicro_Data/StreamingAssets''' folder.&lt;br /&gt;
# If you like, rename '''MiniMicro.x86_64''' to the name of your game.&lt;br /&gt;
# Zip up (or otherwise archive, as you prefer) the whole folder containing the executable, your '''user.minidisk''' file, and everything else that came with the original Linux distribution.&lt;br /&gt;
&lt;br /&gt;
The resulting archive file can then be uploaded to DropBox or itch.io, or otherwise distributed to your players.&lt;br /&gt;
&lt;br /&gt;
== Packaging for the Web ==&lt;br /&gt;
&lt;br /&gt;
# Make a virtual disk containing just the files needed for your game or app.&lt;br /&gt;
# Add a [[startup.ms]] script that loads and runs your program.&lt;br /&gt;
# If your virtual disk is (in the real file system) a folder, zip the contents of that folder.  Rename the zip file exactly '''user.minidisk'''.&lt;br /&gt;
# Download the WebGL Template from the [https://miniscript.org/MiniMicro/ official web page].&lt;br /&gt;
# Put your '''user.minidisk''' file into the  '''StreamingAssets''' folder, replacing the (empty) user.minidisk there in the template.&lt;br /&gt;
# If desired, make a '''[[bootOpts.grfon]]''' file and place that next to '''user.minidisk'''.&lt;br /&gt;
# If uploading to itch.io, zip up the whole folder containing '''Build''', '''index.html''', and '''StreamingAssets'''.&lt;br /&gt;
# Upload that archive to itch.io, or upload the folder to your web site.  If asked for viewport dimensions, use 1024 by 768 pixels.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1364</id>
		<title>How to get started with Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1364"/>
		<updated>2025-03-05T16:39:26Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* 3. About synthesized sounds */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://miniscript.org/MiniMicro/ Mini Micro] is a popular environment for creating 2D games and demos in MiniScript.  It is a retro-style virtual computer, which runs on most desktop platforms.  Mini Micro games can be [[How to package a Mini Micro game|packaged]] as stand-alone games for desktop or the web. &lt;br /&gt;
&lt;br /&gt;
This page is meant for people who have never used Mini Micro before, but want to make a Mini Micro game.  It is a step-by-step guide to building your first simple demo involving a sprite, game input, and sound effects, including your own resources, as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Get Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
While you can run Mini Micro on the web, the web version has no ability to save files (nor does it support copy/paste).  So it's not useful for developing your own Mini Micro games.&lt;br /&gt;
&lt;br /&gt;
Go to the [https://miniscript.org/MiniMicro/#download Mini Micro download] page, click the button for your platform (Mac, Windows, or Linux), and save the resulting file to your local machine.  (If you don't have a Mac, Windows, or Linux desktop machine, then unfortunately you can't use Mini Micro yet, though iOS and Android versions are under development.)&lt;br /&gt;
&lt;br /&gt;
The downloaded file will be a .zip (Mac/Windows) or .tar.gz (Linux) file.  ''Unpack this file completely.''  Don't try to run Mini Micro from ''within'' the archive; extract all files to a real folder on your hard drive.&lt;br /&gt;
&lt;br /&gt;
Then, find the Mini Micro application in that folder.  Double-click it to launch Mini Micro.  The result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:MiniMicro.png|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Mount a folder as /usr ==&lt;br /&gt;
&lt;br /&gt;
Mini Micro can access two virtual &amp;quot;disks&amp;quot; at once; within the Mini Micro environment, these are accessed as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Each of these can be either a '''.minidisk file''', or a '''real folder''' on the host (desktop) system.  Out of the box, Mini Micro creates an empty .minidisk file for you, to keep things nice and neat.  But for any serious development, you're going to want to mount a real folder instead, so that you can easily move files in and out of this folder, use your favorite external image/sound editors, etc.&lt;br /&gt;
&lt;br /&gt;
Create a folder on your desktop system, wherever you normally keep your documents.  This will be your project folder for your first Mini Micro game.  Put a small text file, image (in PNG or JPEG format), or sound file (in WAV or OGG format) in there.  Our goal now is to see and view this file (and any others in that folder or its subfolders) in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the disk slot menu ===&lt;br /&gt;
&lt;br /&gt;
Those two thin dark rectangles in the bottom-left corner of the Mini Micro window are &amp;quot;disk slots.&amp;quot;  The top slot represents &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;, and the bottom slot represents &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Click the top slot to pop open the menu, and select the &amp;quot;Mount Folder...&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Selecting that command should bring up the native file dialog for your platform, allowing you to select any folder you have access to.  Pick the project folder you created above.  (Note: some Linux platforms have a bug which crashes Mini Micro at this point; if that happens to you, go on to Method 2.)&lt;br /&gt;
&lt;br /&gt;
Now, in the Mini Micro display, at the blinking orange prompt, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;dir&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and press Return or Enter.  You should see your file listed.  Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;view &amp;quot;myfile.txt&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
but replace ''myfile.txt'' with the name of whatever file you placed in your project folder.  Be sure to include the quotation marks; you're typing MiniScript code here, not some other shell language, so string literals always need to be surrounded by double quotes.  If you do it correctly, the contents of your text file or image should appear on the screen.&lt;br /&gt;
&lt;br /&gt;
(You could also do &amp;lt;c&amp;gt;view findFile&amp;lt;/c&amp;gt;, which would pop up the little file browser within the [[findFile]] command, and select your file that way.)&lt;br /&gt;
&lt;br /&gt;
Note that the currently mounted disk is saved in preferences, so if you quit and relaunch Mini Micro, you generally won't need to do this step again; the previously mounted disks will still be there.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use command-line arguments ===&lt;br /&gt;
&lt;br /&gt;
If you are unfortunate enough to hit that Linux bug which causes the file dialogs to crash, or for some other reason you want to launch Mini Micro from the command line (or a shell script) with the correct folder already mounted, then you can use [[Command-line arguments|command-line arguments]] instead.  Open your favorite terminal program, and navigate to where the Mini Micro executable is located.  The details vary by platform, so let's break it down:&lt;br /&gt;
&lt;br /&gt;
'''Linux'''&lt;br /&gt;
&lt;br /&gt;
In Linux, the executable is called '''MiniMicro.x86_64''', so you would type a command like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;./MiniMicro.x86_64 -usr ~/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''Windows'''&lt;br /&gt;
&lt;br /&gt;
In Windows, you can open the command prompt by pressing '''Win + R''' to open the Run dialog, and entering ''cmd''.  (If you already have some other preferred terminal app, like PowerShell, that's fine too.)  Then &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; to the directory containing Mini Micro.  The executable here is called '''Mini Micro.exe''', so you would use a command like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&amp;quot;Mini Micro.exe&amp;quot; -usr &amp;quot;%HOMEPATH%\mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;%HOMEPATH%\mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''MacOS'''&lt;br /&gt;
&lt;br /&gt;
On Mac, the actual executable is hidden inside the application bundle, specifically under Contents/MacOS.  So if you've already launched Terminal and navigated to where '''MiniMicro.app''' is found, then you would do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Contents/MacOS/Mini\ Micro -usr ~/Documents/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/Documents/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
If successful (on any platform), you should be able to use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to view the file in your project folder within the Mini Micro environment.&lt;br /&gt;
&lt;br /&gt;
== Create a sprite ==&lt;br /&gt;
&lt;br /&gt;
Now let's get a sprite up on the screen.  We're going to do this using the Mini Micro command line (or [[REPL]]), where you type a command and executes immediately.  We'll get to writing real programs later, but the command-line is a powerful tool for learning and exploring, so let's use it.&lt;br /&gt;
&lt;br /&gt;
=== 1. Make a sprite from the built-in images ===&lt;br /&gt;
&lt;br /&gt;
At the orange blinking-cursor prompt in Mini Micro, carefully type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a furry purple Wumpus peeking out from the lower-left corner of the screen (which is the origin of Mini Micro's [[Screen coordinates|coordinate system]]).&lt;br /&gt;
&lt;br /&gt;
[[File:ManualSprite.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
If you don't see this, go back and double-check your typing.  Note that you can recall a previous command on the command line by pressing the '''up-arrow''' key, then just edit it and press Return to run the edited command.&lt;br /&gt;
&lt;br /&gt;
How does this work?  Let's break it down:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; clears the screen and resets all eight display layers to their default states.  This includes setting display 4 to be a [[SpriteDisplay]].  (That's the default state when Mini Micro boots, but useful whenever your screen is cluttered anyway.)&lt;br /&gt;
# &amp;lt;c&amp;gt;sp = new Sprite&amp;lt;/c&amp;gt; creates a new [[Sprite]] object, and assigns it to a variable called &amp;lt;c&amp;gt;sp&amp;lt;/c&amp;gt;.&lt;br /&gt;
# &amp;lt;c&amp;gt;sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&amp;lt;/c&amp;gt; loads an image called &amp;quot;Wumpus.png&amp;quot; from the &amp;lt;c&amp;gt;/sys/pics&amp;lt;/c&amp;gt; directory.  (Notice that Mini Micro uses forward-slashes in file paths, even if the host system is Windows.)&lt;br /&gt;
# &amp;lt;c&amp;gt;display(4).sprites.push sp&amp;lt;/c&amp;gt; pushes this new sprite onto the sprite list of display 4, so it can be seen.&lt;br /&gt;
&lt;br /&gt;
Once you have the Wumpus peeking out of the corner, let's move it and rotate it a bit.  Notice how the sprite updates immediately after each command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp.x = 480&lt;br /&gt;
sp.y = 320&lt;br /&gt;
sp.rotation = 45&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Make a sprite from your own custom image ===&lt;br /&gt;
&lt;br /&gt;
The Wumpus sprite above was created from one of the built-in images that comes with Mini Micro.  There are hundreds of these, stored on a hidden, read-only disk mounted as &amp;lt;c&amp;gt;/sys&amp;lt;/c&amp;gt;.  Feel free to use the &amp;lt;c&amp;gt;findFile&amp;lt;/c&amp;gt; command to explore what's there.&lt;br /&gt;
&lt;br /&gt;
But for your own game, you're probably going to want to use your own custom sprites.  So, put an image in PNG format into your project directory (the one you mounted as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;).  Use the &amp;lt;c&amp;gt;pwd&amp;lt;/c&amp;gt; (print working directory) and &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; (change directory) commands to be sure you are in your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; directory.  Then use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to ensure that you can see and load your user file.&lt;br /&gt;
&lt;br /&gt;
Now, just repeat the commands you did to create a sprite above, but substitute the path to your custom image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;myCustomImage.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven't [[clear]]ed the display since step 1, then you'll see your new sprite ''and'' the Wumpus on screen at the same time.  And if you now move (by assigning to &amp;lt;c&amp;gt;.x&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;.y&amp;lt;/c&amp;gt;) your sprites so that they overlap, you'll see that your new sprite is drawn on top of the older one.  That's because sprites are drawn in the order in which they appear in the [[SpriteDisplay.sprites|sprites list]] of the [[SpriteDisplay]].&lt;br /&gt;
&lt;br /&gt;
=== 3. Extract an image from a sprite sheet ===&lt;br /&gt;
&lt;br /&gt;
Often you have multiple sprite images arranged in one bigger image file, called a '''sprite sheet''' or '''sprite atlas'''.  You can pull apart such a sprite sheet by using the [[Image.getImage]] function.  Let's try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;enemies = file.loadImage(&amp;quot;/sys/pics/Enemies.png&amp;quot;)&lt;br /&gt;
view enemies&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This loads and displays [https://github.com/JoeStrout/minimicro-sysdisk/blob/master/sys/pics/Enemies.png?raw=true this big image], which contains a number of platformer enemies, in a 128x128 pixel grid.  Let's make a sprite out of the top-left image.  Keep in mind that coordinates in Mini Micro go from the bottom-left corner, so that top image starts at 128 * 3 = 384.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;goob = new Sprite&lt;br /&gt;
goob.image = enemies.getImage(0, 384, 128, 128)&lt;br /&gt;
display(4).sprites.push goob&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a new sprite called &amp;lt;c&amp;gt;goob&amp;lt;/c&amp;gt;, assigns it an image from our &amp;lt;c&amp;gt;enemies&amp;lt;/c&amp;gt; sprite sheet, and pushes it onto the display.  As always, it starts out in the bottom-left corner, but you know how to adjust that by now.  Since this sprite is a bit bigger than it probably needs to be, also try &amp;lt;c&amp;gt;goob.scale = 0.5&amp;lt;/c&amp;gt; to shrink it down.&lt;br /&gt;
&lt;br /&gt;
== Play a sound ==&lt;br /&gt;
&lt;br /&gt;
Almost any game needs [[sound]] effects!  Mini Micro supports playing both digitized sounds loaded from a file, and sounds synthesized at runtime.  We'll focus here on playing sounds from a file, which can be in either WAV or OGG format.&lt;br /&gt;
&lt;br /&gt;
=== 1. Play one of the built-in sounds ===&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;c&amp;gt;clear&amp;lt;/c&amp;gt; to clear the screen, then try this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd = file.loadSound(&amp;quot;/sys/sounds/twinkle.wav&amp;quot;)&lt;br /&gt;
snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should hear a twinkle sound.  The [[Sound.play]] method supports several optional parameters.  A handy trick when you need a quick reminder of function parameters is to use [[@ operator|@]] (the at-sign) before a function reference, to return the function without invoking it.  On the command line, that will print the function parameter names and default values.  Try it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;@snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
which prints:&lt;br /&gt;
&amp;lt;ms&amp;gt;FUNCTION(self, volume=1, pan=0, speed=1)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So let's try some variations on the sound.  (In the code below, we're using &amp;lt;c&amp;gt;//&amp;lt;/c&amp;gt; to add a [[Comments|comment]] on each line; you don't have to type these, but you can if you like.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd.play 0.1   // play very quietly&lt;br /&gt;
snd.play 1, -1     // play out the left speaker only&lt;br /&gt;
snd.play 1, 0, 2   // play twice as fast (an octave higher)&lt;br /&gt;
snd.play 1, 0, 0.5 // play half as fast (an octave lower)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Play your own custom sound ===&lt;br /&gt;
&lt;br /&gt;
Put a sound file in WAV or OGG format into your project folder.  (On some platforms you can also use MP3 format, but that doesn't work everywhere and so is best to avoid if you plan to distribute your game.)  Let's suppose your file is called &amp;quot;bgm.ogg&amp;quot;.  Load and play it just as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2 = file.loadSound(&amp;quot;bgm.ogg&amp;quot;)&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your sound is very long, and you want to stop it, you can just do &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.&lt;br /&gt;
&lt;br /&gt;
Before we move on, let's make this sound loop forever, as you might want background music to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2.loop = true&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, use &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt; to make it stop, or &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.  (The &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; command will also do that, in addition to clearing the current program and variables.)&lt;br /&gt;
&lt;br /&gt;
=== 3. About synthesized sounds ===&lt;br /&gt;
&lt;br /&gt;
Mini Micro has a sophisticated API for creating sounds out of nothing but code.  You can specify a base waveform, frequency, envelope, fade-in/fade-out, and even mix basic sounds together to create more sophisticated sounds.  You can find a couple of simple examples on the [[Sound.init]] page, and some more complex ones by doing &amp;lt;c&amp;gt;run &amp;quot;/sys/lib/sounds&amp;quot;&amp;lt;/c&amp;gt; (followed by &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; to see how those examples were made).  You can also &amp;lt;c&amp;gt;run &amp;quot;/sys/demo/soundLab&amp;quot;&amp;lt;/c&amp;gt; for a graphical synthesizer, which can then output code you to recreate the sound.&lt;br /&gt;
&lt;br /&gt;
== Write a program ==&lt;br /&gt;
&lt;br /&gt;
Typing commands directly on the command line is a great way to learn, explore, and test things out.  But to write more than a few lines, you'll want to use a code editor.  Assuming you've mounted a folder (rather than a minidisk file), you have two options: the built-in code editor, or an external code editor.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the built-in code editor ===&lt;br /&gt;
&lt;br /&gt;
The [[Mini Micro code editor]] is invoked with the &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; command.  Just type &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; by itself to edit the currently loaded program (or start a new program, if none is loaded).  Or, you can add a filename argument, like &amp;lt;c&amp;gt;edit &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;, to [[load]] a different program and open the editor in one step.&lt;br /&gt;
&lt;br /&gt;
Note that once a program is loaded, if you want to start a new program, use [[reset]] to clear the current program and variables.&lt;br /&gt;
&lt;br /&gt;
The built-in code editor is full-featured and powerful, including auto-indenting, code snippets, a color picker for color constants, and a sophisticated find/replace dialog.  See [[Mini Micro code editor|this page]] for usage details.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use an external code editor ===&lt;br /&gt;
&lt;br /&gt;
When you have mounted a real folder as your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; (or &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;) disk, then you can edit MiniScript files therein using your favorite code editor, outside of Mini Micro.  On the [[Tools]] page you can even find language models for editors like VS Code or BBEdit, to provide MiniScript-savvy syntax coloring.&lt;br /&gt;
&lt;br /&gt;
When you edit code in this way, you will need to reload the program from disk in Mini Micro to see your changes.  It's also generally a good idea to &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; the environment before running the new code, so that old function definitions or other variable values don't inadvertently change the behavior.  So after externally editing a script called &amp;quot;myGame.ms&amp;quot;, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reset; run &amp;quot;myGame&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in Mini Micro.  (And once you've done this once, you can generally just up-arrow to recall and repeat this command again the next time.)&lt;br /&gt;
&lt;br /&gt;
=== A simple game demo ===&lt;br /&gt;
&lt;br /&gt;
Using either method above, create a new MiniScript program called &amp;quot;ufo.ms&amp;quot;, and paste in the following.  (Or to learn even faster, retype it instead of using copy &amp;amp; paste.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare displays&lt;br /&gt;
clear&lt;br /&gt;
sd = display(4)  // sprite display&lt;br /&gt;
&lt;br /&gt;
// prepare UFO sprite and other resources&lt;br /&gt;
ufo = new Sprite&lt;br /&gt;
ufo.image = file.loadImage(&amp;quot;/sys/pics/UFO.png&amp;quot;)&lt;br /&gt;
sd.sprites.push ufo&lt;br /&gt;
ufo.x = 480; ufo.y = 320&lt;br /&gt;
&lt;br /&gt;
fireSound = file.loadSound(&amp;quot;/sys/sounds/blam.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// allow alternate &amp;quot;fire&amp;quot; buttons&lt;br /&gt;
fireButtons = [&amp;quot;space&amp;quot;, &amp;quot;left shift&amp;quot;, &amp;quot;right shift&amp;quot;,&lt;br /&gt;
  &amp;quot;joystick button 0&amp;quot;, &amp;quot;joystick button 1&amp;quot;]&lt;br /&gt;
firePressed = function&lt;br /&gt;
	for btn in fireButtons&lt;br /&gt;
		if key.pressed(btn) then return true&lt;br /&gt;
	end for&lt;br /&gt;
	return false&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// function to &amp;quot;fire&amp;quot; (play a sound)&lt;br /&gt;
fire = function&lt;br /&gt;
	fireSound.play&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
fireWasPressed = false&lt;br /&gt;
while true&lt;br /&gt;
	yield  // wait for next frame&lt;br /&gt;
	&lt;br /&gt;
	// move the UFO&lt;br /&gt;
	ufo.x += key.axis(&amp;quot;Horizontal&amp;quot;) * 20&lt;br /&gt;
	ufo.y += key.axis(&amp;quot;Vertical&amp;quot;) * 20&lt;br /&gt;
	&lt;br /&gt;
	// fire, when fire button goes down&lt;br /&gt;
	fireNowPressed = firePressed&lt;br /&gt;
	if fireNowPressed and not fireWasPressed then fire&lt;br /&gt;
	fireWasPressed = fireNowPressed&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a simple game demo which allows you to move a UFO around the screen using the arrow keys, WASD, or a game controller (which all feed into &amp;lt;c&amp;gt;[[key.axis]]&amp;lt;/c&amp;gt;).  And when you press any of several keys (including joystick/gamepad button 0 or 1), it plays a sound.&lt;br /&gt;
&lt;br /&gt;
Try changing the UFO sprite to your own custom sprite, and changing the fire sound to your own sound.  That will verify that you're able to get your own assets working in Mini Micro in a custom game program.  Then start playing around with the code.  Some things to try:&lt;br /&gt;
&lt;br /&gt;
* Limit the sprite position so it can't go offscreen&lt;br /&gt;
* Add some sort of target, as in &amp;lt;c&amp;gt;/sys/demo/spriteDemo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Make the sprite drop/fire a second sprite when the fire button is pressed&lt;br /&gt;
&lt;br /&gt;
== Package your game for the web ==&lt;br /&gt;
&lt;br /&gt;
If you've come here because you want to make a Mini Micro game for a game jam, then you should almost certainly learn how to package your game for playing on the web, and upload it to a site like itch.io.&lt;br /&gt;
&lt;br /&gt;
This process is described in detail on [[How to package a Mini Micro game]].  Focus on the general instructions at the top, and the &amp;quot;packaging for the web&amp;quot; instructions at the bottom.&lt;br /&gt;
&lt;br /&gt;
== Where to learn more ==&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You have learned how to set up a local Mini Micro environment for development, using your own game assets, and learned to use both the built-in and external code editors.  You've made a very simple game demo, and know how to upload it to the web.  All toolchain hurdles are behind you; now it's just a matter of designing a game, and writing the code!&lt;br /&gt;
&lt;br /&gt;
If you are a Python or Lua programmer, see the [[Python]] or [[Lua]] page of this wiki to see how MiniScript compares to those.&lt;br /&gt;
&lt;br /&gt;
When writing the code, you will probably lean most heavily on these resources:&lt;br /&gt;
&lt;br /&gt;
* The [https://miniscript.org/files/MiniMicro-CheatSheet.pdf Mini Micro Cheat Sheet], a 4-page summary of the Mini Micro API and MiniScript language&lt;br /&gt;
* This wiki, especially the [[How To]] articles&lt;br /&gt;
* Sample code found in &amp;lt;c&amp;gt;/sys/demo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Various blog posts, perhaps found through the [[Bibliography]] page&lt;br /&gt;
&lt;br /&gt;
Most important of all, rely on the '''community Discord server''', a link to which can be found at the bottom of the [https://miniscript.org/ MiniScript home page].  An active and friendly community hangs out on Discord, and you are encouraged to share screenshots, code snippets, and questions there.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1363</id>
		<title>How to get started with Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1363"/>
		<updated>2025-03-05T16:36:09Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Play a sound */  (fixed typo)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://miniscript.org/MiniMicro/ Mini Micro] is a popular environment for creating 2D games and demos in MiniScript.  It is a retro-style virtual computer, which runs on most desktop platforms.  Mini Micro games can be [[How to package a Mini Micro game|packaged]] as stand-alone games for desktop or the web. &lt;br /&gt;
&lt;br /&gt;
This page is meant for people who have never used Mini Micro before, but want to make a Mini Micro game.  It is a step-by-step guide to building your first simple demo involving a sprite, game input, and sound effects, including your own resources, as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Get Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
While you can run Mini Micro on the web, the web version has no ability to save files (nor does it support copy/paste).  So it's not useful for developing your own Mini Micro games.&lt;br /&gt;
&lt;br /&gt;
Go to the [https://miniscript.org/MiniMicro/#download Mini Micro download] page, click the button for your platform (Mac, Windows, or Linux), and save the resulting file to your local machine.  (If you don't have a Mac, Windows, or Linux desktop machine, then unfortunately you can't use Mini Micro yet, though iOS and Android versions are under development.)&lt;br /&gt;
&lt;br /&gt;
The downloaded file will be a .zip (Mac/Windows) or .tar.gz (Linux) file.  ''Unpack this file completely.''  Don't try to run Mini Micro from ''within'' the archive; extract all files to a real folder on your hard drive.&lt;br /&gt;
&lt;br /&gt;
Then, find the Mini Micro application in that folder.  Double-click it to launch Mini Micro.  The result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:MiniMicro.png|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Mount a folder as /usr ==&lt;br /&gt;
&lt;br /&gt;
Mini Micro can access two virtual &amp;quot;disks&amp;quot; at once; within the Mini Micro environment, these are accessed as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Each of these can be either a '''.minidisk file''', or a '''real folder''' on the host (desktop) system.  Out of the box, Mini Micro creates an empty .minidisk file for you, to keep things nice and neat.  But for any serious development, you're going to want to mount a real folder instead, so that you can easily move files in and out of this folder, use your favorite external image/sound editors, etc.&lt;br /&gt;
&lt;br /&gt;
Create a folder on your desktop system, wherever you normally keep your documents.  This will be your project folder for your first Mini Micro game.  Put a small text file, image (in PNG or JPEG format), or sound file (in WAV or OGG format) in there.  Our goal now is to see and view this file (and any others in that folder or its subfolders) in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the disk slot menu ===&lt;br /&gt;
&lt;br /&gt;
Those two thin dark rectangles in the bottom-left corner of the Mini Micro window are &amp;quot;disk slots.&amp;quot;  The top slot represents &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;, and the bottom slot represents &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Click the top slot to pop open the menu, and select the &amp;quot;Mount Folder...&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Selecting that command should bring up the native file dialog for your platform, allowing you to select any folder you have access to.  Pick the project folder you created above.  (Note: some Linux platforms have a bug which crashes Mini Micro at this point; if that happens to you, go on to Method 2.)&lt;br /&gt;
&lt;br /&gt;
Now, in the Mini Micro display, at the blinking orange prompt, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;dir&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and press Return or Enter.  You should see your file listed.  Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;view &amp;quot;myfile.txt&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
but replace ''myfile.txt'' with the name of whatever file you placed in your project folder.  Be sure to include the quotation marks; you're typing MiniScript code here, not some other shell language, so string literals always need to be surrounded by double quotes.  If you do it correctly, the contents of your text file or image should appear on the screen.&lt;br /&gt;
&lt;br /&gt;
(You could also do &amp;lt;c&amp;gt;view findFile&amp;lt;/c&amp;gt;, which would pop up the little file browser within the [[findFile]] command, and select your file that way.)&lt;br /&gt;
&lt;br /&gt;
Note that the currently mounted disk is saved in preferences, so if you quit and relaunch Mini Micro, you generally won't need to do this step again; the previously mounted disks will still be there.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use command-line arguments ===&lt;br /&gt;
&lt;br /&gt;
If you are unfortunate enough to hit that Linux bug which causes the file dialogs to crash, or for some other reason you want to launch Mini Micro from the command line (or a shell script) with the correct folder already mounted, then you can use [[Command-line arguments|command-line arguments]] instead.  Open your favorite terminal program, and navigate to where the Mini Micro executable is located.  The details vary by platform, so let's break it down:&lt;br /&gt;
&lt;br /&gt;
'''Linux'''&lt;br /&gt;
&lt;br /&gt;
In Linux, the executable is called '''MiniMicro.x86_64''', so you would type a command like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;./MiniMicro.x86_64 -usr ~/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''Windows'''&lt;br /&gt;
&lt;br /&gt;
In Windows, you can open the command prompt by pressing '''Win + R''' to open the Run dialog, and entering ''cmd''.  (If you already have some other preferred terminal app, like PowerShell, that's fine too.)  Then &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; to the directory containing Mini Micro.  The executable here is called '''Mini Micro.exe''', so you would use a command like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&amp;quot;Mini Micro.exe&amp;quot; -usr &amp;quot;%HOMEPATH%\mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;%HOMEPATH%\mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''MacOS'''&lt;br /&gt;
&lt;br /&gt;
On Mac, the actual executable is hidden inside the application bundle, specifically under Contents/MacOS.  So if you've already launched Terminal and navigated to where '''MiniMicro.app''' is found, then you would do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Contents/MacOS/Mini\ Micro -usr ~/Documents/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/Documents/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
If successful (on any platform), you should be able to use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to view the file in your project folder within the Mini Micro environment.&lt;br /&gt;
&lt;br /&gt;
== Create a sprite ==&lt;br /&gt;
&lt;br /&gt;
Now let's get a sprite up on the screen.  We're going to do this using the Mini Micro command line (or [[REPL]]), where you type a command and executes immediately.  We'll get to writing real programs later, but the command-line is a powerful tool for learning and exploring, so let's use it.&lt;br /&gt;
&lt;br /&gt;
=== 1. Make a sprite from the built-in images ===&lt;br /&gt;
&lt;br /&gt;
At the orange blinking-cursor prompt in Mini Micro, carefully type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a furry purple Wumpus peeking out from the lower-left corner of the screen (which is the origin of Mini Micro's [[Screen coordinates|coordinate system]]).&lt;br /&gt;
&lt;br /&gt;
[[File:ManualSprite.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
If you don't see this, go back and double-check your typing.  Note that you can recall a previous command on the command line by pressing the '''up-arrow''' key, then just edit it and press Return to run the edited command.&lt;br /&gt;
&lt;br /&gt;
How does this work?  Let's break it down:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; clears the screen and resets all eight display layers to their default states.  This includes setting display 4 to be a [[SpriteDisplay]].  (That's the default state when Mini Micro boots, but useful whenever your screen is cluttered anyway.)&lt;br /&gt;
# &amp;lt;c&amp;gt;sp = new Sprite&amp;lt;/c&amp;gt; creates a new [[Sprite]] object, and assigns it to a variable called &amp;lt;c&amp;gt;sp&amp;lt;/c&amp;gt;.&lt;br /&gt;
# &amp;lt;c&amp;gt;sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&amp;lt;/c&amp;gt; loads an image called &amp;quot;Wumpus.png&amp;quot; from the &amp;lt;c&amp;gt;/sys/pics&amp;lt;/c&amp;gt; directory.  (Notice that Mini Micro uses forward-slashes in file paths, even if the host system is Windows.)&lt;br /&gt;
# &amp;lt;c&amp;gt;display(4).sprites.push sp&amp;lt;/c&amp;gt; pushes this new sprite onto the sprite list of display 4, so it can be seen.&lt;br /&gt;
&lt;br /&gt;
Once you have the Wumpus peeking out of the corner, let's move it and rotate it a bit.  Notice how the sprite updates immediately after each command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp.x = 480&lt;br /&gt;
sp.y = 320&lt;br /&gt;
sp.rotation = 45&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Make a sprite from your own custom image ===&lt;br /&gt;
&lt;br /&gt;
The Wumpus sprite above was created from one of the built-in images that comes with Mini Micro.  There are hundreds of these, stored on a hidden, read-only disk mounted as &amp;lt;c&amp;gt;/sys&amp;lt;/c&amp;gt;.  Feel free to use the &amp;lt;c&amp;gt;findFile&amp;lt;/c&amp;gt; command to explore what's there.&lt;br /&gt;
&lt;br /&gt;
But for your own game, you're probably going to want to use your own custom sprites.  So, put an image in PNG format into your project directory (the one you mounted as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;).  Use the &amp;lt;c&amp;gt;pwd&amp;lt;/c&amp;gt; (print working directory) and &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; (change directory) commands to be sure you are in your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; directory.  Then use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to ensure that you can see and load your user file.&lt;br /&gt;
&lt;br /&gt;
Now, just repeat the commands you did to create a sprite above, but substitute the path to your custom image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;myCustomImage.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven't [[clear]]ed the display since step 1, then you'll see your new sprite ''and'' the Wumpus on screen at the same time.  And if you now move (by assigning to &amp;lt;c&amp;gt;.x&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;.y&amp;lt;/c&amp;gt;) your sprites so that they overlap, you'll see that your new sprite is drawn on top of the older one.  That's because sprites are drawn in the order in which they appear in the [[SpriteDisplay.sprites|sprites list]] of the [[SpriteDisplay]].&lt;br /&gt;
&lt;br /&gt;
=== 3. Extract an image from a sprite sheet ===&lt;br /&gt;
&lt;br /&gt;
Often you have multiple sprite images arranged in one bigger image file, called a '''sprite sheet''' or '''sprite atlas'''.  You can pull apart such a sprite sheet by using the [[Image.getImage]] function.  Let's try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;enemies = file.loadImage(&amp;quot;/sys/pics/Enemies.png&amp;quot;)&lt;br /&gt;
view enemies&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This loads and displays [https://github.com/JoeStrout/minimicro-sysdisk/blob/master/sys/pics/Enemies.png?raw=true this big image], which contains a number of platformer enemies, in a 128x128 pixel grid.  Let's make a sprite out of the top-left image.  Keep in mind that coordinates in Mini Micro go from the bottom-left corner, so that top image starts at 128 * 3 = 384.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;goob = new Sprite&lt;br /&gt;
goob.image = enemies.getImage(0, 384, 128, 128)&lt;br /&gt;
display(4).sprites.push goob&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a new sprite called &amp;lt;c&amp;gt;goob&amp;lt;/c&amp;gt;, assigns it an image from our &amp;lt;c&amp;gt;enemies&amp;lt;/c&amp;gt; sprite sheet, and pushes it onto the display.  As always, it starts out in the bottom-left corner, but you know how to adjust that by now.  Since this sprite is a bit bigger than it probably needs to be, also try &amp;lt;c&amp;gt;goob.scale = 0.5&amp;lt;/c&amp;gt; to shrink it down.&lt;br /&gt;
&lt;br /&gt;
== Play a sound ==&lt;br /&gt;
&lt;br /&gt;
Almost any game needs [[sound]] effects!  Mini Micro supports playing both digitized sounds loaded from a file, and sounds synthesized at runtime.  We'll focus here on playing sounds from a file, which can be in either WAV or OGG format.&lt;br /&gt;
&lt;br /&gt;
=== 1. Play one of the built-in sounds ===&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;c&amp;gt;clear&amp;lt;/c&amp;gt; to clear the screen, then try this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd = file.loadSound(&amp;quot;/sys/sounds/twinkle.wav&amp;quot;)&lt;br /&gt;
snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should hear a twinkle sound.  The [[Sound.play]] method supports several optional parameters.  A handy trick when you need a quick reminder of function parameters is to use [[@ operator|@]] (the at-sign) before a function reference, to return the function without invoking it.  On the command line, that will print the function parameter names and default values.  Try it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;@snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
which prints:&lt;br /&gt;
&amp;lt;ms&amp;gt;FUNCTION(self, volume=1, pan=0, speed=1)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So let's try some variations on the sound.  (In the code below, we're using &amp;lt;c&amp;gt;//&amp;lt;/c&amp;gt; to add a [[Comments|comment]] on each line; you don't have to type these, but you can if you like.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd.play 0.1   // play very quietly&lt;br /&gt;
snd.play 1, -1     // play out the left speaker only&lt;br /&gt;
snd.play 1, 0, 2   // play twice as fast (an octave higher)&lt;br /&gt;
snd.play 1, 0, 0.5 // play half as fast (an octave lower)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Play your own custom sound ===&lt;br /&gt;
&lt;br /&gt;
Put a sound file in WAV or OGG format into your project folder.  (On some platforms you can also use MP3 format, but that doesn't work everywhere and so is best to avoid if you plan to distribute your game.)  Let's suppose your file is called &amp;quot;bgm.ogg&amp;quot;.  Load and play it just as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2 = file.loadSound(&amp;quot;bgm.ogg&amp;quot;)&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your sound is very long, and you want to stop it, you can just do &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.&lt;br /&gt;
&lt;br /&gt;
Before we move on, let's make this sound loop forever, as you might want background music to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2.loop = true&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, use &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt; to make it stop, or &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.  (The &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; command will also do that, in addition to clearing the current program and variables.)&lt;br /&gt;
&lt;br /&gt;
=== 3. About synthesized sounds ===&lt;br /&gt;
&lt;br /&gt;
Mini Micro has a sophisticated API for creating sounds out of nothing but code.  You can specify a base waveform, frequency, envelope, fade-in/fade-out, and even mix basic sounds together to create more sophisticated sounds.  You can find a couple of simple examples on the [[Sound.init]] page, and some more complex ones by doing &amp;lt;c&amp;gt;run &amp;quot;/sys/lib/sounds&amp;quot;&amp;lt;/c&amp;gt; (followed by &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; to see how those examples were made).&lt;br /&gt;
&lt;br /&gt;
== Write a program ==&lt;br /&gt;
&lt;br /&gt;
Typing commands directly on the command line is a great way to learn, explore, and test things out.  But to write more than a few lines, you'll want to use a code editor.  Assuming you've mounted a folder (rather than a minidisk file), you have two options: the built-in code editor, or an external code editor.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the built-in code editor ===&lt;br /&gt;
&lt;br /&gt;
The [[Mini Micro code editor]] is invoked with the &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; command.  Just type &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; by itself to edit the currently loaded program (or start a new program, if none is loaded).  Or, you can add a filename argument, like &amp;lt;c&amp;gt;edit &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;, to [[load]] a different program and open the editor in one step.&lt;br /&gt;
&lt;br /&gt;
Note that once a program is loaded, if you want to start a new program, use [[reset]] to clear the current program and variables.&lt;br /&gt;
&lt;br /&gt;
The built-in code editor is full-featured and powerful, including auto-indenting, code snippets, a color picker for color constants, and a sophisticated find/replace dialog.  See [[Mini Micro code editor|this page]] for usage details.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use an external code editor ===&lt;br /&gt;
&lt;br /&gt;
When you have mounted a real folder as your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; (or &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;) disk, then you can edit MiniScript files therein using your favorite code editor, outside of Mini Micro.  On the [[Tools]] page you can even find language models for editors like VS Code or BBEdit, to provide MiniScript-savvy syntax coloring.&lt;br /&gt;
&lt;br /&gt;
When you edit code in this way, you will need to reload the program from disk in Mini Micro to see your changes.  It's also generally a good idea to &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; the environment before running the new code, so that old function definitions or other variable values don't inadvertently change the behavior.  So after externally editing a script called &amp;quot;myGame.ms&amp;quot;, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reset; run &amp;quot;myGame&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in Mini Micro.  (And once you've done this once, you can generally just up-arrow to recall and repeat this command again the next time.)&lt;br /&gt;
&lt;br /&gt;
=== A simple game demo ===&lt;br /&gt;
&lt;br /&gt;
Using either method above, create a new MiniScript program called &amp;quot;ufo.ms&amp;quot;, and paste in the following.  (Or to learn even faster, retype it instead of using copy &amp;amp; paste.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare displays&lt;br /&gt;
clear&lt;br /&gt;
sd = display(4)  // sprite display&lt;br /&gt;
&lt;br /&gt;
// prepare UFO sprite and other resources&lt;br /&gt;
ufo = new Sprite&lt;br /&gt;
ufo.image = file.loadImage(&amp;quot;/sys/pics/UFO.png&amp;quot;)&lt;br /&gt;
sd.sprites.push ufo&lt;br /&gt;
ufo.x = 480; ufo.y = 320&lt;br /&gt;
&lt;br /&gt;
fireSound = file.loadSound(&amp;quot;/sys/sounds/blam.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// allow alternate &amp;quot;fire&amp;quot; buttons&lt;br /&gt;
fireButtons = [&amp;quot;space&amp;quot;, &amp;quot;left shift&amp;quot;, &amp;quot;right shift&amp;quot;,&lt;br /&gt;
  &amp;quot;joystick button 0&amp;quot;, &amp;quot;joystick button 1&amp;quot;]&lt;br /&gt;
firePressed = function&lt;br /&gt;
	for btn in fireButtons&lt;br /&gt;
		if key.pressed(btn) then return true&lt;br /&gt;
	end for&lt;br /&gt;
	return false&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// function to &amp;quot;fire&amp;quot; (play a sound)&lt;br /&gt;
fire = function&lt;br /&gt;
	fireSound.play&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
fireWasPressed = false&lt;br /&gt;
while true&lt;br /&gt;
	yield  // wait for next frame&lt;br /&gt;
	&lt;br /&gt;
	// move the UFO&lt;br /&gt;
	ufo.x += key.axis(&amp;quot;Horizontal&amp;quot;) * 20&lt;br /&gt;
	ufo.y += key.axis(&amp;quot;Vertical&amp;quot;) * 20&lt;br /&gt;
	&lt;br /&gt;
	// fire, when fire button goes down&lt;br /&gt;
	fireNowPressed = firePressed&lt;br /&gt;
	if fireNowPressed and not fireWasPressed then fire&lt;br /&gt;
	fireWasPressed = fireNowPressed&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a simple game demo which allows you to move a UFO around the screen using the arrow keys, WASD, or a game controller (which all feed into &amp;lt;c&amp;gt;[[key.axis]]&amp;lt;/c&amp;gt;).  And when you press any of several keys (including joystick/gamepad button 0 or 1), it plays a sound.&lt;br /&gt;
&lt;br /&gt;
Try changing the UFO sprite to your own custom sprite, and changing the fire sound to your own sound.  That will verify that you're able to get your own assets working in Mini Micro in a custom game program.  Then start playing around with the code.  Some things to try:&lt;br /&gt;
&lt;br /&gt;
* Limit the sprite position so it can't go offscreen&lt;br /&gt;
* Add some sort of target, as in &amp;lt;c&amp;gt;/sys/demo/spriteDemo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Make the sprite drop/fire a second sprite when the fire button is pressed&lt;br /&gt;
&lt;br /&gt;
== Package your game for the web ==&lt;br /&gt;
&lt;br /&gt;
If you've come here because you want to make a Mini Micro game for a game jam, then you should almost certainly learn how to package your game for playing on the web, and upload it to a site like itch.io.&lt;br /&gt;
&lt;br /&gt;
This process is described in detail on [[How to package a Mini Micro game]].  Focus on the general instructions at the top, and the &amp;quot;packaging for the web&amp;quot; instructions at the bottom.&lt;br /&gt;
&lt;br /&gt;
== Where to learn more ==&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You have learned how to set up a local Mini Micro environment for development, using your own game assets, and learned to use both the built-in and external code editors.  You've made a very simple game demo, and know how to upload it to the web.  All toolchain hurdles are behind you; now it's just a matter of designing a game, and writing the code!&lt;br /&gt;
&lt;br /&gt;
If you are a Python or Lua programmer, see the [[Python]] or [[Lua]] page of this wiki to see how MiniScript compares to those.&lt;br /&gt;
&lt;br /&gt;
When writing the code, you will probably lean most heavily on these resources:&lt;br /&gt;
&lt;br /&gt;
* The [https://miniscript.org/files/MiniMicro-CheatSheet.pdf Mini Micro Cheat Sheet], a 4-page summary of the Mini Micro API and MiniScript language&lt;br /&gt;
* This wiki, especially the [[How To]] articles&lt;br /&gt;
* Sample code found in &amp;lt;c&amp;gt;/sys/demo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Various blog posts, perhaps found through the [[Bibliography]] page&lt;br /&gt;
&lt;br /&gt;
Most important of all, rely on the '''community Discord server''', a link to which can be found at the bottom of the [https://miniscript.org/ MiniScript home page].  An active and friendly community hangs out on Discord, and you are encouraged to share screenshots, code snippets, and questions there.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay.setCellTransform&amp;diff=1361</id>
		<title>TileDisplay.setCellTransform</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay.setCellTransform&amp;diff=1361"/>
		<updated>2025-02-22T15:27:48Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;[[TileDisplay]].setCellTransform&amp;lt;/c&amp;gt; method in [[Mini Micro]] (version 1.2.2 and later) introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay.  Give this method an integer from 0-7.  Values 0-3 rotate the tile in 90° increments.  Values 4-7 first flip the tile horizontally, and then rotate it in 90° increments.&lt;br /&gt;
&lt;br /&gt;
[[File:CellTransform.png|frameless|center]]&lt;br /&gt;
See also: [[TileDisplay.cellTransform]]&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;
| ''x'' || number || 0 || column (or list of columns) of cell to change&lt;br /&gt;
|-&lt;br /&gt;
| ''y'' || number || 0 || row (or list of rows) of cell to change&lt;br /&gt;
|-&lt;br /&gt;
| ''transform'' || number || &amp;lt;c&amp;gt;[[null]]&amp;lt;/c&amp;gt; || transform (0-7) to apply to the given cell&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example configures display 4 to be a [[TileDisplay]], loads a tile set, and then sets the cell at column 5, row 5 to be tile index 70 (a green key in this tile set).  It then cycles through all 8 transforms, one per half second.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
display(4).mode = displayMode.tile&lt;br /&gt;
td = display(4)&lt;br /&gt;
td.tileSet = file.loadImage(&amp;quot;/sys/pics/SimplePlatformTiles.png&amp;quot;)&lt;br /&gt;
td.tileSetTileSize = 64&lt;br /&gt;
td.cellSize = 64&lt;br /&gt;
td.clear&lt;br /&gt;
&lt;br /&gt;
td.setCell 5, 5, 70  // green key&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
	td.setCellTransform 5, 5, (td.cellTransform(5,5)+1) % 8&lt;br /&gt;
	text.row = 12; text.column = 25&lt;br /&gt;
	print td.cellTransform(5,5)&lt;br /&gt;
	wait 0.5&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:setCellTransform.gif|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay.setCellTransform&amp;diff=1360</id>
		<title>TileDisplay.setCellTransform</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay.setCellTransform&amp;diff=1360"/>
		<updated>2025-02-22T15:27:17Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;[[TileDisplay]].setCellTransform&amp;lt;/c&amp;gt; method in [[Mini Micro]] (version 1.2.2 and later) introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay.  Give this method an integer from 0-7.  Values 0-3 rotate the tile in 90° increments.  Values 4-7 first flip the tile horizontally, and then rotate it in 90° increments.&lt;br /&gt;
&lt;br /&gt;
[[File:CellTransform.png|frameless|center]]&lt;br /&gt;
See also: [[TileDisplay.cellTransfrom]]&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;
| ''x'' || number || 0 || column (or list of columns) of cell to change&lt;br /&gt;
|-&lt;br /&gt;
| ''y'' || number || 0 || row (or list of rows) of cell to change&lt;br /&gt;
|-&lt;br /&gt;
| ''transform'' || number || &amp;lt;c&amp;gt;[[null]]&amp;lt;/c&amp;gt; || transform (0-7) to apply to the given cell&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example configures display 4 to be a [[TileDisplay]], loads a tile set, and then sets the cell at column 5, row 5 to be tile index 70 (a green key in this tile set).  It then cycles through all 8 transforms, one per half second.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
display(4).mode = displayMode.tile&lt;br /&gt;
td = display(4)&lt;br /&gt;
td.tileSet = file.loadImage(&amp;quot;/sys/pics/SimplePlatformTiles.png&amp;quot;)&lt;br /&gt;
td.tileSetTileSize = 64&lt;br /&gt;
td.cellSize = 64&lt;br /&gt;
td.clear&lt;br /&gt;
&lt;br /&gt;
td.setCell 5, 5, 70  // green key&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
	td.setCellTransform 5, 5, (td.cellTransform(5,5)+1) % 8&lt;br /&gt;
	text.row = 12; text.column = 25&lt;br /&gt;
	print td.cellTransform(5,5)&lt;br /&gt;
	wait 0.5&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:setCellTransform.gif|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File:SetCellTransform.gif&amp;diff=1359</id>
		<title>File:SetCellTransform.gif</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File:SetCellTransform.gif&amp;diff=1359"/>
		<updated>2025-02-22T15:25:55Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Output (animated screenshot) of example on TileDisplay.setCellTransform&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Output (animated screenshot) of example on [[TileDisplay.setCellTransform]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay.setCellTransform&amp;diff=1358</id>
		<title>TileDisplay.setCellTransform</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay.setCellTransform&amp;diff=1358"/>
		<updated>2025-02-22T15:24:51Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Created page with &amp;quot;The &amp;lt;c&amp;gt;TileDisplay.setCellTransform&amp;lt;/c&amp;gt; method in Mini Micro (version 1.2.2 and later) introduced the ability to transform (flip and/or rotate) individual tiles in a TileD...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;TileDisplay.setCellTransform&amp;lt;/c&amp;gt; method in [[Mini Micro]] (version 1.2.2 and later) introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay.  Give this method an integer from 0-7.  Values 0-3 rotate the tile in 90° increments.  Values 4-7 first flip the tile horizontally, and then rotate it in 90° increments.&lt;br /&gt;
&lt;br /&gt;
[[File:CellTransform.png|frameless|center]]&lt;br /&gt;
See also: [[TileDisplay.cellTransfrom]]&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;
| ''x'' || number || 0 || column (or list of columns) of cell to change&lt;br /&gt;
|-&lt;br /&gt;
| ''y'' || number || 0 || row (or list of rows) of cell to change&lt;br /&gt;
|-&lt;br /&gt;
| ''transform'' || number || &amp;lt;c&amp;gt;[[null]]&amp;lt;/c&amp;gt; || transform (0-7) to apply to the given cell&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This example configures display 4 to be a [[TileDisplay]], loads a tile set, and then sets the cell at column 5, row 5 to be tile index 70 (a green key in this tile set).  It then cycles through all 8 transforms, one per half second.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
display(4).mode = displayMode.tile&lt;br /&gt;
td = display(4)&lt;br /&gt;
td.tileSet = file.loadImage(&amp;quot;/sys/pics/SimplePlatformTiles.png&amp;quot;)&lt;br /&gt;
td.tileSetTileSize = 64&lt;br /&gt;
td.cellSize = 64&lt;br /&gt;
td.clear&lt;br /&gt;
&lt;br /&gt;
td.setCell 5, 5, 70  // green key&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
	td.setCellTransform 5, 5, (td.cellTransform(5,5)+1) % 8&lt;br /&gt;
	text.row = 12; text.column = 25&lt;br /&gt;
	print td.cellTransform(5,5)&lt;br /&gt;
	wait 0.5&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:setCellTransform.gif|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay.cellTransform&amp;diff=1357</id>
		<title>TileDisplay.cellTransform</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay.cellTransform&amp;diff=1357"/>
		<updated>2025-02-22T15:10:43Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Mini Micro]] version 1.2.2 introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay.  The value returned by &amp;lt;c&amp;gt;TileDisplay.cellTransform&amp;lt;/c&amp;gt;, or given to &amp;lt;c&amp;gt;[[TileDisplay.setCellTransform]]&amp;lt;/c&amp;gt;, is an integer from 0-7.  Values 0-3 rotate the tile in 90° increments.  Values 4-7 first flip the tile horizontally, and then rotate it in 90° increments.&lt;br /&gt;
&lt;br /&gt;
[[File:CellTransform.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay&amp;diff=1356</id>
		<title>TileDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay&amp;diff=1356"/>
		<updated>2025-02-22T15:09:39Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: add new cellTransform methods&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;
|-&lt;br /&gt;
! Method or Property !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.extent]] ''[columns, rows]'' || display size&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.tileSet]]  || [[Image]] containing tiles to draw from&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.tileSetTileSize]] || size of tiles in `tileSet`&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.cellSize]] || size of tiles on screen&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.overlap]] || cell overlap, in pixels&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.oddRowOffset]] || amount to shift odd rows horizontally; use 0.5 for hex rows&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.oddColOffset]] || amount to shift odd columns vertically; use 0.5 for hex columns&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.scrollX]] || horizontal scroll amount, in pixels&lt;br /&gt;
|-&lt;br /&gt;
| [[TileDisplay.scrollY]] || vertical scroll amount, in pixels&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;
| [[TileDisplay.cell]](''x'', ''y'') || get the tile index of cell ''x'', ''y''&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;
| [[TileDisplay.cellTint]](''x'', ''y'') || get the tint color of cell ''x'', ''y''&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.cellTransform]](''x'', ''y'') || get the transform (0-7) of cell at ''x'', ''y''&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>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Naming_Conventions&amp;diff=1351</id>
		<title>Naming Conventions</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Naming_Conventions&amp;diff=1351"/>
		<updated>2025-02-15T23:26:46Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Capitalization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The MiniScript [[:Category:Intrinsic Functions|intrinsic functions]] and [[Mini Micro]] API have established the following conventions with regard to naming variables.&lt;br /&gt;
&lt;br /&gt;
== Capitalization ==&lt;br /&gt;
* classes (maps intended to be used with [[new]]) use captialized CamelCase: &amp;lt;c&amp;gt;Monster&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;RigidBody&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;InventoryItem&amp;lt;/c&amp;gt;&lt;br /&gt;
* method names use camelCase, starting with lower-case, e.g.: &amp;lt;c&amp;gt;[[print]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;calcTotal&amp;lt;/c&amp;gt;&lt;br /&gt;
* variables follow the same convention: &amp;lt;c&amp;gt;x&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;totalIncome&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
UPDATE: Recent discussion has led to also capitalizing &amp;quot;static&amp;quot; class members, i.e., methods and properties which are intended to be called directly on a class rather than on some instance of the class.  For example, &amp;lt;c&amp;gt;Monster.Instances&amp;lt;/c&amp;gt; might be a list on the &amp;lt;c&amp;gt;Monster&amp;lt;/c&amp;gt; class that keeps track of all the instances of that class.  This convention is not yet consistently used, but it is recommended and catching on.&lt;br /&gt;
&lt;br /&gt;
== Nouns vs. Verbs ==&lt;br /&gt;
&lt;br /&gt;
In general, methods that perform some operation should be active verbs, e.g. &amp;lt;c&amp;gt;[[print]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;[[wait]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;applyDiscount&amp;lt;/c&amp;gt;.  Clear abbreviations are acceptable when a name would otherwise be unwieldy, e.g. &amp;lt;c&amp;gt;calcTotal&amp;lt;/c&amp;gt; instead of &amp;lt;c&amp;gt;calculateTotal&amp;lt;/c&amp;gt;.  Methods that merely return an attribute (whether stored or calculated) should be named for what they return, e.g. &amp;lt;c&amp;gt;[[abs]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;average&amp;lt;/c&amp;gt;.  (The line between these two cases can be fuzzy; favor a simple attribute name if the calculation is quick and has no side effects, but an active verb if the calculation may take some time or has any effects beyond returning the answer.)&lt;br /&gt;
&lt;br /&gt;
Object references should be descriptive nouns, e.g. &amp;lt;c&amp;gt;player&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;annualIncome&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Avoid Starting With an Underscore ==&lt;br /&gt;
&lt;br /&gt;
Per the MiniScript manual, in most cases you should avoid starting any global variables or function names with an underscore. Identifiers starting with an underscore are often used by the host environment for special “under the hood” code, and name collisions there could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Short Names ==&lt;br /&gt;
&lt;br /&gt;
Very short variable names should be used only for fleeting purposes, such as loop counters in small loops, or parameter names in small functions.  They are also often used when experimenting in a [[REPL]].  The following names are generally understood:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;c&amp;gt;i&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;j&amp;lt;/c&amp;gt;: loop counters (usually numbers)&lt;br /&gt;
* &amp;lt;c&amp;gt;c&amp;lt;/c&amp;gt;: character (e.g. while looping over a string)&lt;br /&gt;
* &amp;lt;c&amp;gt;x&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;y&amp;lt;/c&amp;gt;: 2D coordinates&lt;br /&gt;
* &amp;lt;c&amp;gt;dx&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;dy&amp;lt;/c&amp;gt;: 2D offset&lt;br /&gt;
* &amp;lt;c&amp;gt;vx&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;vy&amp;lt;/c&amp;gt;: 2D velocity&lt;br /&gt;
* &amp;lt;c&amp;gt;t&amp;lt;/c&amp;gt;: time&lt;br /&gt;
* &amp;lt;c&amp;gt;dt&amp;lt;/c&amp;gt;: time step or offset&lt;br /&gt;
* &amp;lt;c&amp;gt;s&amp;lt;/c&amp;gt;: a string, or any sequence&lt;br /&gt;
* &amp;lt;c&amp;gt;m&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;d&amp;lt;/c&amp;gt;: a map (&amp;lt;c&amp;gt;d&amp;lt;/c&amp;gt; is short for &amp;quot;dictionary&amp;quot;)&lt;br /&gt;
* &amp;lt;c&amp;gt;l&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;a&amp;lt;/c&amp;gt;: a list (&amp;lt;c&amp;gt;a&amp;lt;/c&amp;gt; is short for &amp;quot;array&amp;quot;; and note that &amp;lt;c&amp;gt;l&amp;lt;/c&amp;gt; looks very similar to &amp;lt;c&amp;gt;1&amp;lt;/c&amp;gt;, and so should probably be avoided)&lt;br /&gt;
&lt;br /&gt;
[[Category:Conventions]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Naming_Conventions&amp;diff=1350</id>
		<title>Naming Conventions</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Naming_Conventions&amp;diff=1350"/>
		<updated>2025-02-15T23:25:13Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Capitalization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The MiniScript [[:Category:Intrinsic Functions|intrinsic functions]] and [[Mini Micro]] API have established the following conventions with regard to naming variables.&lt;br /&gt;
&lt;br /&gt;
== Capitalization ==&lt;br /&gt;
* classes (maps intended to be used with [[new]]) use captialized CamelCase: &amp;lt;c&amp;gt;Monster&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;RigidBody&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;InventoryItem&amp;lt;/c&amp;gt;&lt;br /&gt;
* method names use camelCase, starting with lower-case, e.g.: &amp;lt;c&amp;gt;[[print]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;calcTotal&amp;lt;/c&amp;gt;&lt;br /&gt;
* variables follow the same convention: &amp;lt;c&amp;gt;x&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;totalIncome&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
UPDATE: Recent discussion has led to also capitalizing &amp;quot;static&amp;quot; class members, i.e., methods and properties which are intended to be called directly on a class rather than on some instance of the class.&lt;br /&gt;
&lt;br /&gt;
== Nouns vs. Verbs ==&lt;br /&gt;
&lt;br /&gt;
In general, methods that perform some operation should be active verbs, e.g. &amp;lt;c&amp;gt;[[print]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;[[wait]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;applyDiscount&amp;lt;/c&amp;gt;.  Clear abbreviations are acceptable when a name would otherwise be unwieldy, e.g. &amp;lt;c&amp;gt;calcTotal&amp;lt;/c&amp;gt; instead of &amp;lt;c&amp;gt;calculateTotal&amp;lt;/c&amp;gt;.  Methods that merely return an attribute (whether stored or calculated) should be named for what they return, e.g. &amp;lt;c&amp;gt;[[abs]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;average&amp;lt;/c&amp;gt;.  (The line between these two cases can be fuzzy; favor a simple attribute name if the calculation is quick and has no side effects, but an active verb if the calculation may take some time or has any effects beyond returning the answer.)&lt;br /&gt;
&lt;br /&gt;
Object references should be descriptive nouns, e.g. &amp;lt;c&amp;gt;player&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;annualIncome&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Avoid Starting With an Underscore ==&lt;br /&gt;
&lt;br /&gt;
Per the MiniScript manual, in most cases you should avoid starting any global variables or function names with an underscore. Identifiers starting with an underscore are often used by the host environment for special “under the hood” code, and name collisions there could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Short Names ==&lt;br /&gt;
&lt;br /&gt;
Very short variable names should be used only for fleeting purposes, such as loop counters in small loops, or parameter names in small functions.  They are also often used when experimenting in a [[REPL]].  The following names are generally understood:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;c&amp;gt;i&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;j&amp;lt;/c&amp;gt;: loop counters (usually numbers)&lt;br /&gt;
* &amp;lt;c&amp;gt;c&amp;lt;/c&amp;gt;: character (e.g. while looping over a string)&lt;br /&gt;
* &amp;lt;c&amp;gt;x&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;y&amp;lt;/c&amp;gt;: 2D coordinates&lt;br /&gt;
* &amp;lt;c&amp;gt;dx&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;dy&amp;lt;/c&amp;gt;: 2D offset&lt;br /&gt;
* &amp;lt;c&amp;gt;vx&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;vy&amp;lt;/c&amp;gt;: 2D velocity&lt;br /&gt;
* &amp;lt;c&amp;gt;t&amp;lt;/c&amp;gt;: time&lt;br /&gt;
* &amp;lt;c&amp;gt;dt&amp;lt;/c&amp;gt;: time step or offset&lt;br /&gt;
* &amp;lt;c&amp;gt;s&amp;lt;/c&amp;gt;: a string, or any sequence&lt;br /&gt;
* &amp;lt;c&amp;gt;m&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;d&amp;lt;/c&amp;gt;: a map (&amp;lt;c&amp;gt;d&amp;lt;/c&amp;gt; is short for &amp;quot;dictionary&amp;quot;)&lt;br /&gt;
* &amp;lt;c&amp;gt;l&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;a&amp;lt;/c&amp;gt;: a list (&amp;lt;c&amp;gt;a&amp;lt;/c&amp;gt; is short for &amp;quot;array&amp;quot;; and note that &amp;lt;c&amp;gt;l&amp;lt;/c&amp;gt; looks very similar to &amp;lt;c&amp;gt;1&amp;lt;/c&amp;gt;, and so should probably be avoided)&lt;br /&gt;
&lt;br /&gt;
[[Category:Conventions]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=SolidColorDisplay&amp;diff=1348</id>
		<title>SolidColorDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=SolidColorDisplay&amp;diff=1348"/>
		<updated>2025-02-10T17:15:33Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Added fade out/in example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;SolidColorDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that represents a single color over the entire screen.  It is often used to control overall background color of the screen, or as an overlay to fade the rest of the displays in or out.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;quot;solid&amp;quot; here refers to the entire display layer being one color.  It does ''not'' imply that this color must be opaque; translucent colors work perfectly well.&lt;br /&gt;
&lt;br /&gt;
By default, [[display]] 7 is configured as a solid black display (by the [[clear]] command).&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
&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;
| [[SolidColorDisplay.color]] || get or set the color of the display layer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
The following example sets the background (display 7) to blue, and also clears the pixel display (layer 5) to clear so that the background can be seen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
display(7).color = color.blue&lt;br /&gt;
display(5).clear color.clear&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next example does a &amp;quot;fade to black&amp;quot; by setting display 0 (the topmost layer) to solid color, and gradually changing it from completely transparent to solid black.  Then, after waiting for the user to press a key, it fades back to transparent, making everything behind it appear to &amp;quot;fade in.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;display(0).mode = displayMode.solidColor&lt;br /&gt;
fader = display(0)&lt;br /&gt;
for alpha in range(0, 255, 3)&lt;br /&gt;
	fader.color = color.rgba(0,0,0, alpha)&lt;br /&gt;
	yield&lt;br /&gt;
end for&lt;br /&gt;
&lt;br /&gt;
key.get  // wait for a keypress&lt;br /&gt;
&lt;br /&gt;
for alpha in range(255, 0, -3)&lt;br /&gt;
	fader.color = color.rgba(0,0,0, alpha)&lt;br /&gt;
	yield&lt;br /&gt;
end for&lt;br /&gt;
display(0).mode = displayMode.off&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=If&amp;diff=1347</id>
		<title>If</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=If&amp;diff=1347"/>
		<updated>2025-02-06T15:22:14Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Added indentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt; is the [[:Category:Keywords|keyword]] that begins an ''if block''.  Use an &amp;lt;c&amp;gt;if…then&amp;lt;/c&amp;gt; statement to specify some condition under which the following statements should be executed. The basic syntax is:&lt;br /&gt;
&lt;br /&gt;
:'''if''' ''condition'' '''then'''&lt;br /&gt;
:…&lt;br /&gt;
:'''end if'''&lt;br /&gt;
&lt;br /&gt;
When the condition is not true, MiniScript will jump directly to the &amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;if x == 42 then&lt;br /&gt;
   print &amp;quot;I have found the Ultimate Answer!&amp;quot;&lt;br /&gt;
end if&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The whole set of lines, from &amp;lt;c&amp;gt;if…then&amp;lt;/c&amp;gt; to &amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt;, is known as an ''if block''.&lt;br /&gt;
Sometimes you want to do something else when the specified condition is not true. You can&lt;br /&gt;
specify this with an ''else block'' before the &amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;if x == 42 then&lt;br /&gt;
   print &amp;quot;I have found the Ultimate Answer!&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
   print &amp;quot;I am still searching.&amp;quot;&lt;br /&gt;
end if&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you can check for additional conditions by adding ''else-if blocks'' as needed. Here's a&lt;br /&gt;
slightly more practical example that converts a number to words.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;if apples == 0 then&lt;br /&gt;
   print &amp;quot;You have no apples.&amp;quot;&lt;br /&gt;
else if apples == 1 then&lt;br /&gt;
   print &amp;quot;You have one apple.&amp;quot;&lt;br /&gt;
else if apples &amp;gt; 10 then&lt;br /&gt;
   print &amp;quot;You have a lot of apples!&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
   print &amp;quot;You have &amp;quot; + apples + &amp;quot; apples.&amp;quot;&lt;br /&gt;
end if&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, the first condition that matches will execute its block of lines. If none of the&lt;br /&gt;
conditions match, then the &amp;lt;c&amp;gt;else&amp;lt;/c&amp;gt; block will run instead.&lt;br /&gt;
&lt;br /&gt;
Note that for all these forms, the &amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;else if&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;else&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt; statements must each be&lt;br /&gt;
on its own line. However, there is also a &amp;quot;short form&amp;quot; &amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt; statement that allows you to write&lt;br /&gt;
an &amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;if/else&amp;lt;/c&amp;gt; on a single line, provided you have only a single statement for the then&lt;br /&gt;
block, and a single statement for the &amp;lt;c&amp;gt;else&amp;lt;/c&amp;gt; block (if you have an &amp;lt;c&amp;gt;else&amp;lt;/c&amp;gt; block at all). A shortform&lt;br /&gt;
if looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;if x == null then x = 1&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
…while a short-form if/else looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;if x &amp;gt;= 0 then print &amp;quot;positive&amp;quot; else print &amp;quot;negative&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt; is not used with a short-form &amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;if/else&amp;lt;/c&amp;gt;. Moreover, there is no&lt;br /&gt;
way to put more than one statement into the &amp;lt;c&amp;gt;then&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;else&amp;lt;/c&amp;gt; block. If you need more than&lt;br /&gt;
one statement, then use the standard multi-line form.&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Keywords]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Category:Sys_Modules&amp;diff=1345</id>
		<title>Category:Sys Modules</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Category:Sys_Modules&amp;diff=1345"/>
		<updated>2025-01-31T14:31:52Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;System modules are libraries of classes and functions that expand and build on [[Mini Micro]]'s native classes.  These modules add more features to aid in game development.  Some of these libraries are also available in [[Farmtronics]], [[command-line MiniScript]], and [[Soda]].  Source for these libraries can be found under the [[/sys]]/lib folder of [[Mini Micro]] or on [https://github.com/JoeStrout/minimicro-sysdisk/tree/master/sys/lib Github].&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Key.put&amp;diff=1300</id>
		<title>Key.put</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Key.put&amp;diff=1300"/>
		<updated>2025-01-29T20:42:06Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[key]].put&amp;lt;/c&amp;gt; allows you to enqueue a string, or single character by code point, into the keyboard buffer used by both the command line and the [[input]] function.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
// Put MiniScript code for a countdown from 10 to 1, then print &amp;quot;BOOM!&amp;quot;&lt;br /&gt;
key.put &amp;quot;for i in range(10, 1); clear; print i; wait; end for; clear; print &amp;quot;&amp;quot;BOOM!&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
key.put 13 // carriage return&lt;br /&gt;
&lt;br /&gt;
// Put MiniScript code to print &amp;quot;Hello, World!&amp;quot;&lt;br /&gt;
key.put &amp;quot;print &amp;quot;&amp;quot;Hello, World!&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
key.put 13 // carriage return&lt;br /&gt;
&lt;br /&gt;
key.put 99  // c&lt;br /&gt;
key.put 108 // l&lt;br /&gt;
key.put 101 // e&lt;br /&gt;
key.put 97  // a&lt;br /&gt;
key.put 114 // r&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Or&amp;diff=1299</id>
		<title>Or</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Or&amp;diff=1299"/>
		<updated>2025-01-29T20:40:08Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;or&amp;lt;/c&amp;gt; is a [[:Category:Keywords|keyword]] for logical binary operator of disjunction (or) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra] and [[Fuzzy Logic]]. It evaluates two operands and returns &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt; when at least one of the operands is &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt;, else it returns &amp;lt;c&amp;gt;false&amp;lt;/c&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
More specifically, &amp;lt;c&amp;gt;a or b&amp;lt;/c&amp;gt; (where ''a'' and ''b'' are numbers) evaluates to the absolute value of the expression &amp;lt;c&amp;gt;a + b - (a * b)&amp;lt;/c&amp;gt;, clamped to the range 0 - 1.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
print false or false // output : 0&lt;br /&gt;
print false or true  // output : 1&lt;br /&gt;
print true or false  // output : 1&lt;br /&gt;
print true or true   // output : 1&lt;br /&gt;
print 0.8 or 0.5     // output : 0.9&lt;br /&gt;
&lt;br /&gt;
a = false&lt;br /&gt;
b = true&lt;br /&gt;
c = false&lt;br /&gt;
print a or b // output : 1&lt;br /&gt;
print b or c // output : 1&lt;br /&gt;
print a or c // output : 0&lt;br /&gt;
&lt;br /&gt;
minimum = 3&lt;br /&gt;
maximum = 7&lt;br /&gt;
A = 4&lt;br /&gt;
B = 9&lt;br /&gt;
print A &amp;gt; minimum or B &amp;lt; maximum // output : 1&lt;br /&gt;
print A &amp;lt; minimum or B &amp;lt; maximum // output : 0&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[and]], [[not]], [[Fuzzy Logic]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Keywords]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=And&amp;diff=1298</id>
		<title>And</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=And&amp;diff=1298"/>
		<updated>2025-01-29T20:39:48Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;and&amp;lt;/c&amp;gt; is a [[:Category:Keywords|keyword]] for logical binary operator of conjunction (and) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra] and [[Fuzzy Logic]]. It evaluates two operands and returns &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt; only when both operands are &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt;, else it returns &amp;lt;c&amp;gt;false&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
More specifically, &amp;lt;c&amp;gt;a and b&amp;lt;/c&amp;gt;, where ''a'' and ''b'' are numbers, evaluates to the absolute value of the product &amp;lt;c&amp;gt;a * b&amp;lt;/c&amp;gt;, clamped to the range 0 - 1.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
print false and false // output : 0&lt;br /&gt;
print false and true  // output : 0&lt;br /&gt;
print true and false  // output : 0&lt;br /&gt;
print true and true   // output : 1&lt;br /&gt;
print 0.8 and 0.5     // output : 0.4&lt;br /&gt;
&lt;br /&gt;
a = true&lt;br /&gt;
b = false&lt;br /&gt;
c = true&lt;br /&gt;
print a and b // output : 0&lt;br /&gt;
print b and c // output : 0&lt;br /&gt;
print a and c // output : 1&lt;br /&gt;
&lt;br /&gt;
minimum = 3&lt;br /&gt;
maximum = 7&lt;br /&gt;
A = 4&lt;br /&gt;
B = 9&lt;br /&gt;
print A &amp;gt; minimum and A &amp;lt; maximum // output : 1&lt;br /&gt;
print B &amp;gt; minimum and B &amp;lt; maximum // output : 0&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[or]], [[not]], [[Fuzzy Logic]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Keywords]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=And&amp;diff=1297</id>
		<title>And</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=And&amp;diff=1297"/>
		<updated>2025-01-29T20:38:45Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;and&amp;lt;/c&amp;gt; is a [[:Category:Keywords|keyword]] for logical binary operator of conjunction (and) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra] and [[Fuzzy Logic]]. It evaluates two operands and returns &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt; only when both operands are &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt;, else it returns &amp;lt;c&amp;gt;false&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
More specifically, &amp;lt;c&amp;gt;a and b&amp;lt;/c&amp;gt;, where ''a'' and ''b'' are numbers, evaluates to the absolute value of the product &amp;lt;c&amp;gt;a * b&amp;lt;/c&amp;gt;, clamped to the range 0 - 1.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
print false and false // output : 0&lt;br /&gt;
print false and true  // output : 0&lt;br /&gt;
print true and false  // output : 0&lt;br /&gt;
print true and true   // output : 1&lt;br /&gt;
print 0.8 and 0.5     // output : 0.4&lt;br /&gt;
&lt;br /&gt;
a = true&lt;br /&gt;
b = false&lt;br /&gt;
c = true&lt;br /&gt;
print a and b // output : 0&lt;br /&gt;
print b and c // output : 0&lt;br /&gt;
print a and c // output : 1&lt;br /&gt;
&lt;br /&gt;
minimum = 3&lt;br /&gt;
maximum = 7&lt;br /&gt;
A = 4&lt;br /&gt;
B = 9&lt;br /&gt;
print A &amp;gt; minimum and A &amp;lt; maximum // output : 1&lt;br /&gt;
print B &amp;gt; minimum and B &amp;lt; maximum // output : 0&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Fuzzy Logic]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Keywords]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Or&amp;diff=1296</id>
		<title>Or</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Or&amp;diff=1296"/>
		<updated>2025-01-29T20:38:10Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;or&amp;lt;/c&amp;gt; is a [[:Category:Keywords|keyword]] for logical binary operator of disjunction (or) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra] and [[Fuzzy Logic]]. It evaluates two operands and returns &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt; when at least one of the operands is &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt;, else it returns &amp;lt;c&amp;gt;false&amp;lt;/c&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
More specifically, &amp;lt;c&amp;gt;a or b&amp;lt;/c&amp;gt; (where ''a'' and ''b'' are numbers) evaluates to the absolute value of the expression &amp;lt;c&amp;gt;a + b - (a * b)&amp;lt;/c&amp;gt;, clamped to the range 0 - 1.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
print false or false // output : 0&lt;br /&gt;
print false or true  // output : 1&lt;br /&gt;
print true or false  // output : 1&lt;br /&gt;
print true or true   // output : 1&lt;br /&gt;
print 0.8 or 0.5     // output : 0.9&lt;br /&gt;
&lt;br /&gt;
a = false&lt;br /&gt;
b = true&lt;br /&gt;
c = false&lt;br /&gt;
print a or b // output : 1&lt;br /&gt;
print b or c // output : 1&lt;br /&gt;
print a or c // output : 0&lt;br /&gt;
&lt;br /&gt;
minimum = 3&lt;br /&gt;
maximum = 7&lt;br /&gt;
A = 4&lt;br /&gt;
B = 9&lt;br /&gt;
print A &amp;gt; minimum or B &amp;lt; maximum // output : 1&lt;br /&gt;
print A &amp;lt; minimum or B &amp;lt; maximum // output : 0&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Keywords]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=And&amp;diff=1295</id>
		<title>And</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=And&amp;diff=1295"/>
		<updated>2025-01-29T20:35:51Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;and&amp;lt;/c&amp;gt; is a [[:Category:Keywords|keyword]] for logical binary operator of conjunction (and) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra] and [[Fuzzy Logic]]. It evaluates two operands and returns &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt; only when both operands are &amp;lt;c&amp;gt;true&amp;lt;/c&amp;gt;, else it returns &amp;lt;c&amp;gt;false&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
More specifically, &amp;lt;c&amp;gt;a and b&amp;lt;/c&amp;gt;, where ''a'' and ''b'' are numbers, evaluates to the absolute value of the product &amp;lt;c&amp;gt;a * b&amp;lt;/c&amp;gt;, clamped to the range 0 - 1.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
print false and false // output : 0&lt;br /&gt;
print false and true  // output : 0&lt;br /&gt;
print true and false  // output : 0&lt;br /&gt;
print true and true   // output : 1&lt;br /&gt;
&lt;br /&gt;
a = true&lt;br /&gt;
b = false&lt;br /&gt;
c = true&lt;br /&gt;
print a and b // output : 0&lt;br /&gt;
print b and c // output : 0&lt;br /&gt;
print a and c // output : 1&lt;br /&gt;
&lt;br /&gt;
minimum = 3&lt;br /&gt;
maximum = 7&lt;br /&gt;
A = 4&lt;br /&gt;
B = 9&lt;br /&gt;
print A &amp;gt; minimum and A &amp;lt; maximum // output : 1&lt;br /&gt;
print B &amp;gt; minimum and B &amp;lt; maximum // output : 0&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Fuzzy Logic]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Keywords]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=PixelDisplay.getImage&amp;diff=1286</id>
		<title>PixelDisplay.getImage</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=PixelDisplay.getImage&amp;diff=1286"/>
		<updated>2025-01-29T15:18:24Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: fixed typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[PixelDisplay]].getImage&amp;lt;/c&amp;gt; returns a portion of the pixel display as an [[Image]].&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;
| ''left'' || number || 0 || left side of display area to get&lt;br /&gt;
|-&lt;br /&gt;
| ''bottom'' || number || 0 || bottom side of display area to get&lt;br /&gt;
|-&lt;br /&gt;
| ''width'' || number || 960 || width side of display area to get&lt;br /&gt;
|-&lt;br /&gt;
| ''height'' || number || 640 || height side of display area to get&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
=== Usage Notes ===&lt;br /&gt;
Note that this works even for a display that is not visible (because it is covered by another&lt;br /&gt;
display, or has been turned [[DisplayMode|off]]).  This allows you to use&lt;br /&gt;
a PixelDisplay as an area to create images at runtime, using any combination&lt;br /&gt;
of drawing methods, and then capture the result for use as a [[Sprite]], or&lt;br /&gt;
to [[File.saveImage|save]] to disk, etc.&lt;br /&gt;
&lt;br /&gt;
Another way to create an [[Image]] at runtime is to use [[Image.create]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Image.flip&amp;diff=1280</id>
		<title>Image.flip</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Image.flip&amp;diff=1280"/>
		<updated>2025-01-18T14:22:17Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Fix minor formatting error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[Image]].flip&amp;lt;/c&amp;gt; flips an image in memory, either vertically or horizontally.&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;
| ''vertical'' || boolean || false || flips the image vertically when true and horizontally when false &lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;img = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
img.flip false&lt;br /&gt;
view img&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the above code, &amp;lt;c&amp;gt;img&amp;lt;/c&amp;gt; refers to a horizontally-flipped version of the standard Wumpus image.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Soda]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Image.rotate&amp;diff=1279</id>
		<title>Image.rotate</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Image.rotate&amp;diff=1279"/>
		<updated>2025-01-18T14:21:47Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[Image]].rotate&amp;lt;/c&amp;gt; rotates an image in memory, in 90 degree increments.  All other degree values will print an error and have no effect on the image.  Values that fall outside of 0 to 360 are valid so long as they are increments of 90 degrees.&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;
| ''degrees'' || number || 90 || amount of counter-clockwise rotation to apply&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;img = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
img.rotate -90&lt;br /&gt;
view img&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the above code, &amp;lt;c&amp;gt;img&amp;lt;/c&amp;gt; refers to a version of the standard Wumpus image that has been rotated 90° to the right.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Soda]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Image.flip&amp;diff=1278</id>
		<title>Image.flip</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Image.flip&amp;diff=1278"/>
		<updated>2025-01-18T14:19:04Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[Image]].flip&amp;lt;/c&amp;gt; flips an image in memory, either vertically or horizontally.&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;
| ''vertical'' || boolean || false || flips the image vertically when true and horizontally when false &lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;img = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
img.flip false&lt;br /&gt;
view img&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the above code, `img` refers to a horizontally-flipped version of the standard Wumpus image.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Soda]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File.setdir&amp;diff=1277</id>
		<title>File.setdir</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.setdir&amp;diff=1277"/>
		<updated>2025-01-18T14:15:31Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: included Farmtronics and note about quotes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;[[file]].setdir&amp;lt;/c&amp;gt; method sets the current working directory in [[Mini Micro]], [[Farmtronics]], or [[command-line MiniScript]].&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;
| ''path'' || string || || the relative or absolute location of the folder to set as the working directory&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
In [[Mini Micro]] and [[Farmtronics]], &amp;lt;c&amp;gt;[[cd]]&amp;lt;/c&amp;gt; is standard shorthand for &amp;lt;c&amp;gt;[[file]].setdir&amp;lt;/c&amp;gt;.  Note that you still need quotation marks around the path.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line MiniScript]]&lt;br /&gt;
[[Category:Farmtronics]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1265</id>
		<title>How to get started with Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1265"/>
		<updated>2024-12-19T14:06:38Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Create a sprite */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://miniscript.org/MiniMicro/ Mini Micro] is a popular environment for creating 2D games and demos in MiniScript.  It is a retro-style virtual computer, which runs on most desktop platforms.  Mini Micro games can be [[How to package a Mini Micro game|packaged]] as stand-alone games for desktop or the web. &lt;br /&gt;
&lt;br /&gt;
This page is meant for people who have never used Mini Micro before, but want to make a Mini Micro game.  It is a step-by-step guide to building your first simple demo involving a sprite, game input, and sound effects, including your own resources, as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Get Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
While you can run Mini Micro on the web, the web version has no ability to save files (nor does it support copy/paste).  So it's not useful for developing your own Mini Micro games.&lt;br /&gt;
&lt;br /&gt;
Go to the [https://miniscript.org/MiniMicro/#download Mini Micro download] page, click the button for your platform (Mac, Windows, or Linux), and save the resulting file to your local machine.  (If you don't have a Mac, Windows, or Linux desktop machine, then unfortunately you can't use Mini Micro yet, though iOS and Android versions are under development.)&lt;br /&gt;
&lt;br /&gt;
The downloaded file will be a .zip (Mac/Windows) or .tar.gz (Linux) file.  ''Unpack this file completely.''  Don't try to run Mini Micro from ''within'' the archive; extract all files to a real folder on your hard drive.&lt;br /&gt;
&lt;br /&gt;
Then, find the Mini Micro application in that folder.  Double-click it to launch Mini Micro.  The result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:MiniMicro.png|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Mount a folder as /usr ==&lt;br /&gt;
&lt;br /&gt;
Mini Micro can access two virtual &amp;quot;disks&amp;quot; at once; within the Mini Micro environment, these are accessed as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Each of these can be either a '''.minidisk file''', or a '''real folder''' on the host (desktop) system.  Out of the box, Mini Micro creates an empty .minidisk file for you, to keep things nice and neat.  But for any serious development, you're going to want to mount a real folder instead, so that you can easily move files in and out of this folder, use your favorite external image/sound editors, etc.&lt;br /&gt;
&lt;br /&gt;
Create a folder on your desktop system, wherever you normally keep your documents.  This will be your project folder for your first Mini Micro game.  Put a small text file, image (in PNG or JPEG format), or sound file (in WAV or OGG format) in there.  Our goal now is to see and view this file (and any others in that folder or its subfolders) in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the disk slot menu ===&lt;br /&gt;
&lt;br /&gt;
Those two thin dark rectangles in the bottom-left corner of the Mini Micro window are &amp;quot;disk slots.&amp;quot;  The top slot represents &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;, and the bottom slot represents &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Click the top slot to pop open the menu, and select the &amp;quot;Mount Folder...&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Selecting that command should bring up the native file dialog for your platform, allowing you to select any folder you have access to.  Pick the project folder you created above.  (Note: some Linux platforms have a bug which crashes Mini Micro at this point; if that happens to you, go on to Method 2.)&lt;br /&gt;
&lt;br /&gt;
Now, in the Mini Micro display, at the blinking orange prompt, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;dir&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and press Return or Enter.  You should see your file listed.  Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;view &amp;quot;myfile.txt&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
but replace ''myfile.txt'' with the name of whatever file you placed in your project folder.  Be sure to include the quotation marks; you're typing MiniScript code here, not some other shell language, so string literals always need to be surrounded by double quotes.  If you do it correctly, the contents of your text file or image should appear on the screen.&lt;br /&gt;
&lt;br /&gt;
(You could also do &amp;lt;c&amp;gt;view findFile&amp;lt;/c&amp;gt;, which would pop up the little file browser within the [[findFile]] command, and select your file that way.)&lt;br /&gt;
&lt;br /&gt;
Note that the currently mounted disk is saved in preferences, so if you quit and relaunch Mini Micro, you generally won't need to do this step again; the previously mounted disks will still be there.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use command-line arguments ===&lt;br /&gt;
&lt;br /&gt;
If you are unfortunate enough to hit that Linux bug which causes the file dialogs to crash, or for some other reason you want to launch Mini Micro from the command line (or a shell script) with the correct folder already mounted, then you can use [[Command-line arguments|command-line arguments]] instead.  Open your favorite terminal program, and navigate to where the Mini Micro executable is located.  The details vary by platform, so let's break it down:&lt;br /&gt;
&lt;br /&gt;
'''Linux'''&lt;br /&gt;
&lt;br /&gt;
In Linux, the executable is called '''MiniMicro.x86_64''', so you would type a command like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;./MiniMicro.x86_64 -usr ~/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''Windows'''&lt;br /&gt;
&lt;br /&gt;
In Windows, you can open the command prompt by pressing '''Win + R''' to open the Run dialog, and entering ''cmd''.  (If you already have some other preferred terminal app, like PowerShell, that's fine too.)  Then &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; to the directory containing Mini Micro.  The executable here is called '''Mini Micro.exe''', so you would use a command like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&amp;quot;Mini Micro.exe&amp;quot; -usr &amp;quot;%HOMEPATH%\mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;%HOMEPATH%\mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''MacOS'''&lt;br /&gt;
&lt;br /&gt;
On Mac, the actual executable is hidden inside the application bundle, specifically under Contents/MacOS.  So if you've already launched Terminal and navigated to where '''MiniMicro.app''' is found, then you would do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Contents/MacOS/Mini\ Micro -usr ~/Documents/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/Documents/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
If successful (on any platform), you should be able to use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to view the file in your project folder within the Mini Micro environment.&lt;br /&gt;
&lt;br /&gt;
== Create a sprite ==&lt;br /&gt;
&lt;br /&gt;
Now let's get a sprite up on the screen.  We're going to do this using the Mini Micro command line (or [[REPL]]), where you type a command and executes immediately.  We'll get to writing real programs later, but the command-line is a powerful tool for learning and exploring, so let's use it.&lt;br /&gt;
&lt;br /&gt;
=== 1. Make a sprite from the built-in images ===&lt;br /&gt;
&lt;br /&gt;
At the orange blinking-cursor prompt in Mini Micro, carefully type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a furry purple Wumpus peeking out from the lower-left corner of the screen (which is the origin of Mini Micro's [[Screen coordinates|coordinate system]]).&lt;br /&gt;
&lt;br /&gt;
[[File:ManualSprite.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
If you don't see this, go back and double-check your typing.  Note that you can recall a previous command on the command line by pressing the '''up-arrow''' key, then just edit it and press Return to run the edited command.&lt;br /&gt;
&lt;br /&gt;
How does this work?  Let's break it down:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; clears the screen and resets all eight display layers to their default states.  This includes setting display 4 to be a [[SpriteDisplay]].  (That's the default state when Mini Micro boots, but useful whenever your screen is cluttered anyway.)&lt;br /&gt;
# &amp;lt;c&amp;gt;sp = new Sprite&amp;lt;/c&amp;gt; creates a new [[Sprite]] object, and assigns it to a variable called &amp;lt;c&amp;gt;sp&amp;lt;/c&amp;gt;.&lt;br /&gt;
# &amp;lt;c&amp;gt;sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&amp;lt;/c&amp;gt; loads an image called &amp;quot;Wumpus.png&amp;quot; from the &amp;lt;c&amp;gt;/sys/pics&amp;lt;/c&amp;gt; directory.  (Notice that Mini Micro uses forward-slashes in file paths, even if the host system is Windows.)&lt;br /&gt;
# &amp;lt;c&amp;gt;display(4).sprites.push sp&amp;lt;/c&amp;gt; pushes this new sprite onto the sprite list of display 4, so it can be seen.&lt;br /&gt;
&lt;br /&gt;
Once you have the Wumpus peeking out of the corner, let's move it and rotate it a bit.  Notice how the sprite updates immediately after each command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp.x = 480&lt;br /&gt;
sp.y = 320&lt;br /&gt;
sp.rotation = 45&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Make a sprite from your own custom image ===&lt;br /&gt;
&lt;br /&gt;
The Wumpus sprite above was created from one of the built-in images that comes with Mini Micro.  There are hundreds of these, stored on a hidden, read-only disk mounted as &amp;lt;c&amp;gt;/sys&amp;lt;/c&amp;gt;.  Feel free to use the &amp;lt;c&amp;gt;findFile&amp;lt;/c&amp;gt; command to explore what's there.&lt;br /&gt;
&lt;br /&gt;
But for your own game, you're probably going to want to use your own custom sprites.  So, put an image in PNG format into your project directory (the one you mounted as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;).  Use the &amp;lt;c&amp;gt;pwd&amp;lt;/c&amp;gt; (print working directory) and &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; (change directory) commands to be sure you are in your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; directory.  Then use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to ensure that you can see and load your user file.&lt;br /&gt;
&lt;br /&gt;
Now, just repeat the commands you did to create a sprite above, but substitute the path to your custom image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;myCustomImage.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven't [[clear]]ed the display since step 1, then you'll see your new sprite ''and'' the Wumpus on screen at the same time.  And if you now move (by assigning to &amp;lt;c&amp;gt;.x&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;.y&amp;lt;/c&amp;gt;) your sprites so that they overlap, you'll see that your new sprite is drawn on top of the older one.  That's because sprites are drawn in the order in which they appear in the [[SpriteDisplay.sprites|sprites list]] of the [[SpriteDisplay]].&lt;br /&gt;
&lt;br /&gt;
=== 3. Extract an image from a sprite sheet ===&lt;br /&gt;
&lt;br /&gt;
Often you have multiple sprite images arranged in one bigger image file, called a '''sprite sheet''' or '''sprite atlas'''.  You can pull apart such a sprite sheet by using the [[Image.getImage]] function.  Let's try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;enemies = file.loadImage(&amp;quot;/sys/pics/Enemies.png&amp;quot;)&lt;br /&gt;
view enemies&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This loads and displays [https://github.com/JoeStrout/minimicro-sysdisk/blob/master/sys/pics/Enemies.png?raw=true this big image], which contains a number of platformer enemies, in a 128x128 pixel grid.  Let's make a sprite out of the top-left image.  Keep in mind that coordinates in Mini Micro go from the bottom-left corner, so that top image starts at 128 * 3 = 384.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;goob = new Sprite&lt;br /&gt;
goob.image = enemies.getImage(0, 384, 128, 128)&lt;br /&gt;
display(4).sprites.push goob&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a new sprite called &amp;lt;c&amp;gt;goob&amp;lt;/c&amp;gt;, assigns it an image from our &amp;lt;c&amp;gt;enemies&amp;lt;/c&amp;gt; sprite sheet, and pushes it onto the display.  As always, it starts out in the bottom-left corner, but you know how to adjust that by now.  Since this sprite is a bit bigger than it probably needs to be, also try &amp;lt;c&amp;gt;goob.scale = 0.5&amp;lt;/c&amp;gt; to shrink it down.&lt;br /&gt;
&lt;br /&gt;
== Play a sound ==&lt;br /&gt;
&lt;br /&gt;
Almost any game needs [[sound]] effects!  Mini Micro supports both playing both digitized sounds loaded from a file, and sounds synthesized at runtime.  We'll focus here on playing sounds from a file, which can be in either WAV or OGG format.&lt;br /&gt;
&lt;br /&gt;
=== 1. Play one of the built-in sounds ===&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;c&amp;gt;clear&amp;lt;/c&amp;gt; to clear the screen, then try this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd = file.loadSound(&amp;quot;/sys/sounds/twinkle.wav&amp;quot;)&lt;br /&gt;
snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should hear a twinkle sound.  The [[Sound.play]] method supports several optional parameters.  A handy trick when you need a quick reminder of function parameters is to use [[@]] (the at-sign) before a function reference, to return the function without invoking it.  On the command line, that will print the function parameter names and default values.  Try it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;@snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
which prints:&lt;br /&gt;
&amp;lt;ms&amp;gt;FUNCTION(self, volume=1, pan=0, speed=1)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So let's try some variations on the sound.  (In the code below, we're using &amp;lt;c&amp;gt;//&amp;lt;/c&amp;gt; to add a [[Comments|comment]] on each line; you don't have to type these, but you can if you like.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd.play 0.1   // play very quietly&lt;br /&gt;
snd.play 1, -1     // play out the left speaker only&lt;br /&gt;
snd.play 1, 0, 2   // play twice as fast (an octave higher)&lt;br /&gt;
snd.play 1, 0, 0.5 // play half as fast (an octave lower)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Play your own custom sound ===&lt;br /&gt;
&lt;br /&gt;
Put a sound file in WAV or OGG format into your project folder.  (On some platforms you can also use MP3 format, but that doesn't work everywhere and so is best to avoid if you plan to distribute your game.)  Let's suppose your file is called &amp;quot;bgm.ogg&amp;quot;.  Load and play it just as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2 = file.loadSound(&amp;quot;bgm.ogg&amp;quot;)&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your sound is very long, and you want to stop it, you can just do &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.&lt;br /&gt;
&lt;br /&gt;
Before we move on, let's make this sound loop forever, as you might want background music to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2.loop = true&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, use &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt; to make it stop, or &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.  (The &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; command will also do that, in addition to clearing the current program and variables.)&lt;br /&gt;
&lt;br /&gt;
=== 3. About synthesized sounds ===&lt;br /&gt;
&lt;br /&gt;
Mini Micro has a sophisticated API for creating sounds out of nothing but code.  You can specify a base waveform, frequency, envelope, fade-in/fade-out, and even mix basic sounds together to create more sophisticated sounds.  You can find a couple of simple examples on the [[Sound.init]] page, and some more complex ones by doing &amp;lt;c&amp;gt;run &amp;quot;/sys/lib/sounds&amp;quot;&amp;lt;/c&amp;gt; (followed by &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; to see how those examples were made).&lt;br /&gt;
&lt;br /&gt;
== Write a program ==&lt;br /&gt;
&lt;br /&gt;
Typing commands directly on the command line is a great way to learn, explore, and test things out.  But to write more than a few lines, you'll want to use a code editor.  Assuming you've mounted a folder (rather than a minidisk file), you have two options: the built-in code editor, or an external code editor.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the built-in code editor ===&lt;br /&gt;
&lt;br /&gt;
The [[Mini Micro code editor]] is invoked with the &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; command.  Just type &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; by itself to edit the currently loaded program (or start a new program, if none is loaded).  Or, you can add a filename argument, like &amp;lt;c&amp;gt;edit &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;, to [[load]] a different program and open the editor in one step.&lt;br /&gt;
&lt;br /&gt;
Note that once a program is loaded, if you want to start a new program, use [[reset]] to clear the current program and variables.&lt;br /&gt;
&lt;br /&gt;
The built-in code editor is full-featured and powerful, including auto-indenting, code snippets, a color picker for color constants, and a sophisticated find/replace dialog.  See [[Mini Micro code editor|this page]] for usage details.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use an external code editor ===&lt;br /&gt;
&lt;br /&gt;
When you have mounted a real folder as your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; (or &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;) disk, then you can edit MiniScript files therein using your favorite code editor, outside of Mini Micro.  On the [[Tools]] page you can even find language models for editors like VS Code or BBEdit, to provide MiniScript-savvy syntax coloring.&lt;br /&gt;
&lt;br /&gt;
When you edit code in this way, you will need to reload the program from disk in Mini Micro to see your changes.  It's also generally a good idea to &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; the environment before running the new code, so that old function definitions or other variable values don't inadvertently change the behavior.  So after externally editing a script called &amp;quot;myGame.ms&amp;quot;, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reset; run &amp;quot;myGame&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in Mini Micro.  (And once you've done this once, you can generally just up-arrow to recall and repeat this command again the next time.)&lt;br /&gt;
&lt;br /&gt;
=== A simple game demo ===&lt;br /&gt;
&lt;br /&gt;
Using either method above, create a new MiniScript program called &amp;quot;ufo.ms&amp;quot;, and paste in the following.  (Or to learn even faster, retype it instead of using copy &amp;amp; paste.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare displays&lt;br /&gt;
clear&lt;br /&gt;
sd = display(4)  // sprite display&lt;br /&gt;
&lt;br /&gt;
// prepare UFO sprite and other resources&lt;br /&gt;
ufo = new Sprite&lt;br /&gt;
ufo.image = file.loadImage(&amp;quot;/sys/pics/UFO.png&amp;quot;)&lt;br /&gt;
sd.sprites.push ufo&lt;br /&gt;
ufo.x = 480; ufo.y = 320&lt;br /&gt;
&lt;br /&gt;
fireSound = file.loadSound(&amp;quot;/sys/sounds/blam.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// allow alternate &amp;quot;fire&amp;quot; buttons&lt;br /&gt;
fireButtons = [&amp;quot;space&amp;quot;, &amp;quot;left shift&amp;quot;, &amp;quot;right shift&amp;quot;,&lt;br /&gt;
  &amp;quot;joystick button 0&amp;quot;, &amp;quot;joystick button 1&amp;quot;]&lt;br /&gt;
firePressed = function&lt;br /&gt;
	for btn in fireButtons&lt;br /&gt;
		if key.pressed(btn) then return true&lt;br /&gt;
	end for&lt;br /&gt;
	return false&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// function to &amp;quot;fire&amp;quot; (play a sound)&lt;br /&gt;
fire = function&lt;br /&gt;
	fireSound.play&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
fireWasPressed = false&lt;br /&gt;
while true&lt;br /&gt;
	yield  // wait for next frame&lt;br /&gt;
	&lt;br /&gt;
	// move the UFO&lt;br /&gt;
	ufo.x += key.axis(&amp;quot;Horizontal&amp;quot;) * 20&lt;br /&gt;
	ufo.y += key.axis(&amp;quot;Vertical&amp;quot;) * 20&lt;br /&gt;
	&lt;br /&gt;
	// fire, when fire button goes down&lt;br /&gt;
	fireNowPressed = firePressed&lt;br /&gt;
	if fireNowPressed and not fireWasPressed then fire&lt;br /&gt;
	fireWasPressed = fireNowPressed&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a simple game demo which allows you to move a UFO around the screen using the arrow keys, WASD, or a game controller (which all feed into &amp;lt;c&amp;gt;[[key.axis]]&amp;lt;/c&amp;gt;).  And when you press any of several keys (including joystick/gamepad button 0 or 1), it plays a sound.&lt;br /&gt;
&lt;br /&gt;
Try changing the UFO sprite to your own custom sprite, and changing the fire sound to your own sound.  That will verify that you're able to get your own assets working in Mini Micro in a custom game program.  Then start playing around with the code.  Some things to try:&lt;br /&gt;
&lt;br /&gt;
* Limit the sprite position so it can't go offscreen&lt;br /&gt;
* Add some sort of target, as in &amp;lt;c&amp;gt;/sys/demo/spriteDemo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Make the sprite drop/fire a second sprite when the fire button is pressed&lt;br /&gt;
&lt;br /&gt;
== Package your game for the web ==&lt;br /&gt;
&lt;br /&gt;
If you've come here because you want to make a Mini Micro game for a game jam, then you should almost certainly learn how to package your game for playing on the web, and upload it to a site like itch.io.&lt;br /&gt;
&lt;br /&gt;
This process is described in detail on [[How to package a Mini Micro game]].  Focus on the general instructions at the top, and the &amp;quot;packaging for the web&amp;quot; instructions at the bottom.&lt;br /&gt;
&lt;br /&gt;
== Where to learn more ==&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You have learned how to set up a local Mini Micro environment for development, using your own game assets, and learned to use both the built-in and external code editors.  You've made a very simple game demo, and know how to upload it to the web.  All toolchain hurdles are behind you; now it's just a matter of designing a game, and writing the code!&lt;br /&gt;
&lt;br /&gt;
If you are a Python or Lua programmer, see the [[Python]] or [[Lua]] page of this wiki to see how MiniScript compares to those.&lt;br /&gt;
&lt;br /&gt;
When writing the code, you will probably lean most heavily on these resources:&lt;br /&gt;
&lt;br /&gt;
* The [https://miniscript.org/files/MiniMicro-CheatSheet.pdf Mini Micro Cheat Sheet], a 4-page summary of the Mini Micro API and MiniScript language&lt;br /&gt;
* This wiki, especially the [[How To]] articles&lt;br /&gt;
* Sample code found in &amp;lt;c&amp;gt;/sys/demo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Various blog posts, perhaps found through the [[Bibliography]] page&lt;br /&gt;
&lt;br /&gt;
Most important of all, rely on the '''community Discord server''', a link to which can be found at the bottom of the [https://miniscript.org/ MiniScript home page].  An active and friendly community hangs out on Discord, and you are encouraged to share screenshots, code snippets, and questions there.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TileDisplay.cellTransform&amp;diff=1264</id>
		<title>TileDisplay.cellTransform</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TileDisplay.cellTransform&amp;diff=1264"/>
		<updated>2024-11-25T02:56:20Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: Created page with &amp;quot;Mini Micro version 1.2.2 introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay.  The value returned by &amp;lt;c&amp;gt;TileDisplay.cellTransform&amp;lt;/c...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Mini Micro]] version 1.2.2 introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay.  The value returned by &amp;lt;c&amp;gt;TileDisplay.cellTransform&amp;lt;/c&amp;gt;, or given to &amp;lt;c&amp;gt;TileDisplay.setCellTransform&amp;lt;/c&amp;gt;, is an integer from 0-7.  Values 0-3 rotate the tile in 90° increments.  Values 4-7 first flip the tile horizontally, and then rotate it in 90° increments.&lt;br /&gt;
&lt;br /&gt;
[[File:CellTransform.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File:CellTransform.png&amp;diff=1263</id>
		<title>File:CellTransform.png</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File:CellTransform.png&amp;diff=1263"/>
		<updated>2024-11-25T02:55:11Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Diagram illustrating the eight transforms available via TileDisplay.setCellTransform.&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Apps_using_MiniScript&amp;diff=1262</id>
		<title>Apps using MiniScript</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Apps_using_MiniScript&amp;diff=1262"/>
		<updated>2024-11-23T03:41:45Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is an (incomplete) list of games and other applications (other than [[Mini Micro]]) that use MiniScript in some way that's exposed to players/end-users.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/1383570/Ballex2_The_Hanging_Gardens/ Ballex²: The Hanging Gardens]: ball-rolling skill/puzzle game.  MiniScript is used in the creation of custom levels.&lt;br /&gt;
&lt;br /&gt;
* [[Farmtronics]]: mod for Stardew Valley that adds a MiniScript-programmable home computer and farm robots.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/2027330/GoreBox/ GoreBox]: 3D physics-based sandbox game.  Uses MiniScript in the creation of custom levels.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/605230/Grey_Hack/ Grey Hack]: massively multiplayer online hacking game.  Uses MiniScript extensively as the built-in scripting language, a central part of the gameplay experience.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/2312770/Linkito/ Linkito]: gadget-building puzzle game.  MiniScript is used for advanced programmable components.&lt;br /&gt;
&lt;br /&gt;
* [https://store.steampowered.com/app/2809460/Terminal_ESC/ Terminal/ESC]: puzzle game in a simulated computer that uses MiniScript as the programming language.&lt;br /&gt;
&lt;br /&gt;
* [https://machiaworx.net/?p=914 Re:Code]: live-coding music sequencing software; write MiniScript code to make music in real time!  ([https://www.youtube.com/watch?v=g52rHtOzGnI Demo Movie])&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=TextDisplay&amp;diff=1261</id>
		<title>TextDisplay</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=TextDisplay&amp;diff=1261"/>
		<updated>2024-11-13T23:42:09Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;c&amp;gt;TextDisplay&amp;lt;/c&amp;gt; class in [[Mini Micro]] is a display type that represents a 68-column, 26-row text character display.  Each row/column position in this display is called a &amp;quot;cell&amp;quot; and may display one character, with any foreground and background color (including transparent colors).&lt;br /&gt;
&lt;br /&gt;
[[File:TextDisplay.png|682px|frameless|center|Illustration of the Mini Micro text display: 26 rows by 68 columns.]]&lt;br /&gt;
&lt;br /&gt;
By default, [[display]] 3 is configured as a text display, and is in fact the main text display on which [[print]] and [[input]] operate, and to which the [[text]] global refers (unless you change it).  But you can make any display layer a text display by setting its [[Display.mode|mode]] to &amp;lt;c&amp;gt;displayMode.text&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
There are two ways to put text into a text display: use the [[TextDisplay.print]] method, which applies the current values of [[TextDisplay.color]], etc.; or set individual cells with [[TextDisplay.setCell]], [[TextDisplay.setCellColor]], etc.&lt;br /&gt;
&lt;br /&gt;
== Methods and Properties ==&lt;br /&gt;
&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;
| [[TextDisplay.color]] || get or set the text color (used on subsequent [[TextDisplay.print]])&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.backColor]] || get or set the background color (used on subsequent [[TextDisplay.print]])&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.column]] || get/set the cursor column, 0-67 (where subsequent [[TextDisplay.print]] begins)&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.row]] || get or set the cursor row, 0-25 (used on subsequent [[TextDisplay.print]])&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.inverse]] || when true, subsequent printing swaps text and background color&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.delimiter]] || get/set the extra character output after every [[TextDisplay.print]])&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.cell]](''x'', ''y'') || get the character at the given column and row&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.setCell]] ''x'', ''y'', k || store character ''k'' into the given column and row&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.cellColor]](''x'', ''y'') || get the text color at the given column and row&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.setCellColor]] ''x'', ''y'', c || set the text color at the given column and row to ''c''&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.cellBackColor]](''x'', ''y'') || get the background color at the given column and row&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.setCellBackColor]] ''x'', ''y'', c || set the background color at the given column and row to ''c''&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.print]] ''s'' || print string ''s'' (followed by the [[TextDisplay.delimiter|delimiter]])&lt;br /&gt;
|-&lt;br /&gt;
| [[TextDisplay.clear]] || clear the text display&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== TextDisplay in Farmtronics ==&lt;br /&gt;
&lt;br /&gt;
The [[Farmtronics]] computer also has a TextDisplay, but it is only 20 rows by 40 columns.  Moreover, there is only ''one'' TextDisplay, unlike Mini Micro, which can have any number of them.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Farmtronics]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1260</id>
		<title>How to get started with Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1260"/>
		<updated>2024-10-10T14:05:22Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Where to learn more */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://miniscript.org/MiniMicro/ Mini Micro] is a popular environment for creating 2D games and demos in MiniScript.  It is a retro-style virtual computer, which runs on most desktop platforms.  Mini Micro games can be [[How to package a Mini Micro game|packaged]] as stand-alone games for desktop or the web. &lt;br /&gt;
&lt;br /&gt;
This page is meant for people who have never used Mini Micro before, but want to make a Mini Micro game.  It is a step-by-step guide to building your first simple demo involving a sprite, game input, and sound effects, including your own resources, as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Get Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
While you can run Mini Micro on the web, the web version has no ability to save files (nor does it support copy/paste).  So it's not useful for developing your own Mini Micro games.&lt;br /&gt;
&lt;br /&gt;
Go to the [https://miniscript.org/MiniMicro/#download Mini Micro download] page, click the button for your platform (Mac, Windows, or Linux), and save the resulting file to your local machine.  (If you don't have a Mac, Windows, or Linux desktop machine, then unfortunately you can't use Mini Micro yet, though iOS and Android versions are under development.)&lt;br /&gt;
&lt;br /&gt;
The downloaded file will be a .zip (Mac/Windows) or .tar.gz (Linux) file.  ''Unpack this file completely.''  Don't try to run Mini Micro from ''within'' the archive; extract all files to a real folder on your hard drive.&lt;br /&gt;
&lt;br /&gt;
Then, find the Mini Micro application in that folder.  Double-click it to launch Mini Micro.  The result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:MiniMicro.png|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Mount a folder as /usr ==&lt;br /&gt;
&lt;br /&gt;
Mini Micro can access two virtual &amp;quot;disks&amp;quot; at once; within the Mini Micro environment, these are accessed as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Each of these can be either a '''.minidisk file''', or a '''real folder''' on the host (desktop) system.  Out of the box, Mini Micro creates an empty .minidisk file for you, to keep things nice and neat.  But for any serious development, you're going to want to mount a real folder instead, so that you can easily move files in and out of this folder, use your favorite external image/sound editors, etc.&lt;br /&gt;
&lt;br /&gt;
Create a folder on your desktop system, wherever you normally keep your documents.  This will be your project folder for your first Mini Micro game.  Put a small text file, image (in PNG or JPEG format), or sound file (in WAV or OGG format) in there.  Our goal now is to see and view this file (and any others in that folder or its subfolders) in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the disk slot menu ===&lt;br /&gt;
&lt;br /&gt;
Those two thin dark rectangles in the bottom-left corner of the Mini Micro window are &amp;quot;disk slots.&amp;quot;  The top slot represents &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;, and the bottom slot represents &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Click the top slot to pop open the menu, and select the &amp;quot;Mount Folder...&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Selecting that command should bring up the native file dialog for your platform, allowing you to select any folder you have access to.  Pick the project folder you created above.  (Note: some Linux platforms have a bug which crashes Mini Micro at this point; if that happens to you, go on to Method 2.)&lt;br /&gt;
&lt;br /&gt;
Now, in the Mini Micro display, at the blinking orange prompt, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;dir&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and press Return or Enter.  You should see your file listed.  Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;view &amp;quot;myfile.txt&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
but replace ''myfile.txt'' with the name of whatever file you placed in your project folder.  Be sure to include the quotation marks; you're typing MiniScript code here, not some other shell language, so string literals always need to be surrounded by double quotes.  If you do it correctly, the contents of your text file or image should appear on the screen.&lt;br /&gt;
&lt;br /&gt;
(You could also do &amp;lt;c&amp;gt;view findFile&amp;lt;/c&amp;gt;, which would pop up the little file browser within the [[findFile]] command, and select your file that way.)&lt;br /&gt;
&lt;br /&gt;
Note that the currently mounted disk is saved in preferences, so if you quit and relaunch Mini Micro, you generally won't need to do this step again; the previously mounted disks will still be there.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use command-line arguments ===&lt;br /&gt;
&lt;br /&gt;
If you are unfortunate enough to hit that Linux bug which causes the file dialogs to crash, or for some other reason you want to launch Mini Micro from the command line (or a shell script) with the correct folder already mounted, then you can use [[Command-line arguments|command-line arguments]] instead.  Open your favorite terminal program, and navigate to where the Mini Micro executable is located.  The details vary by platform, so let's break it down:&lt;br /&gt;
&lt;br /&gt;
'''Linux'''&lt;br /&gt;
&lt;br /&gt;
In Linux, the executable is called '''MiniMicro.x86_64''', so you would type a command like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;./MiniMicro.x86_64 -usr ~/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''Windows'''&lt;br /&gt;
&lt;br /&gt;
In Windows, you can open the command prompt by pressing '''Win + R''' to open the Run dialog, and entering ''cmd''.  (If you already have some other preferred terminal app, like PowerShell, that's fine too.)  Then &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; to the directory containing Mini Micro.  The executable here is called '''Mini Micro.exe''', so you would use a command like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&amp;quot;Mini Micro.exe&amp;quot; -usr &amp;quot;%HOMEPATH%\mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;%HOMEPATH%\mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''MacOS'''&lt;br /&gt;
&lt;br /&gt;
On Mac, the actual executable is hidden inside the application bundle, specifically under Contents/MacOS.  So if you've already launched Terminal and navigated to where '''MiniMicro.app''' is found, then you would do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Contents/MacOS/Mini\ Micro -usr ~/Documents/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/Documents/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
If successful (on any platform), you should be able to use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to view the file in your project folder within the Mini Micro environment.&lt;br /&gt;
&lt;br /&gt;
== Create a sprite ==&lt;br /&gt;
&lt;br /&gt;
Now let's get a sprite up on the screen.  We're going to do this using the Mini Micro command line (or [[REPL]]), where you type a command and executes immediately.  We'll get to writing real programs later, but the command-line is a powerful tool for learning and exploring, so let's use it.&lt;br /&gt;
&lt;br /&gt;
=== 1. Make a sprite from the built-in images ===&lt;br /&gt;
&lt;br /&gt;
At the orange blinking-cursor prompt in Mini Micro, carefully type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a furry purple Wumpus peeking out from the lower-left corner of the screen (which is the origin of Mini Micro's [[Screen coordinates|coordinate system]]).&lt;br /&gt;
&lt;br /&gt;
[[File:ManualSprite.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
If you don't see this, go back and double-check your typing.  Note that you can recall a previous command on the command line by pressing the '''up-arrow'' key, then just edit it and press Return to run the edited command.&lt;br /&gt;
&lt;br /&gt;
How does this work?  Let's break it down:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; clears the screen and resets all eight display layers to their default states.  This includes setting display 4 to be a [[SpriteDisplay]].  (That's the default state when Mini Micro boots, but useful whenever your screen is cluttered anyway.)&lt;br /&gt;
# &amp;lt;c&amp;gt;sp = new Sprite&amp;lt;/c&amp;gt; creates a new [[Sprite]] object, and assigns it to a variable called &amp;lt;c&amp;gt;sp&amp;lt;/c&amp;gt;.&lt;br /&gt;
# &amp;lt;c&amp;gt;sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&amp;lt;/c&amp;gt; loads an image called &amp;quot;Wumpus.png&amp;quot; from the &amp;lt;c&amp;gt;/sys/pics&amp;lt;/c&amp;gt; directory.  (Notice that Mini Micro uses forward-slashes in file paths, even if the host system is Windows.)&lt;br /&gt;
# &amp;lt;c&amp;gt;display(4).sprites.push sp&amp;lt;/c&amp;gt; pushes this new sprite onto the sprite list of display 4, so it can be seen.&lt;br /&gt;
&lt;br /&gt;
Once you have the Wumpus peeking out of the corner, let's move it and rotate it a bit.  Notice how the sprite updates immediately after each command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp.x = 480&lt;br /&gt;
sp.y = 320&lt;br /&gt;
sp.rotation = 45&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Make a sprite from your own custom image ===&lt;br /&gt;
&lt;br /&gt;
The Wumpus sprite above was created from one of the built-in images that comes with Mini Micro.  There are hundreds of these, stored on a hidden, read-only disk mounted as &amp;lt;c&amp;gt;/sys&amp;lt;/c&amp;gt;.  Feel free to use the &amp;lt;c&amp;gt;findFile&amp;lt;/c&amp;gt; command to explore what's there.&lt;br /&gt;
&lt;br /&gt;
But for your own game, you're probably going to want to use your own custom sprites.  So, put an image in PNG format into your project directory (the one you mounted as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;).  Use the &amp;lt;c&amp;gt;pwd&amp;lt;/c&amp;gt; (print working directory) and &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; (change directory) commands to be sure you are in your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; directory.  Then use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to ensure that you can see and load your user file.&lt;br /&gt;
&lt;br /&gt;
Now, just repeat the commands you did to create a sprite above, but substitute the path to your custom image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;myCustomImage.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven't [[clear]]ed the display since step 1, then you'll see your new sprite ''and'' the Wumpus on screen at the same time.  And if you now move (by assigning to &amp;lt;c&amp;gt;.x&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;.y&amp;lt;/c&amp;gt;) your sprites so that they overlap, you'll see that your new sprite is drawn on top of the older one.  That's because sprites are drawn in the order in which they appear in the [[SpriteDisplay.sprites|sprites list]] of the [[SpriteDisplay]].&lt;br /&gt;
&lt;br /&gt;
=== 3. Extract an image from a sprite sheet ===&lt;br /&gt;
&lt;br /&gt;
Often you have multiple sprite images arranged in one bigger image file, called a '''sprite sheet''' or '''sprite atlas'''.  You can pull apart such a sprite sheet by using the [[Image.getImage]] function.  Let's try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;enemies = file.loadImage(&amp;quot;/sys/pics/Enemies.png&amp;quot;)&lt;br /&gt;
view enemies&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This loads and displays [https://github.com/JoeStrout/minimicro-sysdisk/blob/master/sys/pics/Enemies.png?raw=true this big image], which contains a number of platformer enemies, in a 128x128 pixel grid.  Let's make a sprite out of the top-left image.  Keep in mind that coordinates in Mini Micro go from the bottom-left corner, so that top image starts at 128 * 3 = 384.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;goob = new Sprite&lt;br /&gt;
goob.image = enemies.getImage(0, 384, 128, 128)&lt;br /&gt;
display(4).sprites.push goob&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a new sprite called &amp;lt;c&amp;gt;goob&amp;lt;/c&amp;gt;, assigns it an image from our &amp;lt;c&amp;gt;enemies&amp;lt;/c&amp;gt; sprite sheet, and pushes it onto the display.  As always, it starts out in the bottom-left corner, but you know how to adjust that by now.  Since this sprite is a bit bigger than it probably needs to be, also try &amp;lt;c&amp;gt;goob.scale = 0.5&amp;lt;/c&amp;gt; to shrink it down.&lt;br /&gt;
&lt;br /&gt;
== Play a sound ==&lt;br /&gt;
&lt;br /&gt;
Almost any game needs [[sound]] effects!  Mini Micro supports both playing both digitized sounds loaded from a file, and sounds synthesized at runtime.  We'll focus here on playing sounds from a file, which can be in either WAV or OGG format.&lt;br /&gt;
&lt;br /&gt;
=== 1. Play one of the built-in sounds ===&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;c&amp;gt;clear&amp;lt;/c&amp;gt; to clear the screen, then try this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd = file.loadSound(&amp;quot;/sys/sounds/twinkle.wav&amp;quot;)&lt;br /&gt;
snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should hear a twinkle sound.  The [[Sound.play]] method supports several optional parameters.  A handy trick when you need a quick reminder of function parameters is to use [[@]] (the at-sign) before a function reference, to return the function without invoking it.  On the command line, that will print the function parameter names and default values.  Try it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;@snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
which prints:&lt;br /&gt;
&amp;lt;ms&amp;gt;FUNCTION(self, volume=1, pan=0, speed=1)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So let's try some variations on the sound.  (In the code below, we're using &amp;lt;c&amp;gt;//&amp;lt;/c&amp;gt; to add a [[Comments|comment]] on each line; you don't have to type these, but you can if you like.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd.play 0.1   // play very quietly&lt;br /&gt;
snd.play 1, -1     // play out the left speaker only&lt;br /&gt;
snd.play 1, 0, 2   // play twice as fast (an octave higher)&lt;br /&gt;
snd.play 1, 0, 0.5 // play half as fast (an octave lower)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Play your own custom sound ===&lt;br /&gt;
&lt;br /&gt;
Put a sound file in WAV or OGG format into your project folder.  (On some platforms you can also use MP3 format, but that doesn't work everywhere and so is best to avoid if you plan to distribute your game.)  Let's suppose your file is called &amp;quot;bgm.ogg&amp;quot;.  Load and play it just as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2 = file.loadSound(&amp;quot;bgm.ogg&amp;quot;)&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your sound is very long, and you want to stop it, you can just do &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.&lt;br /&gt;
&lt;br /&gt;
Before we move on, let's make this sound loop forever, as you might want background music to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2.loop = true&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, use &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt; to make it stop, or &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.  (The &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; command will also do that, in addition to clearing the current program and variables.)&lt;br /&gt;
&lt;br /&gt;
=== 3. About synthesized sounds ===&lt;br /&gt;
&lt;br /&gt;
Mini Micro has a sophisticated API for creating sounds out of nothing but code.  You can specify a base waveform, frequency, envelope, fade-in/fade-out, and even mix basic sounds together to create more sophisticated sounds.  You can find a couple of simple examples on the [[Sound.init]] page, and some more complex ones by doing &amp;lt;c&amp;gt;run &amp;quot;/sys/lib/sounds&amp;quot;&amp;lt;/c&amp;gt; (followed by &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; to see how those examples were made).&lt;br /&gt;
&lt;br /&gt;
== Write a program ==&lt;br /&gt;
&lt;br /&gt;
Typing commands directly on the command line is a great way to learn, explore, and test things out.  But to write more than a few lines, you'll want to use a code editor.  Assuming you've mounted a folder (rather than a minidisk file), you have two options: the built-in code editor, or an external code editor.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the built-in code editor ===&lt;br /&gt;
&lt;br /&gt;
The [[Mini Micro code editor]] is invoked with the &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; command.  Just type &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; by itself to edit the currently loaded program (or start a new program, if none is loaded).  Or, you can add a filename argument, like &amp;lt;c&amp;gt;edit &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;, to [[load]] a different program and open the editor in one step.&lt;br /&gt;
&lt;br /&gt;
Note that once a program is loaded, if you want to start a new program, use [[reset]] to clear the current program and variables.&lt;br /&gt;
&lt;br /&gt;
The built-in code editor is full-featured and powerful, including auto-indenting, code snippets, a color picker for color constants, and a sophisticated find/replace dialog.  See [[Mini Micro code editor|this page]] for usage details.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use an external code editor ===&lt;br /&gt;
&lt;br /&gt;
When you have mounted a real folder as your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; (or &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;) disk, then you can edit MiniScript files therein using your favorite code editor, outside of Mini Micro.  On the [[Tools]] page you can even find language models for editors like VS Code or BBEdit, to provide MiniScript-savvy syntax coloring.&lt;br /&gt;
&lt;br /&gt;
When you edit code in this way, you will need to reload the program from disk in Mini Micro to see your changes.  It's also generally a good idea to &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; the environment before running the new code, so that old function definitions or other variable values don't inadvertently change the behavior.  So after externally editing a script called &amp;quot;myGame.ms&amp;quot;, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reset; run &amp;quot;myGame&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in Mini Micro.  (And once you've done this once, you can generally just up-arrow to recall and repeat this command again the next time.)&lt;br /&gt;
&lt;br /&gt;
=== A simple game demo ===&lt;br /&gt;
&lt;br /&gt;
Using either method above, create a new MiniScript program called &amp;quot;ufo.ms&amp;quot;, and paste in the following.  (Or to learn even faster, retype it instead of using copy &amp;amp; paste.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare displays&lt;br /&gt;
clear&lt;br /&gt;
sd = display(4)  // sprite display&lt;br /&gt;
&lt;br /&gt;
// prepare UFO sprite and other resources&lt;br /&gt;
ufo = new Sprite&lt;br /&gt;
ufo.image = file.loadImage(&amp;quot;/sys/pics/UFO.png&amp;quot;)&lt;br /&gt;
sd.sprites.push ufo&lt;br /&gt;
ufo.x = 480; ufo.y = 320&lt;br /&gt;
&lt;br /&gt;
fireSound = file.loadSound(&amp;quot;/sys/sounds/blam.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// allow alternate &amp;quot;fire&amp;quot; buttons&lt;br /&gt;
fireButtons = [&amp;quot;space&amp;quot;, &amp;quot;left shift&amp;quot;, &amp;quot;right shift&amp;quot;,&lt;br /&gt;
  &amp;quot;joystick button 0&amp;quot;, &amp;quot;joystick button 1&amp;quot;]&lt;br /&gt;
firePressed = function&lt;br /&gt;
	for btn in fireButtons&lt;br /&gt;
		if key.pressed(btn) then return true&lt;br /&gt;
	end for&lt;br /&gt;
	return false&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// function to &amp;quot;fire&amp;quot; (play a sound)&lt;br /&gt;
fire = function&lt;br /&gt;
	fireSound.play&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
fireWasPressed = false&lt;br /&gt;
while true&lt;br /&gt;
	yield  // wait for next frame&lt;br /&gt;
	&lt;br /&gt;
	// move the UFO&lt;br /&gt;
	ufo.x += key.axis(&amp;quot;Horizontal&amp;quot;) * 20&lt;br /&gt;
	ufo.y += key.axis(&amp;quot;Vertical&amp;quot;) * 20&lt;br /&gt;
	&lt;br /&gt;
	// fire, when fire button goes down&lt;br /&gt;
	fireNowPressed = firePressed&lt;br /&gt;
	if fireNowPressed and not fireWasPressed then fire&lt;br /&gt;
	fireWasPressed = fireNowPressed&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a simple game demo which allows you to move a UFO around the screen using the arrow keys, WASD, or a game controller (which all feed into &amp;lt;c&amp;gt;[[key.axis]]&amp;lt;/c&amp;gt;).  And when you press any of several keys (including joystick/gamepad button 0 or 1), it plays a sound.&lt;br /&gt;
&lt;br /&gt;
Try changing the UFO sprite to your own custom sprite, and changing the fire sound to your own sound.  That will verify that you're able to get your own assets working in Mini Micro in a custom game program.  Then start playing around with the code.  Some things to try:&lt;br /&gt;
&lt;br /&gt;
* Limit the sprite position so it can't go offscreen&lt;br /&gt;
* Add some sort of target, as in &amp;lt;c&amp;gt;/sys/demo/spriteDemo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Make the sprite drop/fire a second sprite when the fire button is pressed&lt;br /&gt;
&lt;br /&gt;
== Package your game for the web ==&lt;br /&gt;
&lt;br /&gt;
If you've come here because you want to make a Mini Micro game for a game jam, then you should almost certainly learn how to package your game for playing on the web, and upload it to a site like itch.io.&lt;br /&gt;
&lt;br /&gt;
This process is described in detail on [[How to package a Mini Micro game]].  Focus on the general instructions at the top, and the &amp;quot;packaging for the web&amp;quot; instructions at the bottom.&lt;br /&gt;
&lt;br /&gt;
== Where to learn more ==&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You have learned how to set up a local Mini Micro environment for development, using your own game assets, and learned to use both the built-in and external code editors.  You've made a very simple game demo, and know how to upload it to the web.  All toolchain hurdles are behind you; now it's just a matter of designing a game, and writing the code!&lt;br /&gt;
&lt;br /&gt;
If you are a Python or Lua programmer, see the [[Python]] or [[Lua]] page of this wiki to see how MiniScript compares to those.&lt;br /&gt;
&lt;br /&gt;
When writing the code, you will probably lean most heavily on these resources:&lt;br /&gt;
&lt;br /&gt;
* The [https://miniscript.org/files/MiniMicro-CheatSheet.pdf Mini Micro Cheat Sheet], a 4-page summary of the Mini Micro API and MiniScript language&lt;br /&gt;
* This wiki, especially the [[How To]] articles&lt;br /&gt;
* Sample code found in &amp;lt;c&amp;gt;/sys/demo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Various blog posts, perhaps found through the [[Bibliography]] page&lt;br /&gt;
&lt;br /&gt;
Most important of all, rely on the '''community Discord server''', a link to which can be found at the bottom of the [https://miniscript.org/ MiniScript home page].  An active and friendly community hangs out on Discord, and you are encouraged to share screenshots, code snippets, and questions there.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1259</id>
		<title>How to get started with Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1259"/>
		<updated>2024-10-10T14:03:26Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Play a sound */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://miniscript.org/MiniMicro/ Mini Micro] is a popular environment for creating 2D games and demos in MiniScript.  It is a retro-style virtual computer, which runs on most desktop platforms.  Mini Micro games can be [[How to package a Mini Micro game|packaged]] as stand-alone games for desktop or the web. &lt;br /&gt;
&lt;br /&gt;
This page is meant for people who have never used Mini Micro before, but want to make a Mini Micro game.  It is a step-by-step guide to building your first simple demo involving a sprite, game input, and sound effects, including your own resources, as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Get Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
While you can run Mini Micro on the web, the web version has no ability to save files (nor does it support copy/paste).  So it's not useful for developing your own Mini Micro games.&lt;br /&gt;
&lt;br /&gt;
Go to the [https://miniscript.org/MiniMicro/#download Mini Micro download] page, click the button for your platform (Mac, Windows, or Linux), and save the resulting file to your local machine.  (If you don't have a Mac, Windows, or Linux desktop machine, then unfortunately you can't use Mini Micro yet, though iOS and Android versions are under development.)&lt;br /&gt;
&lt;br /&gt;
The downloaded file will be a .zip (Mac/Windows) or .tar.gz (Linux) file.  ''Unpack this file completely.''  Don't try to run Mini Micro from ''within'' the archive; extract all files to a real folder on your hard drive.&lt;br /&gt;
&lt;br /&gt;
Then, find the Mini Micro application in that folder.  Double-click it to launch Mini Micro.  The result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:MiniMicro.png|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Mount a folder as /usr ==&lt;br /&gt;
&lt;br /&gt;
Mini Micro can access two virtual &amp;quot;disks&amp;quot; at once; within the Mini Micro environment, these are accessed as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Each of these can be either a '''.minidisk file''', or a '''real folder''' on the host (desktop) system.  Out of the box, Mini Micro creates an empty .minidisk file for you, to keep things nice and neat.  But for any serious development, you're going to want to mount a real folder instead, so that you can easily move files in and out of this folder, use your favorite external image/sound editors, etc.&lt;br /&gt;
&lt;br /&gt;
Create a folder on your desktop system, wherever you normally keep your documents.  This will be your project folder for your first Mini Micro game.  Put a small text file, image (in PNG or JPEG format), or sound file (in WAV or OGG format) in there.  Our goal now is to see and view this file (and any others in that folder or its subfolders) in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the disk slot menu ===&lt;br /&gt;
&lt;br /&gt;
Those two thin dark rectangles in the bottom-left corner of the Mini Micro window are &amp;quot;disk slots.&amp;quot;  The top slot represents &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;, and the bottom slot represents &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Click the top slot to pop open the menu, and select the &amp;quot;Mount Folder...&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Selecting that command should bring up the native file dialog for your platform, allowing you to select any folder you have access to.  Pick the project folder you created above.  (Note: some Linux platforms have a bug which crashes Mini Micro at this point; if that happens to you, go on to Method 2.)&lt;br /&gt;
&lt;br /&gt;
Now, in the Mini Micro display, at the blinking orange prompt, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;dir&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and press Return or Enter.  You should see your file listed.  Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;view &amp;quot;myfile.txt&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
but replace ''myfile.txt'' with the name of whatever file you placed in your project folder.  Be sure to include the quotation marks; you're typing MiniScript code here, not some other shell language, so string literals always need to be surrounded by double quotes.  If you do it correctly, the contents of your text file or image should appear on the screen.&lt;br /&gt;
&lt;br /&gt;
(You could also do &amp;lt;c&amp;gt;view findFile&amp;lt;/c&amp;gt;, which would pop up the little file browser within the [[findFile]] command, and select your file that way.)&lt;br /&gt;
&lt;br /&gt;
Note that the currently mounted disk is saved in preferences, so if you quit and relaunch Mini Micro, you generally won't need to do this step again; the previously mounted disks will still be there.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use command-line arguments ===&lt;br /&gt;
&lt;br /&gt;
If you are unfortunate enough to hit that Linux bug which causes the file dialogs to crash, or for some other reason you want to launch Mini Micro from the command line (or a shell script) with the correct folder already mounted, then you can use [[Command-line arguments|command-line arguments]] instead.  Open your favorite terminal program, and navigate to where the Mini Micro executable is located.  The details vary by platform, so let's break it down:&lt;br /&gt;
&lt;br /&gt;
'''Linux'''&lt;br /&gt;
&lt;br /&gt;
In Linux, the executable is called '''MiniMicro.x86_64''', so you would type a command like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;./MiniMicro.x86_64 -usr ~/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''Windows'''&lt;br /&gt;
&lt;br /&gt;
In Windows, you can open the command prompt by pressing '''Win + R''' to open the Run dialog, and entering ''cmd''.  (If you already have some other preferred terminal app, like PowerShell, that's fine too.)  Then &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; to the directory containing Mini Micro.  The executable here is called '''Mini Micro.exe''', so you would use a command like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&amp;quot;Mini Micro.exe&amp;quot; -usr &amp;quot;%HOMEPATH%\mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;%HOMEPATH%\mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''MacOS'''&lt;br /&gt;
&lt;br /&gt;
On Mac, the actual executable is hidden inside the application bundle, specifically under Contents/MacOS.  So if you've already launched Terminal and navigated to where '''MiniMicro.app''' is found, then you would do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Contents/MacOS/Mini\ Micro -usr ~/Documents/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/Documents/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
If successful (on any platform), you should be able to use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to view the file in your project folder within the Mini Micro environment.&lt;br /&gt;
&lt;br /&gt;
== Create a sprite ==&lt;br /&gt;
&lt;br /&gt;
Now let's get a sprite up on the screen.  We're going to do this using the Mini Micro command line (or [[REPL]]), where you type a command and executes immediately.  We'll get to writing real programs later, but the command-line is a powerful tool for learning and exploring, so let's use it.&lt;br /&gt;
&lt;br /&gt;
=== 1. Make a sprite from the built-in images ===&lt;br /&gt;
&lt;br /&gt;
At the orange blinking-cursor prompt in Mini Micro, carefully type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a furry purple Wumpus peeking out from the lower-left corner of the screen (which is the origin of Mini Micro's [[Screen coordinates|coordinate system]]).&lt;br /&gt;
&lt;br /&gt;
[[File:ManualSprite.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
If you don't see this, go back and double-check your typing.  Note that you can recall a previous command on the command line by pressing the '''up-arrow'' key, then just edit it and press Return to run the edited command.&lt;br /&gt;
&lt;br /&gt;
How does this work?  Let's break it down:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; clears the screen and resets all eight display layers to their default states.  This includes setting display 4 to be a [[SpriteDisplay]].  (That's the default state when Mini Micro boots, but useful whenever your screen is cluttered anyway.)&lt;br /&gt;
# &amp;lt;c&amp;gt;sp = new Sprite&amp;lt;/c&amp;gt; creates a new [[Sprite]] object, and assigns it to a variable called &amp;lt;c&amp;gt;sp&amp;lt;/c&amp;gt;.&lt;br /&gt;
# &amp;lt;c&amp;gt;sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&amp;lt;/c&amp;gt; loads an image called &amp;quot;Wumpus.png&amp;quot; from the &amp;lt;c&amp;gt;/sys/pics&amp;lt;/c&amp;gt; directory.  (Notice that Mini Micro uses forward-slashes in file paths, even if the host system is Windows.)&lt;br /&gt;
# &amp;lt;c&amp;gt;display(4).sprites.push sp&amp;lt;/c&amp;gt; pushes this new sprite onto the sprite list of display 4, so it can be seen.&lt;br /&gt;
&lt;br /&gt;
Once you have the Wumpus peeking out of the corner, let's move it and rotate it a bit.  Notice how the sprite updates immediately after each command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp.x = 480&lt;br /&gt;
sp.y = 320&lt;br /&gt;
sp.rotation = 45&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Make a sprite from your own custom image ===&lt;br /&gt;
&lt;br /&gt;
The Wumpus sprite above was created from one of the built-in images that comes with Mini Micro.  There are hundreds of these, stored on a hidden, read-only disk mounted as &amp;lt;c&amp;gt;/sys&amp;lt;/c&amp;gt;.  Feel free to use the &amp;lt;c&amp;gt;findFile&amp;lt;/c&amp;gt; command to explore what's there.&lt;br /&gt;
&lt;br /&gt;
But for your own game, you're probably going to want to use your own custom sprites.  So, put an image in PNG format into your project directory (the one you mounted as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;).  Use the &amp;lt;c&amp;gt;pwd&amp;lt;/c&amp;gt; (print working directory) and &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; (change directory) commands to be sure you are in your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; directory.  Then use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to ensure that you can see and load your user file.&lt;br /&gt;
&lt;br /&gt;
Now, just repeat the commands you did to create a sprite above, but substitute the path to your custom image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;myCustomImage.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven't [[clear]]ed the display since step 1, then you'll see your new sprite ''and'' the Wumpus on screen at the same time.  And if you now move (by assigning to &amp;lt;c&amp;gt;.x&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;.y&amp;lt;/c&amp;gt;) your sprites so that they overlap, you'll see that your new sprite is drawn on top of the older one.  That's because sprites are drawn in the order in which they appear in the [[SpriteDisplay.sprites|sprites list]] of the [[SpriteDisplay]].&lt;br /&gt;
&lt;br /&gt;
=== 3. Extract an image from a sprite sheet ===&lt;br /&gt;
&lt;br /&gt;
Often you have multiple sprite images arranged in one bigger image file, called a '''sprite sheet''' or '''sprite atlas'''.  You can pull apart such a sprite sheet by using the [[Image.getImage]] function.  Let's try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;enemies = file.loadImage(&amp;quot;/sys/pics/Enemies.png&amp;quot;)&lt;br /&gt;
view enemies&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This loads and displays [https://github.com/JoeStrout/minimicro-sysdisk/blob/master/sys/pics/Enemies.png?raw=true this big image], which contains a number of platformer enemies, in a 128x128 pixel grid.  Let's make a sprite out of the top-left image.  Keep in mind that coordinates in Mini Micro go from the bottom-left corner, so that top image starts at 128 * 3 = 384.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;goob = new Sprite&lt;br /&gt;
goob.image = enemies.getImage(0, 384, 128, 128)&lt;br /&gt;
display(4).sprites.push goob&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a new sprite called &amp;lt;c&amp;gt;goob&amp;lt;/c&amp;gt;, assigns it an image from our &amp;lt;c&amp;gt;enemies&amp;lt;/c&amp;gt; sprite sheet, and pushes it onto the display.  As always, it starts out in the bottom-left corner, but you know how to adjust that by now.  Since this sprite is a bit bigger than it probably needs to be, also try &amp;lt;c&amp;gt;goob.scale = 0.5&amp;lt;/c&amp;gt; to shrink it down.&lt;br /&gt;
&lt;br /&gt;
== Play a sound ==&lt;br /&gt;
&lt;br /&gt;
Almost any game needs [[sound]] effects!  Mini Micro supports both playing both digitized sounds loaded from a file, and sounds synthesized at runtime.  We'll focus here on playing sounds from a file, which can be in either WAV or OGG format.&lt;br /&gt;
&lt;br /&gt;
=== 1. Play one of the built-in sounds ===&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;c&amp;gt;clear&amp;lt;/c&amp;gt; to clear the screen, then try this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd = file.loadSound(&amp;quot;/sys/sounds/twinkle.wav&amp;quot;)&lt;br /&gt;
snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should hear a twinkle sound.  The [[Sound.play]] method supports several optional parameters.  A handy trick when you need a quick reminder of function parameters is to use [[@]] (the at-sign) before a function reference, to return the function without invoking it.  On the command line, that will print the function parameter names and default values.  Try it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;@snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
which prints:&lt;br /&gt;
&amp;lt;ms&amp;gt;FUNCTION(self, volume=1, pan=0, speed=1)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So let's try some variations on the sound.  (In the code below, we're using &amp;lt;c&amp;gt;//&amp;lt;/c&amp;gt; to add a [[Comments|comment]] on each line; you don't have to type these, but you can if you like.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd.play 0.1   // play very quietly&lt;br /&gt;
snd.play 1, -1     // play out the left speaker only&lt;br /&gt;
snd.play 1, 0, 2   // play twice as fast (an octave higher)&lt;br /&gt;
snd.play 1, 0, 0.5 // play half as fast (an octave lower)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Play your own custom sound ===&lt;br /&gt;
&lt;br /&gt;
Put a sound file in WAV or OGG format into your project folder.  (On some platforms you can also use MP3 format, but that doesn't work everywhere and so is best to avoid if you plan to distribute your game.)  Let's suppose your file is called &amp;quot;bgm.ogg&amp;quot;.  Load and play it just as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2 = file.loadSound(&amp;quot;bgm.ogg&amp;quot;)&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your sound is very long, and you want to stop it, you can just do &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.&lt;br /&gt;
&lt;br /&gt;
Before we move on, let's make this sound loop forever, as you might want background music to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2.loop = true&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, use &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt; to make it stop, or &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.  (The &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; command will also do that, in addition to clearing the current program and variables.)&lt;br /&gt;
&lt;br /&gt;
=== 3. About synthesized sounds ===&lt;br /&gt;
&lt;br /&gt;
Mini Micro has a sophisticated API for creating sounds out of nothing but code.  You can specify a base waveform, frequency, envelope, fade-in/fade-out, and even mix basic sounds together to create more sophisticated sounds.  You can find a couple of simple examples on the [[Sound.init]] page, and some more complex ones by doing &amp;lt;c&amp;gt;run &amp;quot;/sys/lib/sounds&amp;quot;&amp;lt;/c&amp;gt; (followed by &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; to see how those examples were made).&lt;br /&gt;
&lt;br /&gt;
== Write a program ==&lt;br /&gt;
&lt;br /&gt;
Typing commands directly on the command line is a great way to learn, explore, and test things out.  But to write more than a few lines, you'll want to use a code editor.  Assuming you've mounted a folder (rather than a minidisk file), you have two options: the built-in code editor, or an external code editor.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the built-in code editor ===&lt;br /&gt;
&lt;br /&gt;
The [[Mini Micro code editor]] is invoked with the &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; command.  Just type &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; by itself to edit the currently loaded program (or start a new program, if none is loaded).  Or, you can add a filename argument, like &amp;lt;c&amp;gt;edit &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;, to [[load]] a different program and open the editor in one step.&lt;br /&gt;
&lt;br /&gt;
Note that once a program is loaded, if you want to start a new program, use [[reset]] to clear the current program and variables.&lt;br /&gt;
&lt;br /&gt;
The built-in code editor is full-featured and powerful, including auto-indenting, code snippets, a color picker for color constants, and a sophisticated find/replace dialog.  See [[Mini Micro code editor|this page]] for usage details.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use an external code editor ===&lt;br /&gt;
&lt;br /&gt;
When you have mounted a real folder as your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; (or &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;) disk, then you can edit MiniScript files therein using your favorite code editor, outside of Mini Micro.  On the [[Tools]] page you can even find language models for editors like VS Code or BBEdit, to provide MiniScript-savvy syntax coloring.&lt;br /&gt;
&lt;br /&gt;
When you edit code in this way, you will need to reload the program from disk in Mini Micro to see your changes.  It's also generally a good idea to &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; the environment before running the new code, so that old function definitions or other variable values don't inadvertently change the behavior.  So after externally editing a script called &amp;quot;myGame.ms&amp;quot;, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reset; run &amp;quot;myGame&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in Mini Micro.  (And once you've done this once, you can generally just up-arrow to recall and repeat this command again the next time.)&lt;br /&gt;
&lt;br /&gt;
=== A simple game demo ===&lt;br /&gt;
&lt;br /&gt;
Using either method above, create a new MiniScript program called &amp;quot;ufo.ms&amp;quot;, and paste in the following.  (Or to learn even faster, retype it instead of using copy &amp;amp; paste.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare displays&lt;br /&gt;
clear&lt;br /&gt;
sd = display(4)  // sprite display&lt;br /&gt;
&lt;br /&gt;
// prepare UFO sprite and other resources&lt;br /&gt;
ufo = new Sprite&lt;br /&gt;
ufo.image = file.loadImage(&amp;quot;/sys/pics/UFO.png&amp;quot;)&lt;br /&gt;
sd.sprites.push ufo&lt;br /&gt;
ufo.x = 480; ufo.y = 320&lt;br /&gt;
&lt;br /&gt;
fireSound = file.loadSound(&amp;quot;/sys/sounds/blam.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// allow alternate &amp;quot;fire&amp;quot; buttons&lt;br /&gt;
fireButtons = [&amp;quot;space&amp;quot;, &amp;quot;left shift&amp;quot;, &amp;quot;right shift&amp;quot;,&lt;br /&gt;
  &amp;quot;joystick button 0&amp;quot;, &amp;quot;joystick button 1&amp;quot;]&lt;br /&gt;
firePressed = function&lt;br /&gt;
	for btn in fireButtons&lt;br /&gt;
		if key.pressed(btn) then return true&lt;br /&gt;
	end for&lt;br /&gt;
	return false&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// function to &amp;quot;fire&amp;quot; (play a sound)&lt;br /&gt;
fire = function&lt;br /&gt;
	fireSound.play&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
fireWasPressed = false&lt;br /&gt;
while true&lt;br /&gt;
	yield  // wait for next frame&lt;br /&gt;
	&lt;br /&gt;
	// move the UFO&lt;br /&gt;
	ufo.x += key.axis(&amp;quot;Horizontal&amp;quot;) * 20&lt;br /&gt;
	ufo.y += key.axis(&amp;quot;Vertical&amp;quot;) * 20&lt;br /&gt;
	&lt;br /&gt;
	// fire, when fire button goes down&lt;br /&gt;
	fireNowPressed = firePressed&lt;br /&gt;
	if fireNowPressed and not fireWasPressed then fire&lt;br /&gt;
	fireWasPressed = fireNowPressed&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a simple game demo which allows you to move a UFO around the screen using the arrow keys, WASD, or a game controller (which all feed into &amp;lt;c&amp;gt;[[key.axis]]&amp;lt;/c&amp;gt;).  And when you press any of several keys (including joystick/gamepad button 0 or 1), it plays a sound.&lt;br /&gt;
&lt;br /&gt;
Try changing the UFO sprite to your own custom sprite, and changing the fire sound to your own sound.  That will verify that you're able to get your own assets working in Mini Micro in a custom game program.  Then start playing around with the code.  Some things to try:&lt;br /&gt;
&lt;br /&gt;
* Limit the sprite position so it can't go offscreen&lt;br /&gt;
* Add some sort of target, as in &amp;lt;c&amp;gt;/sys/demo/spriteDemo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Make the sprite drop/fire a second sprite when the fire button is pressed&lt;br /&gt;
&lt;br /&gt;
== Package your game for the web ==&lt;br /&gt;
&lt;br /&gt;
If you've come here because you want to make a Mini Micro game for a game jam, then you should almost certainly learn how to package your game for playing on the web, and upload it to a site like itch.io.&lt;br /&gt;
&lt;br /&gt;
This process is described in detail on [[How to package a Mini Micro game]].  Focus on the general instructions at the top, and the &amp;quot;packaging for the web&amp;quot; instructions at the bottom.&lt;br /&gt;
&lt;br /&gt;
== Where to learn more ==&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You have learned how to set up a local Mini Micro environment for development, using your own game assets, and learned to use both the built-in and external code editors.  You've made a very simple game demo, and know how to upload it to the web.  All toolchain hurdles are behind you; now it's just a matter of designing a game, and writing the code!&lt;br /&gt;
&lt;br /&gt;
If you are a Python or Lua programmer, see the [[Python]] or [[Lua]] page of this wiki to see how MiniScript compares to those.&lt;br /&gt;
&lt;br /&gt;
When writing the code, you will probably lean most heavily on these resources:&lt;br /&gt;
&lt;br /&gt;
* The [https://miniscript.org/files/MiniMicro-CheatSheet.pdf Mini Micro Cheat Sheet], a 4-page summary of the Mini Micro API and MiniScript language&lt;br /&gt;
* This wiki, especially the [[How To]] articles&lt;br /&gt;
* Sample code found in &amp;lt;c&amp;gt;/sys/demo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Various blog posts, perhaps found through the [[Bibliography]] page&lt;br /&gt;
&lt;br /&gt;
Most important of all, rely on the '''community Discord server''', a link to which can be found at the bottom of the [https://miniscript.org/ MiniScript home page].  An active and friendly community hangs out here, and you are encouraged to share screenshots, code snippets, and questions there.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Python&amp;diff=1257</id>
		<title>Python</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Python&amp;diff=1257"/>
		<updated>2024-09-19T23:20:46Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Data Types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Python is a popular scripting language that was first released in 1991.  This article compares Python to MiniScript, and may be useful to people coming to MiniScript with a background in Python.&lt;br /&gt;
&lt;br /&gt;
For a side-by-side comparison on a collection of short programs, see [https://miniscript.org/compare/python.html here].&lt;br /&gt;
&lt;br /&gt;
== Similarities ==&lt;br /&gt;
&lt;br /&gt;
=== Data Types ===&lt;br /&gt;
&lt;br /&gt;
MiniScript's six data types have direct analogs to common types in Python:&lt;br /&gt;
&lt;br /&gt;
* '''Numbers''' in MiniScript are double-precision floating point numbers, equivalent to Python's &amp;lt;c&amp;gt;numbers.Real&amp;lt;/c&amp;gt; (aka &amp;lt;c&amp;gt;float&amp;lt;/c&amp;gt;) data type.  Note that in MiniScript, False and True are represented directly by the numbers 0 and 1; there is no separate &amp;lt;c&amp;gt;bool&amp;lt;/c&amp;gt; type.&lt;br /&gt;
&lt;br /&gt;
* '''Strings''' in both languages are an immutable sequence of Unicode code points.  String literals in both languages can be enclosed in double-quotes; MiniScript does not have the optional single-quote or triple-quote syntax.  While Python uses backslash-escaping to include a quotation mark within a literal, in MiniScript you just write the quotation mark twice, as in SQL.&lt;br /&gt;
&lt;br /&gt;
* '''Lists''' in both languages are a mutable sequence of arbitrary values; a list literal uses square brackets surrounding comma-delimited values (see List Syntax, below).  Note that MiniScript does not have a &amp;lt;c&amp;gt;tuple&amp;lt;/c&amp;gt; type, and uses a list in situations where Python might use a tuple.&lt;br /&gt;
&lt;br /&gt;
* '''Maps''' in both languages are mutable, unordered set of key-value pairs, with the same literal syntax (see Map Syntax and Object-Oriented Programming, below).&lt;br /&gt;
&lt;br /&gt;
* '''Function objects''' in both languages are similar: first-class, callable objects.  However functions in MiniScript have no attributes, and the syntax for defining functions is somewhat different.&lt;br /&gt;
&lt;br /&gt;
* '''&amp;lt;c&amp;gt;None&amp;lt;/c&amp;gt;''' in Python is called '''&amp;lt;c&amp;gt;null&amp;lt;/c&amp;gt;''' in MiniScript — a special datatype in both languages, representing a null reference.&lt;br /&gt;
&lt;br /&gt;
=== List Syntax ===&lt;br /&gt;
&lt;br /&gt;
The syntax for list literals is the same in Python and MiniScript: a series of arbitrary values, separated by commas and surrounded by square brackets.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;myList = [&amp;quot;apple&amp;quot;, &amp;quot;banana&amp;quot;, &amp;quot;cherry&amp;quot;, &amp;quot;date&amp;quot;]&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Index and slice syntax is also the same in both, except that MiniScript slicing supports only two parameters; it does not support the third (IndexJump) parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;myList[0]     // &amp;quot;apple&amp;quot;&lt;br /&gt;
myList[:2]    // [&amp;quot;apple&amp;quot;, &amp;quot;banana&amp;quot;]&lt;br /&gt;
myList[-3:]   // [&amp;quot;banana&amp;quot;, &amp;quot;cherry&amp;quot;, &amp;quot;date&amp;quot;]&lt;br /&gt;
myList[1:-1]  // [&amp;quot;banana&amp;quot;, &amp;quot;cherry&amp;quot;]&lt;br /&gt;
myList[:]     // independent copy of [&amp;quot;apple&amp;quot;, &amp;quot;banana&amp;quot;, &amp;quot;cherry&amp;quot;, &amp;quot;date&amp;quot;]&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike Python, you cannot assign to a slice; you can only assign to a single index.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;myList[1] = &amp;quot;orange&amp;quot;  // myList is now: [&amp;quot;apple&amp;quot;, &amp;quot;orange&amp;quot;, &amp;quot;cherry&amp;quot;, &amp;quot;date&amp;quot;]&lt;br /&gt;
myList[1:3] = [&amp;quot;lemon&amp;quot;]   // DOES NOT WORK&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Python, indexing and slicing in MiniScript also applies to strings (excluding assignment since strings in both languages are immutable).&lt;br /&gt;
&lt;br /&gt;
=== Map (Dictionary) Syntax ===&lt;br /&gt;
&lt;br /&gt;
The equivalent of a Python ''dict'' is called a ''map'' in MiniScript.  The syntax for such literals, and indexing into them, is the same in Python and MiniScript:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;m = {&amp;quot;one&amp;quot;:1, &amp;quot;two&amp;quot;:2, &amp;quot;three&amp;quot;:3}&lt;br /&gt;
print m[&amp;quot;two&amp;quot;]   // 2&lt;br /&gt;
m[&amp;quot;pi&amp;quot;] = 3.14&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike Python, in MiniScript when a key in a map happens to also be a valid literal, it can be accessed via [[dot syntax]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;print m.two  // 2&lt;br /&gt;
m.pi = 3.14157&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MiniScript does not have a concept of &amp;quot;attributes&amp;quot; as something separate from key/value pairs in a map.&lt;br /&gt;
&lt;br /&gt;
=== Variable Scope ===&lt;br /&gt;
&lt;br /&gt;
Variables in both Python and MiniScript are local by default.  There are some subtle differences, however: in Python, an inner function can implicitly access the variables of an outer function, but ''can't'' implicitly access global variables, while in MiniScript, any function can implicitly read values from both the outer context and the global context.  To update a global variable, where Python uses a special &amp;lt;c&amp;gt;global&amp;lt;/c&amp;gt; statement, MiniScript uses a &amp;lt;c&amp;gt;globals&amp;lt;/c&amp;gt; prefix in a manner similar to using &amp;lt;c&amp;gt;self&amp;lt;/c&amp;gt; to access object data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
x = 0&lt;br /&gt;
count = function&lt;br /&gt;
	globals.x = x + 1&lt;br /&gt;
	print &amp;quot;The new count is: &amp;quot; + x&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
count   // The new count is: 1&lt;br /&gt;
count   // The new count is: 2&lt;br /&gt;
count   // The new count is: 3&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Object-Oriented Programming ===&lt;br /&gt;
&lt;br /&gt;
Both MiniScript and Python support object-oriented programming, with some similarities and some differences.  MiniScript uses '''prototype-based inheritance''', where the difference between &amp;quot;class&amp;quot; and &amp;quot;instance&amp;quot; is mainly in the mind of the programmer.  Classes/instances are just maps, with the inheritance chain stored in a special &amp;lt;c&amp;gt;__isa&amp;lt;/c&amp;gt; entry that is automatically set by the [[new]] operator.&lt;br /&gt;
&lt;br /&gt;
Similarities between MiniScript and Python:&lt;br /&gt;
* inheritance and polymorphism&lt;br /&gt;
* use of [[self]] and [[super]]&lt;br /&gt;
&lt;br /&gt;
Differences in MiniScript, as compared to Python:&lt;br /&gt;
* prototype-based inheritance built on classes&lt;br /&gt;
* use of [[new]] to subclass or create an instance&lt;br /&gt;
* no constructors&lt;br /&gt;
* no operator overloading or other magic methods&lt;br /&gt;
&lt;br /&gt;
This MiniScript example illustrates some of these similarities and differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Person = {}   // any empty map can be considered a class&lt;br /&gt;
Person.init = function(name, age)  // not a magic method; just an ordinary method&lt;br /&gt;
    self.name = name   // note use of self (an implicit parameter)&lt;br /&gt;
    self.age = age&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
Person.sayHello = function&lt;br /&gt;
    print &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
Person.sayName = function&lt;br /&gt;
    print &amp;quot;My name is &amp;quot; + self.name + &amp;quot;.&amp;quot;&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
CoolPerson = new Person    // creating a &amp;quot;subclass&amp;quot; of Person&lt;br /&gt;
CoolPerson.sayHello = function    // overriding a function&lt;br /&gt;
    print &amp;quot;How you doin'?&amp;quot;&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
Joey = new CoolPerson      // creating an &amp;quot;instance&amp;quot; of CoolPerson&lt;br /&gt;
Joey.init &amp;quot;Joey&amp;quot;, 28&lt;br /&gt;
Joey.sayHello   // prints: How you doin'?&lt;br /&gt;
Joey.sayName    // prints: My name is Joey.&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Differences ==&lt;br /&gt;
&lt;br /&gt;
=== Language Scale ===&lt;br /&gt;
&lt;br /&gt;
MiniScript is a considerably smaller language by any reasonable measure.  For example, the following table compares Python and MiniScript on C/C++ source code lines, source code files, number of data types, and number of standard intrinsic functions, as of 2021 ([https://miniscript.org/files/Strout_iSTEM-Ed2021.pdf source]).&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! &lt;br /&gt;
! Python&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| Source Lines&lt;br /&gt;
| 661,775&lt;br /&gt;
| 13,752&lt;br /&gt;
|-&lt;br /&gt;
| Source Files&lt;br /&gt;
| 718&lt;br /&gt;
| 46&lt;br /&gt;
|-&lt;br /&gt;
| Data Types&lt;br /&gt;
| 34&lt;br /&gt;
| 6&lt;br /&gt;
|-&lt;br /&gt;
| Intrinsics&lt;br /&gt;
| 69&lt;br /&gt;
| 53&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Block Syntax ===&lt;br /&gt;
&lt;br /&gt;
The most obvious difference between Python and MiniScript is in block syntax.  While Python defines blocks by ending the opening line with a colon, and indenting the body of the block, MiniScript uses keyword pairs like &amp;lt;c&amp;gt;if&amp;lt;/c&amp;gt;/&amp;lt;c&amp;gt;end if&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;for&amp;lt;/c&amp;gt;/&amp;lt;c&amp;gt;end for&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;function&amp;lt;/c&amp;gt;/&amp;lt;c&amp;gt;end function&amp;lt;/c&amp;gt; (more similar to Visual Basic).  Indentation in MiniScript is strictly cosmetic, and is ignored by the compiler; and tools can automatically standardize or re-indent based on the keywords.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Python&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;pre&amp;gt;def myfunc():&lt;br /&gt;
  for i in range(1, 11):&lt;br /&gt;
    if i == 9:&lt;br /&gt;
      print(&amp;quot;Almost done...&amp;quot;)&lt;br /&gt;
    else:&lt;br /&gt;
      print(i)&lt;br /&gt;
&lt;br /&gt;
myfunc()&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &amp;lt;ms&amp;gt;myFunc = function&lt;br /&gt;
  for i in range(1, 10)&lt;br /&gt;
    if i == 9 then&lt;br /&gt;
      print &amp;quot;Almost done...&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      print i&lt;br /&gt;
    end if&lt;br /&gt;
  end for&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
myFunc&amp;lt;/ms&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Function Invocation ===&lt;br /&gt;
&lt;br /&gt;
While functions in Python are always invoked by putting parentheses after a function reference, in MiniScript, such parentheses can be omitted when (1) the function call is the entire statement, or (2) there are no arguments.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Python&lt;br /&gt;
! MiniScript&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;pre&amp;gt;import random&lt;br /&gt;
x = random.uniform(0,1)&lt;br /&gt;
print(x)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &amp;lt;ms&amp;gt;x = rnd&lt;br /&gt;
print x&amp;lt;/ms&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Magic Methods and Attributes ===&lt;br /&gt;
&lt;br /&gt;
Python uses a large number of &amp;quot;magic&amp;quot; (aka &amp;quot;dunder&amp;quot;) methods and attributes which have special meaning to the interpreter.  These support things like operator overloading (&amp;lt;c&amp;gt;__add__&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;__ne__&amp;lt;/c&amp;gt;, etc.), class support (&amp;lt;c&amp;gt;__class__&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;__subclasshook__&amp;lt;/c&amp;gt;), and documentation (&amp;lt;c&amp;gt;__doc__&amp;lt;/c&amp;gt;).  By implementing these methods or assigning to these attributes, you can substantially change the way instances of a class behave.&lt;br /&gt;
&lt;br /&gt;
MiniScript has no such magic methods or attributes, with the exception of the &amp;lt;c&amp;gt;__isa&amp;lt;/c&amp;gt; key used to track inheritance in maps.  &amp;lt;c&amp;gt;__isa&amp;lt;/c&amp;gt; is automatically set by [[new]] and used by the [[isa]] operator, so in most cases user code should not ever need to touch it.&lt;br /&gt;
&lt;br /&gt;
MiniScript does not support any form of operator overloading, or hooks to intercept other aspects of object behavior; objects always behave the same way.&lt;br /&gt;
&lt;br /&gt;
=== import ===&lt;br /&gt;
&lt;br /&gt;
While not part of the core language, several MiniScript environments (including [[Mini Micro]], [[Soda]], [[command-line MiniScript]], and [[Farmtronics]]) support an [[import]] command.  However the semantics are a bit different from Python.&lt;br /&gt;
&lt;br /&gt;
In MiniScript, the module name must be a string (usually, a string literal).  The [[import]] command searches for a corresponding script file, runs it in its own call context, and binds the result (as a map) to an identifier of the same name in the calling context.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
print mathUtil.dice(3,6)    // rolls 3d6 and prints the result&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that [[import]] always runs the code in the imported module, even if it was run before.  See the Usage Notes under [[import]] for an &amp;lt;c&amp;gt;ensureImport&amp;lt;/c&amp;gt; function that may be helpful to ensure a module is imported only once.&lt;br /&gt;
&lt;br /&gt;
MiniScript does not support the ''from'' syntax (e.g. Python's &amp;lt;c&amp;gt;from math import pi&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;from math import *&amp;lt;/c&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== range function ===&lt;br /&gt;
&lt;br /&gt;
The very common built-in function &amp;lt;c&amp;gt;range&amp;lt;/c&amp;gt; in both languages takes up to three arguments: ''start'', ''stop'', and ''step''.  But there are a few differences to note:&lt;br /&gt;
&lt;br /&gt;
* In Python, the ''stop'' value is not included in the resulting sequence, while in MiniScript it is (i.e., it is an inclusive bound).&lt;br /&gt;
* In Python, if ''stop'' is less than ''start'', the result is an empty list unless you also specify a negative ''step''.  In MiniScript, if ''step'' is omitted in such a case, it defaults to -1 (and you get a list that counts down).&lt;br /&gt;
* In Python, if only one argument is given, it is considered ''stop'' and the resulting sequence counts from 0 up to (but not including) that value.  In MiniScript, a single argument is ''start'' and the resulting sequence counts from that number down (or up) to 0.&lt;br /&gt;
* In Python, the result of &amp;lt;c&amp;gt;range&amp;lt;/c&amp;gt; is a '''range''' object; in MiniScript it is an ordinary list.&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1256</id>
		<title>How to get started with Mini Micro</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=How_to_get_started_with_Mini_Micro&amp;diff=1256"/>
		<updated>2024-09-19T16:49:44Z</updated>

		<summary type="html">&lt;p&gt;JoeStrout: /* Where to learn more */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://miniscript.org/MiniMicro/ Mini Micro] is a popular environment for creating 2D games and demos in MiniScript.  It is a retro-style virtual computer, which runs on most desktop platforms.  Mini Micro games can be [[How to package a Mini Micro game|packaged]] as stand-alone games for desktop or the web. &lt;br /&gt;
&lt;br /&gt;
This page is meant for people who have never used Mini Micro before, but want to make a Mini Micro game.  It is a step-by-step guide to building your first simple demo involving a sprite, game input, and sound effects, including your own resources, as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Get Mini Micro ==&lt;br /&gt;
&lt;br /&gt;
While you can run Mini Micro on the web, the web version has no ability to save files (nor does it support copy/paste).  So it's not useful for developing your own Mini Micro games.&lt;br /&gt;
&lt;br /&gt;
Go to the [https://miniscript.org/MiniMicro/#download Mini Micro download] page, click the button for your platform (Mac, Windows, or Linux), and save the resulting file to your local machine.  (If you don't have a Mac, Windows, or Linux desktop machine, then unfortunately you can't use Mini Micro yet, though iOS and Android versions are under development.)&lt;br /&gt;
&lt;br /&gt;
The downloaded file will be a .zip (Mac/Windows) or .tar.gz (Linux) file.  ''Unpack this file completely.''  Don't try to run Mini Micro from ''within'' the archive; extract all files to a real folder on your hard drive.&lt;br /&gt;
&lt;br /&gt;
Then, find the Mini Micro application in that folder.  Double-click it to launch Mini Micro.  The result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:MiniMicro.png|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Mount a folder as /usr ==&lt;br /&gt;
&lt;br /&gt;
Mini Micro can access two virtual &amp;quot;disks&amp;quot; at once; within the Mini Micro environment, these are accessed as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Each of these can be either a '''.minidisk file''', or a '''real folder''' on the host (desktop) system.  Out of the box, Mini Micro creates an empty .minidisk file for you, to keep things nice and neat.  But for any serious development, you're going to want to mount a real folder instead, so that you can easily move files in and out of this folder, use your favorite external image/sound editors, etc.&lt;br /&gt;
&lt;br /&gt;
Create a folder on your desktop system, wherever you normally keep your documents.  This will be your project folder for your first Mini Micro game.  Put a small text file, image (in PNG or JPEG format), or sound file (in WAV or OGG format) in there.  Our goal now is to see and view this file (and any others in that folder or its subfolders) in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the disk slot menu ===&lt;br /&gt;
&lt;br /&gt;
Those two thin dark rectangles in the bottom-left corner of the Mini Micro window are &amp;quot;disk slots.&amp;quot;  The top slot represents &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;, and the bottom slot represents &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;.  Click the top slot to pop open the menu, and select the &amp;quot;Mount Folder...&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
[[File:MountFolder.png|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Selecting that command should bring up the native file dialog for your platform, allowing you to select any folder you have access to.  Pick the project folder you created above.  (Note: some Linux platforms have a bug which crashes Mini Micro at this point; if that happens to you, go on to Method 2.)&lt;br /&gt;
&lt;br /&gt;
Now, in the Mini Micro display, at the blinking orange prompt, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;dir&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and press Return or Enter.  You should see your file listed.  Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;view &amp;quot;myfile.txt&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
but replace ''myfile.txt'' with the name of whatever file you placed in your project folder.  Be sure to include the quotation marks; you're typing MiniScript code here, not some other shell language, so string literals always need to be surrounded by double quotes.  If you do it correctly, the contents of your text file or image should appear on the screen.&lt;br /&gt;
&lt;br /&gt;
(You could also do &amp;lt;c&amp;gt;view findFile&amp;lt;/c&amp;gt;, which would pop up the little file browser within the [[findFile]] command, and select your file that way.)&lt;br /&gt;
&lt;br /&gt;
Note that the currently mounted disk is saved in preferences, so if you quit and relaunch Mini Micro, you generally won't need to do this step again; the previously mounted disks will still be there.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use command-line arguments ===&lt;br /&gt;
&lt;br /&gt;
If you are unfortunate enough to hit that Linux bug which causes the file dialogs to crash, or for some other reason you want to launch Mini Micro from the command line (or a shell script) with the correct folder already mounted, then you can use [[Command-line arguments|command-line arguments]] instead.  Open your favorite terminal program, and navigate to where the Mini Micro executable is located.  The details vary by platform, so let's break it down:&lt;br /&gt;
&lt;br /&gt;
'''Linux'''&lt;br /&gt;
&lt;br /&gt;
In Linux, the executable is called '''MiniMicro.x86_64''', so you would type a command like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;./MiniMicro.x86_64 -usr ~/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''Windows'''&lt;br /&gt;
&lt;br /&gt;
In Windows, you can open the command prompt by pressing '''Win + R''' to open the Run dialog, and entering ''cmd''.  (If you already have some other preferred terminal app, like PowerShell, that's fine too.)  Then &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; to the directory containing Mini Micro.  The executable here is called '''Mini Micro.exe''', so you would use a command like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;&amp;quot;Mini Micro.exe&amp;quot; -usr &amp;quot;%HOMEPATH%\mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;%HOMEPATH%\mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
'''MacOS'''&lt;br /&gt;
&lt;br /&gt;
On Mac, the actual executable is hidden inside the application bundle, specifically under Contents/MacOS.  So if you've already launched Terminal and navigated to where '''MiniMicro.app''' is found, then you would do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;Contents/MacOS/Mini\ Micro -usr ~/Documents/mmdev&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;c&amp;gt;~/Documents/mmdev&amp;lt;/c&amp;gt; with the path to your project folder.&lt;br /&gt;
&lt;br /&gt;
If successful (on any platform), you should be able to use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to view the file in your project folder within the Mini Micro environment.&lt;br /&gt;
&lt;br /&gt;
== Create a sprite ==&lt;br /&gt;
&lt;br /&gt;
Now let's get a sprite up on the screen.  We're going to do this using the Mini Micro command line (or [[REPL]]), where you type a command and executes immediately.  We'll get to writing real programs later, but the command-line is a powerful tool for learning and exploring, so let's use it.&lt;br /&gt;
&lt;br /&gt;
=== 1. Make a sprite from the built-in images ===&lt;br /&gt;
&lt;br /&gt;
At the orange blinking-cursor prompt in Mini Micro, carefully type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;clear&lt;br /&gt;
sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a furry purple Wumpus peeking out from the lower-left corner of the screen (which is the origin of Mini Micro's [[Screen coordinates|coordinate system]]).&lt;br /&gt;
&lt;br /&gt;
[[File:ManualSprite.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
If you don't see this, go back and double-check your typing.  Note that you can recall a previous command on the command line by pressing the '''up-arrow'' key, then just edit it and press Return to run the edited command.&lt;br /&gt;
&lt;br /&gt;
How does this work?  Let's break it down:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;c&amp;gt;[[clear]]&amp;lt;/c&amp;gt; clears the screen and resets all eight display layers to their default states.  This includes setting display 4 to be a [[SpriteDisplay]].  (That's the default state when Mini Micro boots, but useful whenever your screen is cluttered anyway.)&lt;br /&gt;
# &amp;lt;c&amp;gt;sp = new Sprite&amp;lt;/c&amp;gt; creates a new [[Sprite]] object, and assigns it to a variable called &amp;lt;c&amp;gt;sp&amp;lt;/c&amp;gt;.&lt;br /&gt;
# &amp;lt;c&amp;gt;sp.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&amp;lt;/c&amp;gt; loads an image called &amp;quot;Wumpus.png&amp;quot; from the &amp;lt;c&amp;gt;/sys/pics&amp;lt;/c&amp;gt; directory.  (Notice that Mini Micro uses forward-slashes in file paths, even if the host system is Windows.)&lt;br /&gt;
# &amp;lt;c&amp;gt;display(4).sprites.push sp&amp;lt;/c&amp;gt; pushes this new sprite onto the sprite list of display 4, so it can be seen.&lt;br /&gt;
&lt;br /&gt;
Once you have the Wumpus peeking out of the corner, let's move it and rotate it a bit.  Notice how the sprite updates immediately after each command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp.x = 480&lt;br /&gt;
sp.y = 320&lt;br /&gt;
sp.rotation = 45&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Make a sprite from your own custom image ===&lt;br /&gt;
&lt;br /&gt;
The Wumpus sprite above was created from one of the built-in images that comes with Mini Micro.  There are hundreds of these, stored on a hidden, read-only disk mounted as &amp;lt;c&amp;gt;/sys&amp;lt;/c&amp;gt;.  Feel free to use the &amp;lt;c&amp;gt;findFile&amp;lt;/c&amp;gt; command to explore what's there.&lt;br /&gt;
&lt;br /&gt;
But for your own game, you're probably going to want to use your own custom sprites.  So, put an image in PNG format into your project directory (the one you mounted as &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt;).  Use the &amp;lt;c&amp;gt;pwd&amp;lt;/c&amp;gt; (print working directory) and &amp;lt;c&amp;gt;cd&amp;lt;/c&amp;gt; (change directory) commands to be sure you are in your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; directory.  Then use the &amp;lt;c&amp;gt;dir&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;view&amp;lt;/c&amp;gt; commands to ensure that you can see and load your user file.&lt;br /&gt;
&lt;br /&gt;
Now, just repeat the commands you did to create a sprite above, but substitute the path to your custom image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;sp = new Sprite&lt;br /&gt;
sp.image = file.loadImage(&amp;quot;myCustomImage.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push sp&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven't [[clear]]ed the display since step 1, then you'll see your new sprite ''and'' the Wumpus on screen at the same time.  And if you now move (by assigning to &amp;lt;c&amp;gt;.x&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;.y&amp;lt;/c&amp;gt;) your sprites so that they overlap, you'll see that your new sprite is drawn on top of the older one.  That's because sprites are drawn in the order in which they appear in the [[SpriteDisplay.sprites|sprites list]] of the [[SpriteDisplay]].&lt;br /&gt;
&lt;br /&gt;
=== 3. Extract an image from a sprite sheet ===&lt;br /&gt;
&lt;br /&gt;
Often you have multiple sprite images arranged in one bigger image file, called a '''sprite sheet''' or '''sprite atlas'''.  You can pull apart such a sprite sheet by using the [[Image.getImage]] function.  Let's try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;enemies = file.loadImage(&amp;quot;/sys/pics/Enemies.png&amp;quot;)&lt;br /&gt;
view enemies&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This loads and displays [https://github.com/JoeStrout/minimicro-sysdisk/blob/master/sys/pics/Enemies.png?raw=true this big image], which contains a number of platformer enemies, in a 128x128 pixel grid.  Let's make a sprite out of the top-left image.  Keep in mind that coordinates in Mini Micro go from the bottom-left corner, so that top image starts at 128 * 3 = 384.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;goob = new Sprite&lt;br /&gt;
goob.image = enemies.getImage(0, 384, 128, 128)&lt;br /&gt;
display(4).sprites.push goob&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a new sprite called &amp;lt;c&amp;gt;goob&amp;lt;/c&amp;gt;, assigns it an image from our &amp;lt;c&amp;gt;enemies&amp;lt;/c&amp;gt; sprite sheet, and pushes it onto the display.  As always, it starts out in the bottom-left corner, but you know how to adjust that by now.  Since this sprite is a bit bigger than it probably needs to be, also try &amp;lt;c&amp;gt;goob.scale = 0.5&amp;lt;/c&amp;gt; to shrink it down.&lt;br /&gt;
&lt;br /&gt;
== Play a sound ==&lt;br /&gt;
&lt;br /&gt;
Almost any game needs [[sound]] effects!  Mini Micro supports both playing both digitized sounds loaded from a file, and sounds synthesized at runtime.  We'll focus here on playing sounds from a file, which can be in either WAV or OGG format.&lt;br /&gt;
&lt;br /&gt;
=== 1. Play one of the built-in sounds ===&lt;br /&gt;
&lt;br /&gt;
Enter &amp;lt;c&amp;gt;clear&amp;lt;/c&amp;gt; to clear the screen, then try this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd = file.loadSound(&amp;quot;/sys/sounds/twinkle.wav&amp;quot;)&lt;br /&gt;
snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should hear a twinkle sound.  The [[Sound.play]] method supports several optional parameters.  A handy trick when you need a quick reminder of function parameters is to use [[@]] (the at-sign) before a function reference, to return the function without invoking it.  On the command line, that will print the function parameter names and default values.  Try it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;@snd.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
which prints:&lt;br /&gt;
&amp;lt;ms&amp;gt;FUNCTION(self, volume=1, pan=0, speed=1)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So let's try some variations on the sound.  (In the code below, we're using &amp;lt;c&amp;gt;//&amp;lt;/c&amp;gt; to add a [[Comments|comment]] on each line; you don't have to type these, but you can if you like.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd.play 0.1   // play very quietly&lt;br /&gt;
snd.play 1, -1     // play out the left speaker only&lt;br /&gt;
snd.play 1, 0, 2   // play twice as fast (an octave higher)&lt;br /&gt;
snd.play 1, 0, 0.5 // play half as fast (an octave lower)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2. Play your own custom sound ===&lt;br /&gt;
&lt;br /&gt;
Put a sound file in WAV or OGG format into your project folder.  (On some platforms you can also use MP3 format, but that doesn't work everywhere and so is best to avoid if you plan to distribute your game.)  Let's suppose your file is called &amp;quot;bgm.ogg&amp;quot;.  Load and play it just as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2 = file.loadSound(&amp;quot;bgm.ogg&amp;quot;)&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your sound is very long, and you want to stop it, you can just do &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to stop all sounds.&lt;br /&gt;
&lt;br /&gt;
Before we move on, let's make this sound loop forever, as you might want background music to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;snd2.loop = true&lt;br /&gt;
snd2.play&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, use &amp;lt;c&amp;gt;snd2.stop&amp;lt;/c&amp;gt;.  Or you can use &amp;lt;c&amp;gt;Sound.stopAll&amp;lt;/c&amp;gt; to make it stop.&lt;br /&gt;
&lt;br /&gt;
=== 3. About synthesized sounds ===&lt;br /&gt;
&lt;br /&gt;
Mini Micro has a sophisticated API for creating sounds out of nothing but code.  You can specify a base waveform, frequency, envelope, fade-in/fade-out, and even mix basic sounds together to create more sophisticated sounds.  You can find a couple of simple examples on the [[Sound.init]] page, and some more complex ones by doing &amp;lt;c&amp;gt;run &amp;quot;/sys/lib/sounds&amp;quot;&amp;lt;/c&amp;gt; (followed by &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; to see how those examples were made).&lt;br /&gt;
&lt;br /&gt;
== Write a program ==&lt;br /&gt;
&lt;br /&gt;
Typing commands directly on the command line is a great way to learn, explore, and test things out.  But to write more than a few lines, you'll want to use a code editor.  Assuming you've mounted a folder (rather than a minidisk file), you have two options: the built-in code editor, or an external code editor.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use the built-in code editor ===&lt;br /&gt;
&lt;br /&gt;
The [[Mini Micro code editor]] is invoked with the &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; command.  Just type &amp;lt;c&amp;gt;edit&amp;lt;/c&amp;gt; by itself to edit the currently loaded program (or start a new program, if none is loaded).  Or, you can add a filename argument, like &amp;lt;c&amp;gt;edit &amp;quot;myGame&amp;quot;&amp;lt;/c&amp;gt;, to [[load]] a different program and open the editor in one step.&lt;br /&gt;
&lt;br /&gt;
Note that once a program is loaded, if you want to start a new program, use [[reset]] to clear the current program and variables.&lt;br /&gt;
&lt;br /&gt;
The built-in code editor is full-featured and powerful, including auto-indenting, code snippets, a color picker for color constants, and a sophisticated find/replace dialog.  See [[Mini Micro code editor|this page]] for usage details.&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Use an external code editor ===&lt;br /&gt;
&lt;br /&gt;
When you have mounted a real folder as your &amp;lt;c&amp;gt;/usr&amp;lt;/c&amp;gt; (or &amp;lt;c&amp;gt;/usr2&amp;lt;/c&amp;gt;) disk, then you can edit MiniScript files therein using your favorite code editor, outside of Mini Micro.  On the [[Tools]] page you can even find language models for editors like VS Code or BBEdit, to provide MiniScript-savvy syntax coloring.&lt;br /&gt;
&lt;br /&gt;
When you edit code in this way, you will need to reload the program from disk in Mini Micro to see your changes.  It's also generally a good idea to &amp;lt;c&amp;gt;reset&amp;lt;/c&amp;gt; the environment before running the new code, so that old function definitions or other variable values don't inadvertently change the behavior.  So after externally editing a script called &amp;quot;myGame.ms&amp;quot;, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reset; run &amp;quot;myGame&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in Mini Micro.  (And once you've done this once, you can generally just up-arrow to recall and repeat this command again the next time.)&lt;br /&gt;
&lt;br /&gt;
=== A simple game demo ===&lt;br /&gt;
&lt;br /&gt;
Using either method above, create a new MiniScript program called &amp;quot;ufo.ms&amp;quot;, and paste in the following.  (Or to learn even faster, retype it instead of using copy &amp;amp; paste.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// prepare displays&lt;br /&gt;
clear&lt;br /&gt;
sd = display(4)  // sprite display&lt;br /&gt;
&lt;br /&gt;
// prepare UFO sprite and other resources&lt;br /&gt;
ufo = new Sprite&lt;br /&gt;
ufo.image = file.loadImage(&amp;quot;/sys/pics/UFO.png&amp;quot;)&lt;br /&gt;
sd.sprites.push ufo&lt;br /&gt;
ufo.x = 480; ufo.y = 320&lt;br /&gt;
&lt;br /&gt;
fireSound = file.loadSound(&amp;quot;/sys/sounds/blam.wav&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// allow alternate &amp;quot;fire&amp;quot; buttons&lt;br /&gt;
fireButtons = [&amp;quot;space&amp;quot;, &amp;quot;left shift&amp;quot;, &amp;quot;right shift&amp;quot;,&lt;br /&gt;
  &amp;quot;joystick button 0&amp;quot;, &amp;quot;joystick button 1&amp;quot;]&lt;br /&gt;
firePressed = function&lt;br /&gt;
	for btn in fireButtons&lt;br /&gt;
		if key.pressed(btn) then return true&lt;br /&gt;
	end for&lt;br /&gt;
	return false&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// function to &amp;quot;fire&amp;quot; (play a sound)&lt;br /&gt;
fire = function&lt;br /&gt;
	fireSound.play&lt;br /&gt;
end function&lt;br /&gt;
&lt;br /&gt;
// main loop&lt;br /&gt;
fireWasPressed = false&lt;br /&gt;
while true&lt;br /&gt;
	yield  // wait for next frame&lt;br /&gt;
	&lt;br /&gt;
	// move the UFO&lt;br /&gt;
	ufo.x += key.axis(&amp;quot;Horizontal&amp;quot;) * 20&lt;br /&gt;
	ufo.y += key.axis(&amp;quot;Vertical&amp;quot;) * 20&lt;br /&gt;
	&lt;br /&gt;
	// fire, when fire button goes down&lt;br /&gt;
	fireNowPressed = firePressed&lt;br /&gt;
	if fireNowPressed and not fireWasPressed then fire&lt;br /&gt;
	fireWasPressed = fireNowPressed&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a simple game demo which allows you to move a UFO around the screen using the arrow keys, WASD, or a game controller (which all feed into &amp;lt;c&amp;gt;[[key.axis]]&amp;lt;/c&amp;gt;).  And when you press any of several keys (including joystick/gamepad button 0 or 1), it plays a sound.&lt;br /&gt;
&lt;br /&gt;
Try changing the UFO sprite to your own custom sprite, and changing the fire sound to your own sound.  That will verify that you're able to get your own assets working in Mini Micro in a custom game program.  Then start playing around with the code.  Some things to try:&lt;br /&gt;
&lt;br /&gt;
* Limit the sprite position so it can't go offscreen&lt;br /&gt;
* Add some sort of target, as in &amp;lt;c&amp;gt;/sys/demo/spriteDemo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Make the sprite drop/fire a second sprite when the fire button is pressed&lt;br /&gt;
&lt;br /&gt;
== Package your game for the web ==&lt;br /&gt;
&lt;br /&gt;
If you've come here because you want to make a Mini Micro game for a game jam, then you should almost certainly learn how to package your game for playing on the web, and upload it to a site like itch.io.&lt;br /&gt;
&lt;br /&gt;
This process is described in detail on [[How to package a Mini Micro game]].  Focus on the general instructions at the top, and the &amp;quot;packaging for the web&amp;quot; instructions at the bottom.&lt;br /&gt;
&lt;br /&gt;
== Where to learn more ==&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You have learned how to set up a local Mini Micro environment for development, using your own game assets, and learned to use both the built-in and external code editors.  You've made a very simple game demo, and know how to upload it to the web.  All toolchain hurdles are behind you; now it's just a matter of designing a game, and writing the code!&lt;br /&gt;
&lt;br /&gt;
If you are a Python or Lua programmer, see the [[Python]] or [[Lua]] page of this wiki to see how MiniScript compares to those.&lt;br /&gt;
&lt;br /&gt;
When writing the code, you will probably lean most heavily on these resources:&lt;br /&gt;
&lt;br /&gt;
* The [https://miniscript.org/files/MiniMicro-CheatSheet.pdf Mini Micro Cheat Sheet], a 4-page summary of the Mini Micro API and MiniScript language&lt;br /&gt;
* This wiki, especially the [[How To]] articles&lt;br /&gt;
* Sample code found in &amp;lt;c&amp;gt;/sys/demo&amp;lt;/c&amp;gt;&lt;br /&gt;
* Various blog posts, perhaps found through the [[Bibliography]] page&lt;br /&gt;
&lt;br /&gt;
Most important of all, rely on the '''community Discord server''', a link to which can be found at the bottom of the [https://miniscript.org/ MiniScript home page].  An active and friendly community hangs out here, and you are encouraged to share screenshots, code snippets, and questions there.&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
</feed>