<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.oxeyegames.com/wiki/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.oxeyegames.com/wiki/index.php?feed=atom&amp;target=Jeb&amp;title=Special%3AContributions%2FJeb</id>
		<title>OxeyeWiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.oxeyegames.com/wiki/index.php?feed=atom&amp;target=Jeb&amp;title=Special%3AContributions%2FJeb"/>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Special:Contributions/Jeb"/>
		<updated>2026-04-20T05:29:28Z</updated>
		<subtitle>From OxeyeWiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/File_Objects</id>
		<title>File Objects</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/File_Objects"/>
				<updated>2010-02-08T10:19:04Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: /* Compressed on Disk (z) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}}&lt;br /&gt;
&lt;br /&gt;
DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have greater control over the file structure, as Lua generally only works with strings and doubles in normal cases.&lt;br /&gt;
&lt;br /&gt;
If you only want to write text to the file, it is recommended that you use the standard IO Lua library instead: [http://lua-users.org/wiki/IoLibraryTutorial Lua IO Tutorial]&lt;br /&gt;
&lt;br /&gt;
== File Modes ==&lt;br /&gt;
&lt;br /&gt;
The file objects can handle three different modes of writing and reading. This is chosen by giving different settings when creating the file objects.&lt;br /&gt;
&lt;br /&gt;
=== File on Disk (f) ===&lt;br /&gt;
&lt;br /&gt;
This is the default behaviour. The data will be written or read from a binary file on disk.&lt;br /&gt;
&lt;br /&gt;
=== Compressed on Disk (z) ===&lt;br /&gt;
&lt;br /&gt;
When writing a compressed file, all data will first be written into memory and then compressed (as a zip) before being written to disk. When reading a compressed file, the whole file will be read into memory and then unpacked.&lt;br /&gt;
&lt;br /&gt;
Note: This mode will only compress the data to save disk space, the written file will not be a valid zip archive.&lt;br /&gt;
&lt;br /&gt;
=== In Memory (m) ===&lt;br /&gt;
&lt;br /&gt;
You can also use the file objects to serialize things in memory (without writing to disk).&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadWideString</id>
		<title>ReadWideString</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadWideString"/>
				<updated>2010-02-07T18:55:59Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:readWideString() | Reads a WChar string from the file. | {{NoParams}} | Returns a WChar object if the file is ok. }} === Example === &amp;lt;pre&amp;gt;    local value = fil...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:readWideString()&lt;br /&gt;
|&lt;br /&gt;
Reads a WChar string from the file.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns a WChar object if the file is ok.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local value = file:readWideString()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadString</id>
		<title>ReadString</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadString"/>
				<updated>2010-02-07T18:55:01Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:readString() | Reads a string from the file. | {{NoParams}} | Returns a string if the file is ok. }} === Example === &amp;lt;pre&amp;gt;    local value = file:readString() &amp;lt;...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:readString()&lt;br /&gt;
|&lt;br /&gt;
Reads a string from the file.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns a string if the file is ok.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local value = file:readString()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadInt</id>
		<title>ReadInt</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadInt"/>
				<updated>2010-02-07T18:54:30Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:readInt() | Reads an integer from the file. | {{NoParams}} | Returns an integer if the file is ok. }} === Example === &amp;lt;pre&amp;gt;    local value = file:readInt() &amp;lt;/p...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:readInt()&lt;br /&gt;
|&lt;br /&gt;
Reads an integer from the file.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns an integer if the file is ok.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local value = file:readInt()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadFloat</id>
		<title>ReadFloat</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadFloat"/>
				<updated>2010-02-07T18:54:01Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:readFloat() | Reads a floating point value from the file. | {{NoParams}} | Returns a number if the file is ok. }} === Example === &amp;lt;pre&amp;gt;    local value = file:r...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:readFloat()&lt;br /&gt;
|&lt;br /&gt;
Reads a floating point value from the file.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns a number if the file is ok.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local value = file:readFloat()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadByte</id>
		<title>ReadByte</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadByte"/>
				<updated>2010-02-07T18:53:27Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:readByte() | Reads a byte from the file. | {{NoParams}} | Returns a clamped integer (0 to 255) if the file is ok. }} === Example === &amp;lt;pre&amp;gt;    local value = fil...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:readByte()&lt;br /&gt;
|&lt;br /&gt;
Reads a byte from the file.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns a clamped integer (0 to 255) if the file is ok.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local value = file:readByte()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadBoolean</id>
		<title>ReadBoolean</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadBoolean"/>
				<updated>2010-02-07T18:52:45Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:readBoolean() | Reads a boolean from the file. | {{NoParams}} | Returns a boolean if the file is ok. }} === Example === &amp;lt;pre&amp;gt;    local value = file:readBoolean...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:readBoolean()&lt;br /&gt;
|&lt;br /&gt;
Reads a boolean from the file.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns a boolean if the file is ok.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local value = file:readBoolean()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteWideString</id>
		<title>WriteWideString</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteWideString"/>
				<updated>2010-02-07T18:50:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:writeWideString(value) | Writes a WChar string to the file. | {{MethodParam|value|A WChar object|The value to be written.}} | Returns nothing. }} === Example =...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeWideString(value)&lt;br /&gt;
|&lt;br /&gt;
Writes a WChar string to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|A WChar object|The value to be written.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local unicodeName = WChar(player.name)&lt;br /&gt;
   file:writeWideString(unicodeName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteString</id>
		<title>WriteString</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteString"/>
				<updated>2010-02-07T18:49:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:writeString(value) | Writes a string to the file. | {{MethodParam|value|A string|The value to be written.}} | Returns nothing. }} === Example === &amp;lt;pre&amp;gt;    file...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeString(value)&lt;br /&gt;
|&lt;br /&gt;
Writes a string to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|A string|The value to be written.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeString(player.name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteInt</id>
		<title>WriteInt</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteInt"/>
				<updated>2010-02-07T18:49:16Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeInt(value)&lt;br /&gt;
|&lt;br /&gt;
Writes an integer to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|An integer|The value to be written.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeInt(score)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteInt</id>
		<title>WriteInt</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteInt"/>
				<updated>2010-02-07T18:49:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:writeInte(value) | Writes an integer to the file. | {{MethodParam|value|An integer|The value to be written.}} | Returns nothing. }} === Example === &amp;lt;pre&amp;gt;    fi...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeInte(value)&lt;br /&gt;
|&lt;br /&gt;
Writes an integer to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|An integer|The value to be written.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeInt(score)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteFloat</id>
		<title>WriteFloat</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteFloat"/>
				<updated>2010-02-07T18:48:32Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:writeFloat(value) | Writes a floating point value to the file. | {{MethodParam|value|A number|The value to be written.}} | Returns nothing. }} === Example === ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeFloat(value)&lt;br /&gt;
|&lt;br /&gt;
Writes a floating point value to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|A number|The value to be written.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeFloat(player.x)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteByte</id>
		<title>WriteByte</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteByte"/>
				<updated>2010-02-07T18:47:55Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeByte(value)&lt;br /&gt;
|&lt;br /&gt;
Writes a byte value (0 to 255) to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|An integer|The value to be written. Will be clamped to 0..255.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeByte(level)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteByte</id>
		<title>WriteByte</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteByte"/>
				<updated>2010-02-07T18:47:44Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:writeBoolean(value) | Writes a byte value (0 to 255) to the file. | {{MethodParam|value|An integer|The value to be written. Will be clamped to 0..255.}} | Retu...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeBoolean(value)&lt;br /&gt;
|&lt;br /&gt;
Writes a byte value (0 to 255) to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|An integer|The value to be written. Will be clamped to 0..255.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeByte(level)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteBoolean</id>
		<title>WriteBoolean</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteBoolean"/>
				<updated>2010-02-07T18:46:58Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:writeBoolean(value) | Writes a boolean value to the file. | {{MethodParam|value|A boolean|The value to be written.}} | Returns nothing. }} === Example === &amp;lt;pre...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:writeBoolean(value)&lt;br /&gt;
|&lt;br /&gt;
Writes a boolean value to the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|value|A boolean|The value to be written.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:writeBoolean(false)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Seek_(File)</id>
		<title>Seek (File)</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Seek_(File)"/>
				<updated>2010-02-07T18:45:59Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:seek(bytes[, relative]) | Moves the read cursor in the file. | {{MethodParam|bytes|An integer|How many bytes to move.}} {{MethodParam|relative|Optional boolean...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:seek(bytes[, relative])&lt;br /&gt;
|&lt;br /&gt;
Moves the read cursor in the file.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|bytes|An integer|How many bytes to move.}}&lt;br /&gt;
{{MethodParam|relative|Optional boolean|Set this to true to move the cursor relative to its current position. The default value is false, which means daisy will seek from the beginning of the file.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:seek(0) -- jump back to the beginning of the file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/IsOk_(File)</id>
		<title>IsOk (File)</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/IsOk_(File)"/>
				<updated>2010-02-07T18:43:15Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:isOk() | Checks if a ReadFile is in &amp;quot;ok&amp;quot; status. | {{NoParams}} | Returns true if the file has been opened and can be read from. }} === Example === &amp;lt;pre&amp;gt;    lo...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:isOk()&lt;br /&gt;
|&lt;br /&gt;
Checks if a ReadFile is in &amp;quot;ok&amp;quot; status.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns true if the file has been opened and can be read from.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local file = ReadFile(&amp;quot;myfile.dat&amp;quot;, &amp;quot;f&amp;quot;)&lt;br /&gt;
   if file:isOk() then&lt;br /&gt;
      -- read bunch of stuff&lt;br /&gt;
      file:close()&lt;br /&gt;
   end&lt;br /&gt;
   -- you don't need to close files that aren't ok&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Close_(File)</id>
		<title>Close (File)</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Close_(File)"/>
				<updated>2010-02-07T18:41:40Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{FileMethod| file:close() | Closes the file handle. No reading or writing is possible on a file that has been closed. | {{NoParams}} | Returns nothing. }} === Example === &amp;lt;pre&amp;gt; ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FileMethod|&lt;br /&gt;
file:close()&lt;br /&gt;
|&lt;br /&gt;
Closes the file handle. No reading or writing is possible on a file that has been closed.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   file:close()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Template:FileMethod</id>
		<title>Template:FileMethod</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Template:FileMethod"/>
				<updated>2010-02-07T18:40:20Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot; |- |style=&amp;quot;background:#97c7d7; font-size:150%;&amp;quot; colspan=&amp;quot;3&amp;quot;|'''{{{1}}}''' |- |cols...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#97c7d7; font-size:150%;&amp;quot; colspan=&amp;quot;3&amp;quot;|'''{{{1}}}'''&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;3&amp;quot;| {{{2}}}&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#97c7d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#97c7d7&amp;quot;| '''Expected Type'''&lt;br /&gt;
|style=&amp;quot;background:#97c7d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{{3}}}&lt;br /&gt;
|style=&amp;quot;background:#97c7d7&amp;quot; colspan=&amp;quot;3&amp;quot;| '''Returns'''&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;3&amp;quot;| {{{4}}}&lt;br /&gt;
|} {{File}}&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{FileMethod |&lt;br /&gt;
file:exampleMethod(x, y)&lt;br /&gt;
|&lt;br /&gt;
This is an example usage of the FileMethod template. Methods of the file objects should contain this template, with the&lt;br /&gt;
paramters for method name, description, parameter list and return values, and then an example of how the&lt;br /&gt;
method is used.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|x|A number|This is a parameter using the MethodParam template.}}&lt;br /&gt;
{{MethodParam|y|A number|Here's a second parameter. If a method has 0 parameters, you can use the NoParams template instead.}}&lt;br /&gt;
|&lt;br /&gt;
The fourth parameter is a description of the method's return value or values, if any.}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadFile</id>
		<title>ReadFile</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadFile"/>
				<updated>2010-02-07T18:36:06Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}}The ReadFile class will open a binary file for reading.&lt;br /&gt;
&lt;br /&gt;
Call the ReadFile(source, mode) constructor to create a file for reading. The &amp;quot;source&amp;quot; parameter depends on the mode. If the mode is file on disk &amp;quot;f&amp;quot; or compressed file on disk &amp;quot;z&amp;quot;, then the source is the file name. If the mode is in memory &amp;quot;m&amp;quot;, then the source should be a WriteFile object.&lt;br /&gt;
&lt;br /&gt;
=== Disk Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)&lt;br /&gt;
   local file = ReadFile(path .. filename, &amp;quot;f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
   if not file:isOk() then&lt;br /&gt;
      print(&amp;quot;Unable to open &amp;quot; .. filename)&lt;br /&gt;
      return&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
   local fileVersion = file:readInt()&lt;br /&gt;
   playerName = file:readString()&lt;br /&gt;
   -- ... and so on ...&lt;br /&gt;
&lt;br /&gt;
   file:close()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In Memory Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   gameData.savedState = WriteFile(nil, &amp;quot;m&amp;quot;) -- create a memory file&lt;br /&gt;
&lt;br /&gt;
   -- write a bunch of stuff&lt;br /&gt;
   gameData.savedState:writeInt(value)&lt;br /&gt;
   &lt;br /&gt;
   -- no need to close the file&lt;br /&gt;
&lt;br /&gt;
   -- restore state...&lt;br /&gt;
   local readState = ReadFile(gameData.savedState, &amp;quot;m&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
   -- read stuff&lt;br /&gt;
   value = readState:readInt()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteFile</id>
		<title>WriteFile</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteFile"/>
				<updated>2010-02-07T18:32:12Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}} The WriteFile class will create a binary file for writing.&lt;br /&gt;
&lt;br /&gt;
You create a file by calling the constructor WriteFile(location, mode). The location should be the file name (except for memory mode), and mode should be a string which is either &amp;quot;f&amp;quot; (file), &amp;quot;z&amp;quot; (compressed file) or &amp;quot;m&amp;quot; (write to memory).&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)&lt;br /&gt;
   local file = WriteFile(path .. filename, &amp;quot;f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
   file:writeInt(fileVersion)&lt;br /&gt;
   file:writeString(playerName)&lt;br /&gt;
   -- ... and so on ...&lt;br /&gt;
&lt;br /&gt;
   file:close()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/File_Objects</id>
		<title>File Objects</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/File_Objects"/>
				<updated>2010-02-07T18:29:39Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}}&lt;br /&gt;
&lt;br /&gt;
DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have creater control over the file structure, as Lua generally only works with strings and doubles in normal cases.&lt;br /&gt;
&lt;br /&gt;
If you only want to write text to the file, it is recommended that you use the standard IO Lua library instead: [http://lua-users.org/wiki/IoLibraryTutorial Lua IO Tutorial]&lt;br /&gt;
&lt;br /&gt;
== File Modes ==&lt;br /&gt;
&lt;br /&gt;
The file objects can handle three different modes of writing and reading. This is chosen by giving different settings when creating the file objects.&lt;br /&gt;
&lt;br /&gt;
=== File on Disk (f) ===&lt;br /&gt;
&lt;br /&gt;
This is the default behaviour. The data will be written or read from a binary file on disk.&lt;br /&gt;
&lt;br /&gt;
=== Compressed on Disk (z) ===&lt;br /&gt;
&lt;br /&gt;
When writing a compressed file, all data will first be written into memory and then compressed (as a zip) before being written to disk. When reading a compressed file, the whole file will be read into memory and then unpacked.&lt;br /&gt;
&lt;br /&gt;
=== In Memory (m) ===&lt;br /&gt;
&lt;br /&gt;
You can also use the file objects to serialize things in memory (without writing to disk).&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ReadFile</id>
		<title>ReadFile</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ReadFile"/>
				<updated>2010-02-07T18:22:58Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{File}}The ReadFile class will open a binary file for reading.  === Example === &amp;lt;pre&amp;gt;     local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)    local file = ReadFile(path .. filename)    ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}}The ReadFile class will open a binary file for reading.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)&lt;br /&gt;
   local file = ReadFile(path .. filename)&lt;br /&gt;
&lt;br /&gt;
   if not file:isOk() then&lt;br /&gt;
      print(&amp;quot;Unable to open &amp;quot; .. filename)&lt;br /&gt;
      return&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
   local fileVersion = file:readInt()&lt;br /&gt;
   playerName = file:readString()&lt;br /&gt;
   -- ... and so on ...&lt;br /&gt;
&lt;br /&gt;
   file:close()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteFile</id>
		<title>WriteFile</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteFile"/>
				<updated>2010-02-07T18:21:13Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}} The WriteFile class will create a binary file for writing.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)&lt;br /&gt;
   local file = WriteFile(path .. filename)&lt;br /&gt;
&lt;br /&gt;
   file:writeInt(fileVersion)&lt;br /&gt;
   file:writeString(playerName)&lt;br /&gt;
   -- ... and so on ...&lt;br /&gt;
&lt;br /&gt;
   file:close()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/WriteFile</id>
		<title>WriteFile</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/WriteFile"/>
				<updated>2010-02-07T18:20:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with 'The WriteFile class will create a binary file for writing.  === Example === &amp;lt;pre&amp;gt;     local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)    local file = WriteFile(path .. filename)     fil...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The WriteFile class will create a binary file for writing.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local path = daisy.getUserFolderPath(&amp;quot;&amp;quot;)&lt;br /&gt;
   local file = WriteFile(path .. filename)&lt;br /&gt;
&lt;br /&gt;
   file:writeInt(fileVersion)&lt;br /&gt;
   file:writeString(playerName)&lt;br /&gt;
   -- ... and so on ...&lt;br /&gt;
&lt;br /&gt;
   file:close()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/File_Objects</id>
		<title>File Objects</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/File_Objects"/>
				<updated>2010-02-07T18:18:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{File}}  DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have creater control over the file structure, as Lua generally only ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{File}}&lt;br /&gt;
&lt;br /&gt;
DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have creater control over the file structure, as Lua generally only works with strings and doubles in normal cases.&lt;br /&gt;
&lt;br /&gt;
If you only want to write text to the file, it is recommended that you use the standard IO Lua library instead: [http://lua-users.org/wiki/IoLibraryTutorial Lua IO Tutorial]&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Template:File</id>
		<title>Template:File</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Template:File"/>
				<updated>2010-02-07T18:15:59Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '&amp;lt;div style=&amp;quot;font-size: 90%;&amp;quot;&amp;gt; {| border=1 width=140 cellpadding=1 cellspacing=0 style=&amp;quot;float: right; margin: 0 0 1em 1em; border: 1px #aaaaaa solid; border-collapse: collapse;&amp;quot; |...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;font-size: 90%;&amp;quot;&amp;gt;&lt;br /&gt;
{| border=1 width=140 cellpadding=1 cellspacing=0 style=&amp;quot;float: right; margin: 0 0 1em 1em; border: 1px #aaaaaa solid; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!style=&amp;quot;background:#97c7d7&amp;quot;|DaisyMoon File Objects&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
*[[File Objects]]&lt;br /&gt;
*[[WriteFile]]&lt;br /&gt;
**[[close (File)|close]]&lt;br /&gt;
**[[writeBoolean]]&lt;br /&gt;
**[[writeByte]]&lt;br /&gt;
**[[writeFloat]]&lt;br /&gt;
**[[writeInt]]&lt;br /&gt;
**[[writeString]]&lt;br /&gt;
**[[writeWideString]]&lt;br /&gt;
*[[ReadFile]]&lt;br /&gt;
**[[close (File)|close]]&lt;br /&gt;
**[[isOk (File)|isOk]]&lt;br /&gt;
**[[readBoolean]]&lt;br /&gt;
**[[readByte]]&lt;br /&gt;
**[[readFloat]]&lt;br /&gt;
**[[readInt]]&lt;br /&gt;
**[[readString]]&lt;br /&gt;
**[[readWideString]]&lt;br /&gt;
**[[seek (File)|seek]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;[[Category:Daisymoon]]&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/DaisyMoon_Application</id>
		<title>DaisyMoon Application</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/DaisyMoon_Application"/>
				<updated>2010-02-07T13:38:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: /* v1.1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The DaisyMoon application is the program that contains the Daisy engine and executes the Lua scripts. The application has some global settings and shortcuts that can't be modified from the scripts.&lt;br /&gt;
&lt;br /&gt;
=== Application Shortcuts ===&lt;br /&gt;
&lt;br /&gt;
* '''Alt+F4''' (Ctrl+Q on MacOS X) quits the game. You can also quit the game from Lua by calling [[exitGame]].&lt;br /&gt;
* '''Ctrl+R''' resets the game and forces it to unload and reload all Lua scripts.&lt;br /&gt;
&lt;br /&gt;
=== Application Settings ===&lt;br /&gt;
&lt;br /&gt;
DaisyMoon reads settings from ''daisyMoon.cfg'' before running any Lua scripts. Modify this file if you want to setup things before Lua is started. Currently available settings are:&lt;br /&gt;
&lt;br /&gt;
* '''screenWidth''' and '''screenHeight''' the window's resolution.&lt;br /&gt;
* '''fullscreen''' set this to 1 if the game should start in fullscreen.&lt;br /&gt;
&lt;br /&gt;
The configuration file looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
settings {&lt;br /&gt;
	screenWidth = 1024;&lt;br /&gt;
	screenHeight = 768;&lt;br /&gt;
	fullscreen = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, this is not a Lua table.&lt;br /&gt;
&lt;br /&gt;
=== Application Versions ===&lt;br /&gt;
&lt;br /&gt;
==== v1.1.0 ====&lt;br /&gt;
&lt;br /&gt;
* Added [[disconnectClient]]&lt;br /&gt;
* Added [[getVersion]]&lt;br /&gt;
* Added [[setFocus]]&lt;br /&gt;
* Added [[clearPrint]]&lt;br /&gt;
* Changed physics entity numbering so that body id numbers can be reused&lt;br /&gt;
* Corrected collision detection for edge shapes&lt;br /&gt;
* Corrected [[setTextColor]] for buttons&lt;br /&gt;
* Added [[setForcePointSampling]]&lt;br /&gt;
&lt;br /&gt;
==== v1.0.2 ====&lt;br /&gt;
&lt;br /&gt;
* Corrected a network crash bug that would occur quite often (such as, &amp;quot;all the time&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
==== Various Beta Versions ====&lt;br /&gt;
&lt;br /&gt;
A number of beta versions was released with the early prototypes, such as House Globe and Because it's fun, Fay.&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/SetForcePointSampling</id>
		<title>SetForcePointSampling</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/SetForcePointSampling"/>
				<updated>2010-02-07T13:37:04Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{VideoMethod| video.setForcePointSampling(onOff) | Enables or disables forced point sampling of 2d sprites. If you enable this, all 2D sprites will be rendered using point sampl...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VideoMethod|&lt;br /&gt;
video.setForcePointSampling(onOff)&lt;br /&gt;
|&lt;br /&gt;
Enables or disables forced point sampling of 2d sprites. If you enable this, all 2D sprites will be rendered using point sampling regardless of render method. This may cause some pixel artifacts, but may be useful if you are making low-resolution artwork and scales it up.&lt;br /&gt;
&lt;br /&gt;
Available from DaisyMoon 1.1.0 and later.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|onOff|A boolean|Set this to true to enable enforced point sampling, and false to disable it.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   video.setForcePointSampling(true)&lt;br /&gt;
   video.renderSpriteState(player.sprite, player.x, player.y, player.scale, player.angle)&lt;br /&gt;
   video.setForcePointSampling(false)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Template:Video</id>
		<title>Template:Video</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Template:Video"/>
				<updated>2010-02-07T13:32:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;font-size: 90%;&amp;quot;&amp;gt;&lt;br /&gt;
{| border=1 width=140 cellpadding=1 cellspacing=0 style=&amp;quot;float: right; margin: 0 0 1em 1em; border: 1px #aaaaaa solid; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!style=&amp;quot;background:#c7c7e0&amp;quot;|Daisymoon Video Lib&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
*[[Video Library]]&lt;br /&gt;
**[[clearScissorClip]]&lt;br /&gt;
**[[createCgShader]]&lt;br /&gt;
**[[createSceneNode]]&lt;br /&gt;
**[[createLightSceneNode]]&lt;br /&gt;
**[[createSpriteState]]&lt;br /&gt;
**[[getCameraRay]]&lt;br /&gt;
**[[getScreenSize]]&lt;br /&gt;
**[[getSpriteStateHotspot]]&lt;br /&gt;
**[[getSpriteStateSize]]&lt;br /&gt;
**[[getTextSize]]&lt;br /&gt;
**[[getTextureSize]]&lt;br /&gt;
**[[render2dTexture]]&lt;br /&gt;
**[[render3dScene]]&lt;br /&gt;
**[[render3dTriangle]]&lt;br /&gt;
**[[render3dLine]]&lt;br /&gt;
**[[renderLine]]&lt;br /&gt;
**[[renderRectangle]]&lt;br /&gt;
**[[removeSpriteState]]&lt;br /&gt;
**[[renderSpriteState]]&lt;br /&gt;
**[[renderSpriteState3d]]&lt;br /&gt;
**[[renderSpriteStateFay]]&lt;br /&gt;
**[[renderSpriteStateFixed]]&lt;br /&gt;
**[[renderSpriteStateFreeShape]]&lt;br /&gt;
**[[renderText]]&lt;br /&gt;
**[[renderTriangleList]]&lt;br /&gt;
**[[renderTriangleListWithNormals]]&lt;br /&gt;
**[[resetSpriteState]]&lt;br /&gt;
**[[setCameraFOV]]&lt;br /&gt;
**[[setCameraPosition]]&lt;br /&gt;
**[[setCameraUpVector]]&lt;br /&gt;
**[[setCameraViewPosition]]&lt;br /&gt;
**[[setForcePointSampling]]&lt;br /&gt;
**[[setMaterial]]&lt;br /&gt;
**[[setRenderScreenSize]]&lt;br /&gt;
**[[setSceneNodePosition]]&lt;br /&gt;
**[[setSceneNodeRotation]]&lt;br /&gt;
**[[setSceneNodeScale]]&lt;br /&gt;
**[[setScissorClip]]&lt;br /&gt;
**[[setScreenSize]]&lt;br /&gt;
**[[updateSpriteState]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;[[Category:Daisymoon]]&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Harvest_Library</id>
		<title>Harvest Library</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Harvest_Library"/>
				<updated>2010-02-07T13:10:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{Harvest}}  The Harvest library is the set of methods that are available for Harvest mods. All methods begin with &amp;quot;harvest.&amp;quot;.  Harvest was the first of Oxeye Game Studio's games...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Harvest}}&lt;br /&gt;
&lt;br /&gt;
The Harvest library is the set of methods that are available for Harvest mods. All methods begin with &amp;quot;harvest.&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Harvest was the first of Oxeye Game Studio's games that used Lua for modding, so the library is somewhat limited compared to, for example, [[:Category:Daisymoon|DaisyMoon]].&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Physics_Object</id>
		<title>Physics Object</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Physics_Object"/>
				<updated>2010-02-07T13:03:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Physics}}&lt;br /&gt;
The physics object in DaisyMoon is a wrapper around a Box2D instance. The wrapper controls Box2D entities (bodies with shapes and their collision data) and the Box2D physics world. Communication between DaisyMoon and the entities is done by handling body identifiers, which are simple integers.&lt;br /&gt;
&lt;br /&gt;
For detailed documentation on how the physics work, please refer to the [http://www.box2d.org/documentation.html Box2D documentation].&lt;br /&gt;
&lt;br /&gt;
== Concepts ==&lt;br /&gt;
&lt;br /&gt;
=== World Resolution ===&lt;br /&gt;
&lt;br /&gt;
The Box2D works with meters instead of pixels. In most cases this means that you need to convert coordinates when sending to or recieving from the physics object. From our experience, 32 pixels per meter is a good resolution to use.&lt;br /&gt;
&lt;br /&gt;
 local physResolution = 1 / 32&lt;br /&gt;
 local nbrOfIterations = 10&lt;br /&gt;
&lt;br /&gt;
== Working with the Physics Object ==&lt;br /&gt;
&lt;br /&gt;
=== Creating ===&lt;br /&gt;
&lt;br /&gt;
 physics = Physics(0, 0, width * physResolution, height * physResolution, gravityX, gravityY)&lt;br /&gt;
&lt;br /&gt;
=== Updating ===&lt;br /&gt;
&lt;br /&gt;
 physics:update(timeStep, nbrOfIterations)&lt;br /&gt;
&lt;br /&gt;
=== Using Entities ===&lt;br /&gt;
&lt;br /&gt;
=== Using Joints ===&lt;br /&gt;
&lt;br /&gt;
== External Resources ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.box2d.org Box2D website]&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Physics_Object</id>
		<title>Physics Object</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Physics_Object"/>
				<updated>2010-02-07T13:02:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The physics object in DaisyMoon is a wrapper around a Box2D instance. The wrapper controls Box2D entities (bodies with shapes and their collision data) and the Box2D physics world. Communication between DaisyMoon and the entities is done by handling body identifiers, which are simple integers.&lt;br /&gt;
&lt;br /&gt;
For detailed documentation on how the physics work, please refer to the [http://www.box2d.org/documentation.html Box2D documentation].&lt;br /&gt;
&lt;br /&gt;
== Concepts ==&lt;br /&gt;
&lt;br /&gt;
=== World Resolution ===&lt;br /&gt;
&lt;br /&gt;
The Box2D works with meters instead of pixels. In most cases this means that you need to convert coordinates when sending to or recieving from the physics object. From our experience, 32 pixels per meter is a good resolution to use.&lt;br /&gt;
&lt;br /&gt;
 local physResolution = 1 / 32&lt;br /&gt;
 local nbrOfIterations = 10&lt;br /&gt;
&lt;br /&gt;
== Working with the Physics Object ==&lt;br /&gt;
&lt;br /&gt;
=== Creating ===&lt;br /&gt;
&lt;br /&gt;
 physics = Physics(0, 0, width * physResolution, height * physResolution, gravityX, gravityY)&lt;br /&gt;
&lt;br /&gt;
=== Updating ===&lt;br /&gt;
&lt;br /&gt;
 physics:update(timeStep, nbrOfIterations)&lt;br /&gt;
&lt;br /&gt;
=== Using Entities ===&lt;br /&gt;
&lt;br /&gt;
=== Using Joints ===&lt;br /&gt;
&lt;br /&gt;
== External Resources ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.box2d.org Box2D website]&lt;br /&gt;
&lt;br /&gt;
{{Physics}}&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/DeleteEntity</id>
		<title>DeleteEntity</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/DeleteEntity"/>
				<updated>2010-02-07T13:01:36Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:deleteEntity(entityId) | Removes all shapes, collisions, joints and the body identified with the entityId. Since the number of entity identifiers is limi...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:deleteEntity(entityId)&lt;br /&gt;
|&lt;br /&gt;
Removes all shapes, collisions, joints and the body identified with the entityId. Since the number of entity identifiers is limited to 2^15 (because of the filterGroup shape setting), entity identifiers will be re-used when entities are removed.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|entityId|An integer|The body id number of the entity that should be removed.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   physics:deleteEntity(player.body)&lt;br /&gt;
   player.body = nil&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/GetEntitySensorPoints</id>
		<title>GetEntitySensorPoints</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/GetEntitySensorPoints"/>
				<updated>2010-02-07T12:59:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:getEntitySensorPoints(entityId) | Fetches a list of current sensor intersection points for a given entity. This list will not include real collisions, th...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:getEntitySensorPoints(entityId)&lt;br /&gt;
|&lt;br /&gt;
Fetches a list of current sensor intersection points for a given entity. This list will not include real collisions, they are stored in a separate list and are fetched with [[getEntityCollisions]].&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|enitityId|An integer|The entity's body identifier.}}&lt;br /&gt;
|&lt;br /&gt;
Returns a table containing collision elements (see below). If no intersections are found, this method returns nil to save some garbage collection performance. In other words, the returned table is never empty, it's either nil or non-empty.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Collision Info ===&lt;br /&gt;
&lt;br /&gt;
The returned table contains a list of intersection points. Each point has the following info:&lt;br /&gt;
&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Type'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{MethodParam|x|A number|The world X position of the collision point, measured in meters.}}&lt;br /&gt;
{{MethodParam|y|A number|The world Y position of the collision point, measured in meters.}}&lt;br /&gt;
{{MethodParam|nx|A number|The collision point normal's normalized X value. This value has no meaning for intersections.}}&lt;br /&gt;
{{MethodParam|ny|A number|The collision point normal's normalized Y value. This value has no meaning for intersections.}}&lt;br /&gt;
{{MethodParam|impulse|A number|The collision impulse. This value has no meaning for intersections.}}&lt;br /&gt;
{{MethodParam|id|An integer|The entity identifier of the body that this entity has collided with.}}&lt;br /&gt;
{{MethodParam|userData|A string|If the other entity has userData in the shape that this entity has collided with, that userData will be copied to this value. This is usually nil. See [[Common Shape Settings]].}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local collisions = physics:getEntitySensorPoints(player.body)&lt;br /&gt;
   if collisions then&lt;br /&gt;
      for index, info in ipairs(collisions) do&lt;br /&gt;
          local userData = info.userData or &amp;quot;n/a&amp;quot;&lt;br /&gt;
          print(&amp;quot;Intersection with &amp;quot;.. info.id .. &amp;quot; at (&amp;quot; .. info.x .. &amp;quot;, &amp;quot; .. info.y .. &amp;quot;), &amp;quot; .. userData)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/GetEntityCollisions</id>
		<title>GetEntityCollisions</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/GetEntityCollisions"/>
				<updated>2010-02-07T12:56:29Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:getEntityCollisions(entityId) | Fetches a list of current collision points for a given entity. This list will not include sensor points, they are stored ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:getEntityCollisions(entityId)&lt;br /&gt;
|&lt;br /&gt;
Fetches a list of current collision points for a given entity. This list will not include sensor points, they are stored in a separate list and are fetched with [[getEntitySensorPoints]].&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|enitityId|An integer|The entity's body identifier.}}&lt;br /&gt;
|&lt;br /&gt;
Returns a table containing collision elements (see below). If no collisions are found, this method returns nil to save some garbage collection performance. In other words, the returned table is never empty, it's either nil or non-empty.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Collision Info ===&lt;br /&gt;
&lt;br /&gt;
The returned table contains a list of collision points. Each point has the following info:&lt;br /&gt;
&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Type'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{MethodParam|x|A number|The world X position of the collision point, measured in meters.}}&lt;br /&gt;
{{MethodParam|y|A number|The world Y position of the collision point, measured in meters.}}&lt;br /&gt;
{{MethodParam|nx|A number|The collision point normal's normalized X value. Points towards the entity.}}&lt;br /&gt;
{{MethodParam|ny|A number|The collision point normal's normalized Y value. Points towards the entity.}}&lt;br /&gt;
{{MethodParam|impulse|A number|The collision impulse.}}&lt;br /&gt;
{{MethodParam|id|An integer|The entity identifier of the body that this entity has collided with.}}&lt;br /&gt;
{{MethodParam|userData|A string|If the other entity has userData in the shape that this entity has collided with, that userData will be copied to this value. This is usually nil. See [[Common Shape Settings]].}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local collisions = physics:getEntityCollisions(player.body)&lt;br /&gt;
   if collisions then&lt;br /&gt;
      for index, info in ipairs(collisions) do&lt;br /&gt;
          local userData = info.userData or &amp;quot;n/a&amp;quot;&lt;br /&gt;
          print(&amp;quot;Collision with &amp;quot;.. info.id .. &amp;quot; at (&amp;quot; .. info.x .. &amp;quot;, &amp;quot; .. info.y .. &amp;quot;), (&amp;quot; ..&lt;br /&gt;
             info.nx .. &amp;quot;, &amp;quot; .. info.ny .. &amp;quot;), &amp;quot; .. info.impulse .. &amp;quot;, &amp;quot; userData)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ApplyEntityForce</id>
		<title>ApplyEntityForce</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ApplyEntityForce"/>
				<updated>2010-02-07T12:43:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:applyEntityForce(entityId, positionX, positionY, forceX, forceY) | Applies a force at a given world position on a given entity. | {{MethodParam|enitityId...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:applyEntityForce(entityId, positionX, positionY, forceX, forceY)&lt;br /&gt;
|&lt;br /&gt;
Applies a force at a given world position on a given entity.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|enitityId|An integer|The entity's body identifier.}}&lt;br /&gt;
{{MethodParam|positionX|A number|World X position where the force should be applied, measured in meters.}}&lt;br /&gt;
{{MethodParam|positionY|A number|World Y position where the force should be applied, measured in meters.}}&lt;br /&gt;
{{MethodParam|forceX|A number|Amount of horizontal force to be applied, measured in Newton.}}&lt;br /&gt;
{{MethodParam|forceY|A number|Amount of vertical force to be applied, measured in Newton.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   physics:applyEntityForce(player.body, fan.x * physResolution, fan.y * physResolution, fan.force.x, fan.force.y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/GetEntityXForm</id>
		<title>GetEntityXForm</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/GetEntityXForm"/>
				<updated>2010-02-07T12:38:38Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:getEntityXForm(entityId) | Fetches the 2D matrix that defines the entity's current position and rotation in world space. | {{MethodParam|enitityId|An int...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:getEntityXForm(entityId)&lt;br /&gt;
|&lt;br /&gt;
Fetches the 2D matrix that defines the entity's current position and rotation in world space.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|enitityId|An integer|The entity's body identifier.}}&lt;br /&gt;
|&lt;br /&gt;
Returns six values. First the centerX and centerY, which is the entity's current center position in world space (measured in meters). Then four values that build up the rotation matrix: x1, y1, x2, y2.&lt;br /&gt;
&lt;br /&gt;
You can use these six values to determine any point on the shape. For example, say that you have x and y, which are points relative to the entity's centrum position. To calculate where x and y are right now, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local formX, formY, formCX1, formCY1, formCX2, formCY2 = physics:getEntityXForm(player.body)&lt;br /&gt;
local newX = formCX1 * x + formCX2 * y&lt;br /&gt;
local newY = formCY1 * x + formCY2 * y&lt;br /&gt;
&lt;br /&gt;
x, y = newX + formX, newY + formY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local formX, formY, formCX1, formCY1, formCX2, formCY2 = physics:getEntityXForm(player.body)&lt;br /&gt;
   local newX = formCX1 * x + formCX2 * y&lt;br /&gt;
   local newY = formCY1 * x + formCY2 * y&lt;br /&gt;
&lt;br /&gt;
   x, y = newX + formX, newY + formY&lt;br /&gt;
   video.renderSpriteState(player.sprite, x / physResolution, y / physResolution)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Update_(Physics)</id>
		<title>Update (Physics)</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Update_(Physics)"/>
				<updated>2010-02-07T12:31:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:update(timeStep, iterations) | Updates the physics world and all activated entities. | {{MethodParam|timeStep|A number|The time since the last update, me...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:update(timeStep, iterations)&lt;br /&gt;
|&lt;br /&gt;
Updates the physics world and all activated entities.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|timeStep|A number|The time since the last update, measured in seconds.}}&lt;br /&gt;
{{MethodParam|iterations|An integer|The number of iterations Box2D should take to find the most accurate physics simulations. 10 is a common value.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   physics:update(time, 10)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/SetEntityAngle</id>
		<title>SetEntityAngle</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/SetEntityAngle"/>
				<updated>2010-02-07T12:29:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:setEntityAngle(entityId, angle) | Forces the entity's body angle to be set to a certain value. Works even if the body's definition has set fixedRotation....'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:setEntityAngle(entityId, angle)&lt;br /&gt;
|&lt;br /&gt;
Forces the entity's body angle to be set to a certain value. Works even if the body's definition has set fixedRotation.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|entityId|An integer|The body id number of the entity.}}&lt;br /&gt;
{{MethodParam|angle|A number|The new body angle, in radians.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local o = createObstacle(-4, 2.5, 2, 3, .3)&lt;br /&gt;
   myPhysics:setEntityAngle(o.body, math.pi * .3)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/AddBoxShape</id>
		<title>AddBoxShape</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/AddBoxShape"/>
				<updated>2010-02-07T12:27:03Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:addBoxShape(entityId, shapeDefinition) | Adds a box shape to an entity's body. | {{MethodParam|entityId|An integer|The entity's body identifier, which is...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:addBoxShape(entityId, shapeDefinition)&lt;br /&gt;
|&lt;br /&gt;
Adds a box shape to an entity's body.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|entityId|An integer|The entity's body identifier, which is returned from the [[createEntity]] method.}}&lt;br /&gt;
{{MethodParam|bodyDefinition|A table|The body definition table, see below.}}&lt;br /&gt;
|&lt;br /&gt;
Returns true if the shape was added successfully.&lt;br /&gt;
}}&lt;br /&gt;
=== Shape Definition Table ===&lt;br /&gt;
&lt;br /&gt;
The shape definition table holds shape settings. In addition to the box settings, all shapes have the [[Common Shape Settings]] too.&lt;br /&gt;
&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Expected Type'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{MethodParam|x|A number|The centrum X coordinate of the box, in relation to the body's X coordinate. Measured in meters. Defaults to 0 (centered on the body).}}&lt;br /&gt;
{{MethodParam|y|A number|The centrum Y coordinate of the box, in relation to the body's Y coordinate. Measured in meters. Defaults to 0 (centered on the body).}}&lt;br /&gt;
{{MethodParam|width|A number|The width of the box, measured in meters. Defaults to 1.}}&lt;br /&gt;
{{MethodParam|height|A number|The height of the box, measured in meters. Defaults to 1.}}&lt;br /&gt;
{{MethodParam|angle|A number|The rotation of the box, measured in radians. Note that this is the fixed rotaion of the shape. It can't be changed later, since [[setEntityAngle]] rotates the whole body and not individual shapes. Defaults to 0.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local playerShapeDef = {&lt;br /&gt;
      x = 0,&lt;br /&gt;
      x = 0,&lt;br /&gt;
      width = 32 * physResolution,&lt;br /&gt;
      height = 64 * physResolution,&lt;br /&gt;
      density = 1.5,&lt;br /&gt;
      filterGroup = player.body,&lt;br /&gt;
      friction = .01,&lt;br /&gt;
   }&lt;br /&gt;
   physics:addBoxShape(player.body, playerShapeDef)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Common_Shape_Settings</id>
		<title>Common Shape Settings</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Common_Shape_Settings"/>
				<updated>2010-02-07T12:25:03Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with 'These settings can be set for all entity shapes.  {| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot; |- |style=&amp;quot;background:#c797d7&amp;quot;| ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These settings can be set for all entity shapes.&lt;br /&gt;
&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Expected Type'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{MethodParam|density|A number|The shape's density, measured in kilograms per cubic decimeter (about 1 for water). Defaults to 0. Note that this value must be greater than 0 if you are going to activate the entity with [[activateEntity]].}}&lt;br /&gt;
{{MethodParam|friction|A number|The shape's friction. Defaults to 0.}}&lt;br /&gt;
{{MethodParam|restitution|A number|The shape's restitution (how &amp;quot;bouncy&amp;quot; it is). Defaults to 0 (no bounce).}}&lt;br /&gt;
{{MethodParam|isSensor|A boolean|Set this to true if the shape only should register intersections, but not collide. See [[getEntitySensorPoints]].}}&lt;br /&gt;
{{MethodParam|filterCategory|An integer|This is a bitfield of collision categories this shape belongs to. Defaults to 0 (collides with everything).}}&lt;br /&gt;
{{MethodParam|filterMask|An integer|This is a bitfield of collision categories this shape should collide with. Defaults to 0 (collides with everything).}}&lt;br /&gt;
{{MethodParam|filterGroup|An integer|This is a single value that defines a specific filter group, defaults to 0 (disabled). The filter group can be used in two ways. Set it to a positive number and it will collide with all objects of the same (positive) filter group, regardless of filterMask. Set it to negative, and it will ''never'' collide with the collision group (negative or positive), regardless of filterMask.&lt;br /&gt;
&lt;br /&gt;
For example, if an entity is going to shoot a bullet, you can use this to make sure that the bullet never collides with the shooter. Set the shooter's filterGroup to the shooter's body identifier (for example, 100), and then set the bullet's filterGroup to minus the shooter's body identifier (e.g. -100).&lt;br /&gt;
&lt;br /&gt;
A good practise is to always set the filterGroup to the entity's body identifier.}}&lt;br /&gt;
{{MethodParam|userData|A string|Set this to a string if you need to identify individual shapes when a body collides. This string will be available in [[getEntityCollisions]] and [[getEntitySensorPoints]].}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
&lt;br /&gt;
* [[addBoxShape]]&lt;br /&gt;
* [[addCircleShape]]&lt;br /&gt;
* [[addEdgeShape]]&lt;br /&gt;
* [[addPolygonShape]]&lt;br /&gt;
&lt;br /&gt;
{{Physics}}&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/CreateEntity</id>
		<title>CreateEntity</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/CreateEntity"/>
				<updated>2010-02-07T12:05:59Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:createEntity(bodyDefinition, x, y) | Creates and adds a new physics body to the physics object. | {{MethodParam|bodyDefinition|A table|The body definitio...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:createEntity(bodyDefinition, x, y)&lt;br /&gt;
|&lt;br /&gt;
Creates and adds a new physics body to the physics object.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|bodyDefinition|A table|The body definition table, see below.}}&lt;br /&gt;
{{MethodParam|x|A number|The entity's center X coordinate in world space, counted in meters.}}&lt;br /&gt;
{{MethodParam|y|A number|The entity's center Y coordinate in world space, counted in meters.}}&lt;br /&gt;
|&lt;br /&gt;
Returns the body identifier number (an integer). If something went horribly wrong (like, incorrect number of parameters), this method returns -1.&lt;br /&gt;
}}&lt;br /&gt;
=== Body Definition Table ===&lt;br /&gt;
&lt;br /&gt;
The body definition table holds entity settings.&lt;br /&gt;
&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Expected Type'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{MethodParam|linearDamping|A number|How much the entity's linear velocity should be dampened. You can use this to simulate air friction. Defaults to 0.}}&lt;br /&gt;
{{MethodParam|angularDamping|A number|How much the entity's angular speed should be dampened. You can use this to simulate friction. Defaults to 0.}}&lt;br /&gt;
{{MethodParam|fixedRotation|A boolean|Set this to true if the entity isn't allowed to rotate at all. Defaults to false.}}&lt;br /&gt;
{{MethodParam|isBullet|A boolean|Enables Box2D's special &amp;quot;bullet&amp;quot; physics. Defaults to false.}}&lt;br /&gt;
{{MethodParam|allowSleep|A boolean|Set this to false if the entity is never allowed to enter sleeping state. This occurs if the entity is non-moving for a certain amount of time. Defaults to true.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   local playerBodyDef = {&lt;br /&gt;
      linearDamping = 10,&lt;br /&gt;
      angularDamping = 1.5,&lt;br /&gt;
      fixedRotation = false,&lt;br /&gt;
      isBullet = false,&lt;br /&gt;
      allowSleep = false,&lt;br /&gt;
   }&lt;br /&gt;
   player.body = physics:createEntity(playerBodyDef, player.x * physResolution, player.y * physResolution)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/ActivateEntity</id>
		<title>ActivateEntity</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/ActivateEntity"/>
				<updated>2010-02-07T11:54:27Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{PhysicsMethod| physics:activateEntity(entityId) | Calculates and sets the mass for an entity. Entities that have mass are treated as &amp;quot;active&amp;quot; objects by Box2d, and will be upda...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PhysicsMethod|&lt;br /&gt;
physics:activateEntity(entityId)&lt;br /&gt;
|&lt;br /&gt;
Calculates and sets the mass for an entity. Entities that have mass are treated as &amp;quot;active&amp;quot; objects by Box2d, and will be updated during the physics' update phase. Note that if the entity's shapes doesn't have any density, the entity will not get any mass value and wont be activated. You can make an entity static again by calling [[deactivateEntity]] (note that this means it sets the entity's body mass to 0 again).&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|entityId|An integer|The body id number of the entity that should be activated.}}&lt;br /&gt;
|&lt;br /&gt;
Returns nothing.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   physics:activateEntity(player.body)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Template:PhysicsMethod</id>
		<title>Template:PhysicsMethod</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Template:PhysicsMethod"/>
				<updated>2010-02-07T11:50:20Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot; |- |style=&amp;quot;background:#c797d7; font-size:150%;&amp;quot; colspan=&amp;quot;3&amp;quot;|'''{{{1}}}''' |- |cols...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7; font-size:150%;&amp;quot; colspan=&amp;quot;3&amp;quot;|'''{{{1}}}'''&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;3&amp;quot;| {{{2}}}&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Parameter'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Expected Type'''&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot;| '''Description'''&lt;br /&gt;
|-&lt;br /&gt;
{{{3}}}&lt;br /&gt;
|style=&amp;quot;background:#c797d7&amp;quot; colspan=&amp;quot;3&amp;quot;| '''Returns'''&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;3&amp;quot;| {{{4}}}&lt;br /&gt;
|} {{Physics}}&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{PhysicsMethod |&lt;br /&gt;
network.exampleMethod(x, y)&lt;br /&gt;
|&lt;br /&gt;
This is an example usage of the PhysicsMethod template. Methods of the physics object should contain this template, with the&lt;br /&gt;
paramters for method name, description, parameter list and return values, and then an example of how the&lt;br /&gt;
method is used.&lt;br /&gt;
|&lt;br /&gt;
{{MethodParam|x|A number|This is a parameter using the MethodParam template.}}&lt;br /&gt;
{{MethodParam|y|A number|Here's a second parameter. If a method has 0 parameters, you can use the NoParams template instead.}}&lt;br /&gt;
|&lt;br /&gt;
The fourth parameter is a description of the method's return value or values, if any.}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Template:Physics</id>
		<title>Template:Physics</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Template:Physics"/>
				<updated>2010-02-07T11:48:08Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '&amp;lt;div style=&amp;quot;font-size: 90%;&amp;quot;&amp;gt; {| border=1 width=140 cellpadding=1 cellspacing=0 style=&amp;quot;float: right; margin: 0 0 1em 1em; border: 1px #aaaaaa solid; border-collapse: collapse;&amp;quot; |...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;font-size: 90%;&amp;quot;&amp;gt;&lt;br /&gt;
{| border=1 width=140 cellpadding=1 cellspacing=0 style=&amp;quot;float: right; margin: 0 0 1em 1em; border: 1px #aaaaaa solid; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!style=&amp;quot;background:#c797d7&amp;quot;|Daisymoon Physics Lib&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
*[[Physics Object]]&lt;br /&gt;
**[[activateEntity]]&lt;br /&gt;
**[[addBoxShape]]&lt;br /&gt;
**[[addCircleShape]]&lt;br /&gt;
**[[addEdgeShape]]&lt;br /&gt;
**[[addPolygonShape]]&lt;br /&gt;
**[[applyEntityForce]]&lt;br /&gt;
**[[applyEntityImpulse]]&lt;br /&gt;
**[[createDistanceJoint]]&lt;br /&gt;
**[[createEntity]]&lt;br /&gt;
**[[createPrismaticJoint]]&lt;br /&gt;
**[[createRevoluteJoint]]&lt;br /&gt;
**[[deactivateEntity]]&lt;br /&gt;
**[[deleteEntity]]&lt;br /&gt;
**[[getCurrentJointMotorSpeed]]&lt;br /&gt;
**[[getEntityAngle]]&lt;br /&gt;
**[[getEntityAngleSpeed]]&lt;br /&gt;
**[[getEntityCollisions]]&lt;br /&gt;
**[[getEntityFatigue]]&lt;br /&gt;
**[[getEntityMass]]&lt;br /&gt;
**[[getEntityPosition]]&lt;br /&gt;
**[[getEntitySensorPoints]]&lt;br /&gt;
**[[getEntityShapes]]&lt;br /&gt;
**[[getEntitySpeed]]&lt;br /&gt;
**[[getEntityXForm]]&lt;br /&gt;
**[[getJointData]]&lt;br /&gt;
**[[isEntityActive]]&lt;br /&gt;
**[[isEntitySleeping]]&lt;br /&gt;
**[[putEntityToSleep]]&lt;br /&gt;
**[[raycastDirection]]&lt;br /&gt;
**[[raycastPoints]]&lt;br /&gt;
**[[setEntityAngle]]&lt;br /&gt;
**[[setEntityAngleSpeed]]&lt;br /&gt;
**[[setEntityGravityEnable]]&lt;br /&gt;
**[[setEntityPosition]]&lt;br /&gt;
**[[setEntitySpeed]]&lt;br /&gt;
**[[setGravity]]&lt;br /&gt;
**[[setJointLimitEnabled]]&lt;br /&gt;
**[[setJointMotorEnabled]]&lt;br /&gt;
**[[setJointMotorForce]]&lt;br /&gt;
**[[setJointMotorSpeed]]&lt;br /&gt;
**[[update (Physics)|update]]&lt;br /&gt;
**[[wakeUpEntity]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;[[Category:Daisymoon]]&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Drag_the_Wall</id>
		<title>Drag the Wall</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Drag_the_Wall"/>
				<updated>2010-02-07T11:38:20Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '== Description ==  In Drag the Wall your objective is to pull the white wall piece with your mouse so that it touches all of the small white boxes. In the small room there are fo...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
In Drag the Wall your objective is to pull the white wall piece with your mouse so that it touches all of the small white boxes. In the small room there are four defense towers that charge up a blast that will kill you, so you need to find safe spots not to get caught.&lt;br /&gt;
&lt;br /&gt;
http://www.oxeyegames.com/files/dm_examples/dragthewall/dragthewall.jpg&lt;br /&gt;
&lt;br /&gt;
This example was rewritten for DaisyMoon 1.1.0. Download all files here: [http://www.oxeyegames.com/files/dm_examples/dragthewall/dragthewall.zip dragthewall.zip]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;'''Disclaimer:'''&amp;lt;/font&amp;gt; DaisyMoon is pretty bad at doing 3D since it's mainly a 2D engine. Doing 3D stuff is dodgy, to say the least.&lt;br /&gt;
&lt;br /&gt;
== Assets ==&lt;br /&gt;
&lt;br /&gt;
=== Files ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/main.lua main.lua]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/vectorMath.lua vectorMath.lua]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/itt.dat itt.dat]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/speckle.jpg speckle.jpg]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/120poly.obj 120poly.obj]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/font.fnt font.fnt]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/warning1.wav warning1.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/warning2.wav warning2.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/warning3.wav warning3.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/warning4.wav warning4.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/collide1.wav collide1.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/collide2.wav collide2.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/collide3.wav collide3.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/death.wav death.wav]&lt;br /&gt;
* [http://www.oxeyegames.com/files/dm_examples/dragthewall/explosion1.wav explosion1.wav]&lt;br /&gt;
&lt;br /&gt;
=== main.lua ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
math.randomseed( os.time() )&lt;br /&gt;
&lt;br /&gt;
dofile(&amp;quot;vectorMath.lua&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- copy from global namespace&lt;br /&gt;
local vectorMath, video, math = _vectorMath, video, math&lt;br /&gt;
local d45 = math.cos(math.pi * .25)&lt;br /&gt;
&lt;br /&gt;
local circleSprite, blockSprite, tankNode, light, myPhysics&lt;br /&gt;
&lt;br /&gt;
local cameraPosition = { x = 0, y = 0, z = -9.5 }&lt;br /&gt;
local cameraTarget = { x = 0, y = 0, z = 0 }&lt;br /&gt;
&lt;br /&gt;
local testMaterial = {&lt;br /&gt;
	texture = &amp;quot;daisyMoon/speckle.jpg&amp;quot;,&lt;br /&gt;
	lighting = true,&lt;br /&gt;
	zbuffer = true,&lt;br /&gt;
	zwrite = true,&lt;br /&gt;
	clockwiseCull = false,&lt;br /&gt;
	materialType = 0,&lt;br /&gt;
}&lt;br /&gt;
local transparentMaterial = {&lt;br /&gt;
	texture = &amp;quot;daisyMoon/speckle.jpg&amp;quot;,&lt;br /&gt;
	lighting = true,&lt;br /&gt;
	zbuffer = true,&lt;br /&gt;
	zwrite = false,&lt;br /&gt;
	clockwiseCull = false,&lt;br /&gt;
	materialType = 11,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local chain = {}&lt;br /&gt;
local obstacles = {}&lt;br /&gt;
local items = {}&lt;br /&gt;
local transparent = {}&lt;br /&gt;
local gameData = {&lt;br /&gt;
	selectedLink = nil,&lt;br /&gt;
	lastSelectedLink = nil,&lt;br /&gt;
	gameOver = 0,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function positionOnZedPlane(x, y)&lt;br /&gt;
&lt;br /&gt;
	local sx, sy, sz, ex, ey, ez = video.getCameraRay(x, y)&lt;br /&gt;
&lt;br /&gt;
	-- calculate collision with Z plane&lt;br /&gt;
	local x = sx - ((ex - sx) * sz) / (ez - sz)&lt;br /&gt;
	local y = sy - ((ey - sy) * sz) / (ez - sz)&lt;br /&gt;
&lt;br /&gt;
	return x, y&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function createBevel(width, height, depth)&lt;br /&gt;
&lt;br /&gt;
	-- front&lt;br /&gt;
	local fx1, fx2, fy1, fy2, fz = -width + depth, width - depth, -height + depth, height - depth, -depth&lt;br /&gt;
&lt;br /&gt;
	local bevel = {&lt;br /&gt;
&lt;br /&gt;
				-- front							-- left								-- right					-- bottom					-- top&lt;br /&gt;
		x = {	fx1, fx1, fx2, fx2,					-width, -width, fx1, fx1,			fx2, fx2, width, width,		-width, fx1, fx2, width,	fx1, -width, width, fx2 },&lt;br /&gt;
		y = {	fy1, fy2, fy2, fy1,					-height, height, fy2, fy1,			fy1, fy2, height, -height,	-height, fy1, fy1, -height,	fy2, height, height, fy2 },&lt;br /&gt;
		z = {	fz, fz, fz, fz,						0, 0, fz, fz,						fz, fz, 0, 0,				0, fz, fz, 0,				fz, 0, 0, fz },&lt;br /&gt;
&lt;br /&gt;
		nx = {	0, 0, 0, 0,							-d45, -d45, -d45, -d45,				d45, d45, d45, d45,			0, 0, 0, 0,					0, 0, 0, 0 },&lt;br /&gt;
		ny = {	0, 0, 0, 0,							0, 0, 0, 0,							0, 0, 0, 0,					d45, d45, d45, d45,			-d45, -d45, -d45, -d45 },&lt;br /&gt;
		nz = {	-1, -1, -1, -1,						-d45, -d45, -d45, -d45,				-d45, -d45, -d45, -d45,		-d45, -d45, -d45, -d45,		-d45, -d45, -d45, -d45 },&lt;br /&gt;
&lt;br /&gt;
		u = {0, 0, 1, 1,							0, 0, 1, 1,							0, 0, 1, 1,					0, 0, 1, 1,					0, 0, 1, 1 },&lt;br /&gt;
		v = {0, 1, 1, 0,							0, 1, 1, 0, 						0, 1, 1, 0,					0, 1, 1, 0,					0, 1, 1, 0 },&lt;br /&gt;
&lt;br /&gt;
		i = { 0, 1, 2, 0, 2, 3,						4, 5, 6, 4, 6, 7,					8, 9, 10, 8, 10, 11,		12, 13, 14, 12, 14, 15,		16, 17, 18, 16, 18, 19 },&lt;br /&gt;
		tris = 10,&lt;br /&gt;
		verts = 20,&lt;br /&gt;
&lt;br /&gt;
		physX = { -width, -width, width, width },&lt;br /&gt;
		physY = { height, -height, -height, height },&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return bevel&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function transformBevel(bevel, formX, formY, formCX1, formCY1, formCX2, formCY2)&lt;br /&gt;
&lt;br /&gt;
	local copy = {&lt;br /&gt;
		-- copy references to tables that aren't modified&lt;br /&gt;
		z = bevel.z,&lt;br /&gt;
		nz = bevel.nz,&lt;br /&gt;
		u = bevel.u,&lt;br /&gt;
		v = bevel.v,&lt;br /&gt;
		i = bevel.i,&lt;br /&gt;
		tris = bevel.tris,&lt;br /&gt;
		verts = bevel.verts&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	-- transform x and y&lt;br /&gt;
	copy.x, copy.y = {}, {}&lt;br /&gt;
	copy.nx, copy.ny = {}, {}&lt;br /&gt;
	for i=1,bevel.verts do&lt;br /&gt;
		copy.x[i], copy.y[i] = vectorMath.xFormMultiply(formX, formY, formCX1, formCY1, formCX2, formCY2, bevel.x[i], bevel.y[i])&lt;br /&gt;
		copy.nx[i], copy.ny[i] = vectorMath.xFormMultiply(0, 0, -formCX1, -formCY1, -formCX2, -formCY2, -bevel.nx[i], bevel.ny[i])&lt;br /&gt;
	end&lt;br /&gt;
	--copy.nx, copy.ny = bevel.nx, bevel.ny&lt;br /&gt;
&lt;br /&gt;
	return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function createTransparent(x, y, w, h, d)&lt;br /&gt;
&lt;br /&gt;
	local o = {}&lt;br /&gt;
	o.bevel = createBevel(w * .5, h * .5, d)&lt;br /&gt;
	o.body = myPhysics:createEntity({}, x, y)&lt;br /&gt;
	myPhysics:addBoxShape(o.body, { x = 0, y = 0, width = w, height = h, density = 10, isSensor = true })&lt;br /&gt;
	myPhysics:activateEntity(o.body)&lt;br /&gt;
&lt;br /&gt;
	table.insert(transparent, o)&lt;br /&gt;
&lt;br /&gt;
	return o&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local chargeCounter = 1&lt;br /&gt;
local function createObstacle(x, y, w, h, d, isCharger)&lt;br /&gt;
&lt;br /&gt;
	local o = {}&lt;br /&gt;
	o.bevel = createBevel(w * .5, h * .5, d)&lt;br /&gt;
	o.body = myPhysics:createEntity({}, x, y)&lt;br /&gt;
	myPhysics:addBoxShape(o.body, { x = 0, y = 0, width = w, height = h, density = 10 })&lt;br /&gt;
&lt;br /&gt;
	if isCharger then&lt;br /&gt;
		o.isCharger = true&lt;br /&gt;
		o.chargeTimer = -10 + math.random() * -15&lt;br /&gt;
		if chargeCounter == 1 then&lt;br /&gt;
			o.chargeTimer = 0&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		o.chargeOverlay = createTransparent(x, y, w + 3.5, h + 3.5, d + .1)&lt;br /&gt;
&lt;br /&gt;
		o.chargeSound = &amp;quot;warning&amp;quot; .. chargeCounter .. &amp;quot;.wav&amp;quot;&lt;br /&gt;
		chargeCounter = chargeCounter + 1&lt;br /&gt;
		if chargeCounter &amp;gt; 4 then&lt;br /&gt;
			chargeCounter = 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.insert(obstacles, o)&lt;br /&gt;
&lt;br /&gt;
	return o&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function createItem(x, y)&lt;br /&gt;
&lt;br /&gt;
	local i = {}&lt;br /&gt;
	i.bevel = createBevel(.25, .25, .1)&lt;br /&gt;
	i.body = myPhysics:createEntity({linearDamping = 1, angularDamping = 1}, x, y)&lt;br /&gt;
	myPhysics:addBoxShape(i.body, { x = 0, y = 0, width = .5, height = .5, density = .5, userData = &amp;quot;item_&amp;quot; .. #items })&lt;br /&gt;
	myPhysics:setEntityAngle(i.body, math.random() * 2.0 * math.pi)&lt;br /&gt;
&lt;br /&gt;
	myPhysics:activateEntity(i.body)&lt;br /&gt;
&lt;br /&gt;
	table.insert(items, i)&lt;br /&gt;
&lt;br /&gt;
	return i&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function gameInit()&lt;br /&gt;
&lt;br /&gt;
	--video.setScreenSize(1280, 960)&lt;br /&gt;
&lt;br /&gt;
	circleSprite = video.createSpriteState(&amp;quot;Circle&amp;quot;, &amp;quot;itt.dat&amp;quot;)&lt;br /&gt;
	blockSprite = video.createSpriteState(&amp;quot;Square&amp;quot;, &amp;quot;itt.dat&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	--tankNode = video.createSceneNode(&amp;quot;tank.obj&amp;quot;, &amp;quot;tex.tga&amp;quot;, 0, 0, 0, 0, 0, 0, 1, 1, 1)&lt;br /&gt;
	video.setCameraPosition(cameraPosition.x, cameraPosition.y, cameraPosition.z)&lt;br /&gt;
	video.setCameraViewPosition(cameraTarget.x, cameraTarget.y, cameraTarget.z)&lt;br /&gt;
	--video.setCameraUpVector(0, 0, -1)&lt;br /&gt;
	light = video.createLightSceneNode(0, 0, -3, 6)&lt;br /&gt;
&lt;br /&gt;
	tankNode = video.createSceneNode(&amp;quot;120poly.obj&amp;quot;, &amp;quot;speckle.jpg&amp;quot;, 4, 1, 37.5, 0, 0, 0, .5, .5, .5)&lt;br /&gt;
&lt;br /&gt;
	myPhysics = Physics(-1000, -1000, 1000, 1000, 0, 0)&lt;br /&gt;
&lt;br /&gt;
	local bodyDef = { linearDamping = 20, angularDamping = 20, fixedRotation = false, isBullet = false }&lt;br /&gt;
	local startY = -5.5&lt;br /&gt;
&lt;br /&gt;
	chain.links = {}&lt;br /&gt;
	for i=1,1 do&lt;br /&gt;
		chain.links[i] = {}&lt;br /&gt;
		chain.links[i].bevel = createBevel(.25, 1.5, .1)&lt;br /&gt;
		chain.links[i].body = myPhysics:createEntity(bodyDef, 0, startY + (i-1) * -1)&lt;br /&gt;
		myPhysics:addBoxShape(chain.links[i].body, { x = 0, y = 0, width = .5, height = 3, density = 5, friction = .1, restitution = 1 })&lt;br /&gt;
		myPhysics:activateEntity(chain.links[i].body)&lt;br /&gt;
&lt;br /&gt;
		if i &amp;gt; 1 then&lt;br /&gt;
			-- link with previous piece&lt;br /&gt;
&lt;br /&gt;
			-- 1: Create a body between the pieces&lt;br /&gt;
			local shapeA = myPhysics:createEntity(bodyDef, 0, startY + (i-2) * -1 - .5)&lt;br /&gt;
			myPhysics:addBoxShape(shapeA, {x = 0, y = 0, width = .2, height = .6, density = 1, userData = &amp;quot;player&amp;quot;})&lt;br /&gt;
			myPhysics:activateEntity(shapeA)&lt;br /&gt;
&lt;br /&gt;
			-- 2: Attach the shape to the previous piece&lt;br /&gt;
			myPhysics:createRevoluteJoint(shapeA, chain.links[i-1].body, 0, startY + (i-2) * -1 - .5 + .3, {enableLimit = true, lowerAngle = math.pi * -.1, upperAngle = math.pi * .1})&lt;br /&gt;
&lt;br /&gt;
			myPhysics:createRevoluteJoint(shapeA, chain.links[i].body, 0, startY + (i-2) * -1 - .5 - .3, {enableLimit = true, lowerAngle = math.pi * -.1, upperAngle = math.pi * .1})&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	local o = createObstacle(-4, 2.5, 2, 3, .3)&lt;br /&gt;
	myPhysics:setEntityAngle(o.body, math.pi * .3)&lt;br /&gt;
	createObstacle(-4, -2, 2, 3, .29)&lt;br /&gt;
	createObstacle(4, -5, 2, 6, .29)&lt;br /&gt;
&lt;br /&gt;
	createObstacle(4, 2.5, 2, 3, .3)&lt;br /&gt;
	createObstacle(0, 0, 3, 2, .3)&lt;br /&gt;
&lt;br /&gt;
	createObstacle(4, 2.5, 1.5, 1.5, .4, true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	createObstacle(4, -3, 1.5, 1.5, .4, true)&lt;br /&gt;
	o = createObstacle(-4, 2.5, 1.5, 1.5, .4, true)&lt;br /&gt;
	myPhysics:setEntityAngle(o.body, math.pi * .3)&lt;br /&gt;
	createObstacle(-4, -2, 1.5, 1.5, .4, true)&lt;br /&gt;
&lt;br /&gt;
	createObstacle(-8.5, 0, 2, 11, .3)&lt;br /&gt;
	createObstacle(0, 6.5, 19, 2, .3)&lt;br /&gt;
	createObstacle(8.5, 0, 2, 11, .3)&lt;br /&gt;
	createObstacle(-4.5, -18, 8.5, 25, .3)&lt;br /&gt;
	createObstacle(4.5, -18, 8.5, 25, .3)&lt;br /&gt;
&lt;br /&gt;
	--createTransparent(4, -3, 5.5, 5.5, .45)&lt;br /&gt;
	--createTransparent(-4, 2.5, 5.5, 5.5, .45)&lt;br /&gt;
	--createTransparent(-4, -2, 5.5, 5.5, .45)&lt;br /&gt;
	--createTransparent(4, 2.5, 5.5, 5.5, .45)&lt;br /&gt;
&lt;br /&gt;
	for i=1,30 do&lt;br /&gt;
		createItem(math.random() * 12 - 6, math.random() * 8 - 4)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--[[&lt;br /&gt;
	local grid = {&lt;br /&gt;
		{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },&lt;br /&gt;
		{ 1, 0, 0, 0, 0, 0, 0, 1, 0, 1 },&lt;br /&gt;
		{ 1, 1, 1, 1, 0, 0, 0, 0, 0, 1 },&lt;br /&gt;
		{ 1, 0, 0, 0, 0, 0, 0, 1, 0, 1 },&lt;br /&gt;
		{ 1, 0, 0, 1, 1, 1, 0, 0, 0, 1 },&lt;br /&gt;
		{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 },&lt;br /&gt;
		{ 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 },&lt;br /&gt;
		{ 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 },&lt;br /&gt;
		{ 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 },&lt;br /&gt;
		{ 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 },&lt;br /&gt;
	}&lt;br /&gt;
	local gridSize = 2&lt;br /&gt;
	for y=1,#grid do&lt;br /&gt;
		for x=1,#grid[y] do&lt;br /&gt;
			if grid[y][x] &amp;gt; 0 then&lt;br /&gt;
				createObstacle(-(gridSize * 5.5) + x * gridSize, -2 + (gridSize * #grid) - y * gridSize, gridSize, gridSize, .2)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	]]&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
hook.add(&amp;quot;gameInit&amp;quot;, gameInit)&lt;br /&gt;
&lt;br /&gt;
local cameraTime = 0&lt;br /&gt;
local function gameUpdate(time)&lt;br /&gt;
&lt;br /&gt;
	--local w,h = video.getScreenSize()&lt;br /&gt;
&lt;br /&gt;
	if time &amp;gt; .06 then&lt;br /&gt;
		time = .06&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	cameraTime = cameraTime + time&lt;br /&gt;
	video.setSceneNodeRotation(tankNode, cameraTime * math.pi * .038, cameraTime * math.pi * .338, cameraTime * math.pi)&lt;br /&gt;
	--cameraPosition.x = math.cos(cameraTime) * 3&lt;br /&gt;
	--video.setCameraPosition(cameraPosition.x, cameraPosition.y, cameraPosition.z)&lt;br /&gt;
	--video.setSceneNodePosition(light, cameraPosition.x, cameraPosition.y, cameraPosition.z)&lt;br /&gt;
&lt;br /&gt;
	myPhysics:update(time, 10)&lt;br /&gt;
&lt;br /&gt;
	if daisy.isMouseButtonPressed(0) and gameData.gameOver == 0 then&lt;br /&gt;
&lt;br /&gt;
		local mx, my = daisy.getMousePosition()&lt;br /&gt;
		local wx, wy = positionOnZedPlane(mx, my)&lt;br /&gt;
&lt;br /&gt;
		if gameData.selectedLink then&lt;br /&gt;
&lt;br /&gt;
			-- pull link based on delta distance&lt;br /&gt;
			local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(gameData.selectedLink.body)&lt;br /&gt;
			--gameData.startWX, gameData.startWY = wx, wy&lt;br /&gt;
&lt;br /&gt;
			local localX, localY = vectorMath.xFormMultiply(cx, cy, x1, y1, x2, y2, gameData.startX, gameData.startY)&lt;br /&gt;
			local dx, dy = (wx - localX), (wy - localY)&lt;br /&gt;
&lt;br /&gt;
			local diff = math.sqrt(dx * dx + dy * dy)&lt;br /&gt;
			if diff &amp;gt; 0 then&lt;br /&gt;
				dx = dx / diff&lt;br /&gt;
				dy = dy / diff&lt;br /&gt;
&lt;br /&gt;
				myPhysics:applyEntityForce(gameData.selectedLink.body, localX, localY, dx * 700, dy * 700)&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		else&lt;br /&gt;
&lt;br /&gt;
			for i=1,#chain.links do&lt;br /&gt;
				local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(chain.links[i].body)&lt;br /&gt;
				local xCoords, yCoords = {}, {}&lt;br /&gt;
&lt;br /&gt;
				for v=1,#chain.links[i].bevel.physX do&lt;br /&gt;
					xCoords[v], yCoords[v] = vectorMath.xFormMultiply(cx, cy, x1, y1, x2, y2, chain.links[i].bevel.physX[v], chain.links[i].bevel.physY[v])&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				chain.links[i].isPointInside = true&lt;br /&gt;
&lt;br /&gt;
				for v=1,4 do&lt;br /&gt;
&lt;br /&gt;
					local u = v + 1&lt;br /&gt;
					if u &amp;gt; 4 then&lt;br /&gt;
						u = 1&lt;br /&gt;
					end&lt;br /&gt;
&lt;br /&gt;
					-- vector from v to u&lt;br /&gt;
					local dx, dy = xCoords[u] - xCoords[v], yCoords[u] - yCoords[v]&lt;br /&gt;
					-- vector from v to position&lt;br /&gt;
					local tx, ty = wx - xCoords[v], wy - yCoords[v]&lt;br /&gt;
&lt;br /&gt;
					if vectorMath.cross22(dx, dy, tx, ty) &amp;lt; 0 then&lt;br /&gt;
						chain.links[i].isPointInside = false&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if chain.links[i].isPointInside then&lt;br /&gt;
					gameData.selectedLink = chain.links[i]&lt;br /&gt;
					gameData.startX, gameData.startY = vectorMath.xFormInvert(cx, cy, x1, y1, x2, y2, wx, wy)&lt;br /&gt;
					gameData.startWX, gameData.startWY = wx, wy&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if gameData.selectedLink then&lt;br /&gt;
			gameData.selectedLink.isPointInside = false&lt;br /&gt;
		end&lt;br /&gt;
		gameData.selectedLink = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	do&lt;br /&gt;
		if gameData.selectedLink then&lt;br /&gt;
			--gameData.lastSelectedLink = gameData.selectedLink&lt;br /&gt;
		end&lt;br /&gt;
		if not gameData.lastSelectedLink then&lt;br /&gt;
			gameData.lastSelectedLink = chain.links[1]&lt;br /&gt;
		end&lt;br /&gt;
		local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(gameData.lastSelectedLink.body)&lt;br /&gt;
		video.setSceneNodePosition(light, cx, cy, -2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		local px, py = cx, cy&lt;br /&gt;
&lt;br /&gt;
		for index, item in ipairs(items) do&lt;br /&gt;
&lt;br /&gt;
			cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(item.body)&lt;br /&gt;
&lt;br /&gt;
			-- attempt to avoid the player!&lt;br /&gt;
			local dx, dy = px - cx, py - cy&lt;br /&gt;
			local diff = math.sqrt(dx * dx + dy * dy)&lt;br /&gt;
&lt;br /&gt;
			item.runAwayTimer = item.runAwayTimer or 0&lt;br /&gt;
			item.runAwayTimer = item.runAwayTimer + time&lt;br /&gt;
			if item.runAwayTimer &amp;gt; 3 then&lt;br /&gt;
				item.runLeft = not item.runLeft&lt;br /&gt;
				item.runAwayTimer = math.random()&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if diff &amp;lt; 3 then&lt;br /&gt;
				dx = dx / diff&lt;br /&gt;
				dy = dy / diff&lt;br /&gt;
&lt;br /&gt;
				-- rotate 90 degrees&lt;br /&gt;
				local temp = dx&lt;br /&gt;
				dx = -dy&lt;br /&gt;
				dy = temp&lt;br /&gt;
&lt;br /&gt;
				local run = 2&lt;br /&gt;
				if item.runLeft then&lt;br /&gt;
					run = -2&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				myPhysics:applyEntityForce(item.body, cx, cy, dx * run, dy * run)&lt;br /&gt;
			else&lt;br /&gt;
				dx = 2 * dx / diff&lt;br /&gt;
				dy = 2 * dy / diff&lt;br /&gt;
				myPhysics:applyEntityForce(item.body, cx, cy, -dx, -dy)&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local impacts = myPhysics:getEntityCollisions(gameData.lastSelectedLink.body)&lt;br /&gt;
		if impacts then&lt;br /&gt;
			for i=1,#impacts do&lt;br /&gt;
				if impacts[i].impulse &amp;gt; 1 then&lt;br /&gt;
					--print(&amp;quot;impact &amp;quot; .. impacts[i].impulse)&lt;br /&gt;
&lt;br /&gt;
					local found = false&lt;br /&gt;
&lt;br /&gt;
					-- locate if it was an item we hit&lt;br /&gt;
					for index, item in ipairs(items) do&lt;br /&gt;
&lt;br /&gt;
						if item.body == impacts[i].id then&lt;br /&gt;
							--print(&amp;quot;killed item&amp;quot;)&lt;br /&gt;
							audio.playSound(&amp;quot;death.wav&amp;quot;)&lt;br /&gt;
							myPhysics:deleteEntity(item.body)&lt;br /&gt;
							table.remove(items, index)&lt;br /&gt;
&lt;br /&gt;
							found = true&lt;br /&gt;
							break&lt;br /&gt;
						end&lt;br /&gt;
&lt;br /&gt;
					end&lt;br /&gt;
					if not found then&lt;br /&gt;
						if impacts[i].impulse &amp;gt; 30 then&lt;br /&gt;
							audio.playSound(&amp;quot;collide&amp;quot; .. math.random(1,3) .. &amp;quot;.wav&amp;quot;)&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local playerSensors = myPhysics:getEntitySensorPoints(gameData.lastSelectedLink.body)&lt;br /&gt;
		if playerSensors then&lt;br /&gt;
&lt;br /&gt;
			for s=1,#playerSensors do&lt;br /&gt;
				for index, obstacle in ipairs(transparent) do&lt;br /&gt;
					if obstacle.body == playerSensors[s].id and obstacle.activeTimer and obstacle.activeTimer &amp;gt; 0 then&lt;br /&gt;
						--print(&amp;quot;hit by sensor&amp;quot;)&lt;br /&gt;
						gameData.gameOver = 2&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if gameData.gameOver == 0 then&lt;br /&gt;
		for index, obstacle in ipairs(obstacles) do&lt;br /&gt;
&lt;br /&gt;
			if obstacle.isCharger then&lt;br /&gt;
				obstacle.chargeTimer = obstacle.chargeTimer + time * 2&lt;br /&gt;
&lt;br /&gt;
				local prevFlash = obstacle.doFlash&lt;br /&gt;
				obstacle.doFlash = obstacle.chargeTimer &amp;gt; 0 and math.sin(obstacle.chargeTimer * obstacle.chargeTimer) &amp;gt; .8&lt;br /&gt;
&lt;br /&gt;
				if not prevFlash and obstacle.doFlash then&lt;br /&gt;
					audio.playSound(obstacle.chargeSound, .2 + obstacle.chargeTimer / 20, 0, .5 + obstacle.chargeTimer / 15)&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				if obstacle.chargeTimer &amp;gt; 15 then&lt;br /&gt;
					obstacle.chargeTimer = -math.random() * 20&lt;br /&gt;
&lt;br /&gt;
					obstacle.chargeOverlay.activeTimer = 1&lt;br /&gt;
&lt;br /&gt;
					audio.playSound(&amp;quot;explosion1.wav&amp;quot;, .6)&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for index, obstacle in ipairs(transparent) do&lt;br /&gt;
&lt;br /&gt;
		obstacle.rotationTimer = obstacle.rotationTimer or 0&lt;br /&gt;
		obstacle.rotationTimer = obstacle.rotationTimer + time * 10&lt;br /&gt;
&lt;br /&gt;
		myPhysics:setEntityAngle(obstacle.body, obstacle.rotationTimer)&lt;br /&gt;
&lt;br /&gt;
		if obstacle.activeTimer and obstacle.activeTimer &amp;gt; 0 then&lt;br /&gt;
			obstacle.activeTimer = obstacle.activeTimer - time&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if #items == 0 and gameData.gameOver == 0 then&lt;br /&gt;
		gameData.gameOver = 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
hook.add(&amp;quot;frameUpdate&amp;quot;, gameUpdate)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local bgGrid = {&lt;br /&gt;
&lt;br /&gt;
	x = { -.1, -.1, 0, 0, .1, .1, 0, 0 },&lt;br /&gt;
	y = { -1, 1, 1, -1, 1, -1, -1, 1 },&lt;br /&gt;
	z = { .1, .1, 0, 0, .1, .1, 0, 0 },&lt;br /&gt;
&lt;br /&gt;
	nx = { -d45, -d45, -d45, -d45, d45, d45, d45, d45 },&lt;br /&gt;
	ny = { 0, 0, 0, 0, 0, 0, 0, 0 },&lt;br /&gt;
	nz = { -d45, -d45, -d45, -d45, -d45, -d45, -d45, -d45 },&lt;br /&gt;
&lt;br /&gt;
	u = { 0, 0, 1, 1, 0, 0, 1, 1 },&lt;br /&gt;
	v = { 0, 1, 1, 0, 0, 1, 1, 0 },&lt;br /&gt;
&lt;br /&gt;
	i = { 0, 1, 2, 0, 2, 3,  4, 5, 6, 4, 6, 7 },&lt;br /&gt;
&lt;br /&gt;
	tris = 4,&lt;br /&gt;
	verts = 8,&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
do&lt;br /&gt;
	-- generate bg grid&lt;br /&gt;
&lt;br /&gt;
	local v = 1&lt;br /&gt;
	local i = 1&lt;br /&gt;
&lt;br /&gt;
	local zOff = 0&lt;br /&gt;
&lt;br /&gt;
	for yCount=1,5 do&lt;br /&gt;
&lt;br /&gt;
		local y = 6 - yCount * 2&lt;br /&gt;
&lt;br /&gt;
		for xCount=1,7 do&lt;br /&gt;
&lt;br /&gt;
			local x = -8 + xCount * 2&lt;br /&gt;
&lt;br /&gt;
			-- create back and front&lt;br /&gt;
			bgGrid.x[v + 0] = x - .1&lt;br /&gt;
			bgGrid.x[v + 1] = x - .1&lt;br /&gt;
			bgGrid.x[v + 2] = x&lt;br /&gt;
			bgGrid.x[v + 3] = x&lt;br /&gt;
&lt;br /&gt;
			bgGrid.x[v + 4] = x + .1&lt;br /&gt;
			bgGrid.x[v + 5] = x + .1&lt;br /&gt;
			bgGrid.x[v + 6] = x&lt;br /&gt;
			bgGrid.x[v + 7] = x&lt;br /&gt;
&lt;br /&gt;
			bgGrid.y[v + 0] = y - 1&lt;br /&gt;
			bgGrid.y[v + 1] = y + 1&lt;br /&gt;
			bgGrid.y[v + 2] = y + 1&lt;br /&gt;
			bgGrid.y[v + 3] = y - 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.y[v + 4] = y + 1&lt;br /&gt;
			bgGrid.y[v + 5] = y - 1&lt;br /&gt;
			bgGrid.y[v + 6] = y - 1&lt;br /&gt;
			bgGrid.y[v + 7] = y + 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.z[v + 0] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 1] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 2] = 0 + zOff&lt;br /&gt;
			bgGrid.z[v + 3] = 0 + zOff&lt;br /&gt;
&lt;br /&gt;
			bgGrid.z[v + 4] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 5] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 6] = 0 + zOff&lt;br /&gt;
			bgGrid.z[v + 7] = 0 + zOff&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nx[v + 0] = -d45&lt;br /&gt;
			bgGrid.nx[v + 1] = -d45&lt;br /&gt;
			bgGrid.nx[v + 2] = -d45&lt;br /&gt;
			bgGrid.nx[v + 3] = -d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nx[v + 4] = d45&lt;br /&gt;
			bgGrid.nx[v + 5] = d45&lt;br /&gt;
			bgGrid.nx[v + 6] = d45&lt;br /&gt;
			bgGrid.nx[v + 7] = d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.ny[v + 0] = 0&lt;br /&gt;
			bgGrid.ny[v + 1] = 0&lt;br /&gt;
			bgGrid.ny[v + 2] = 0&lt;br /&gt;
			bgGrid.ny[v + 3] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.ny[v + 4] = 0&lt;br /&gt;
			bgGrid.ny[v + 5] = 0&lt;br /&gt;
			bgGrid.ny[v + 6] = 0&lt;br /&gt;
			bgGrid.ny[v + 7] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nz[v + 0] = -d45&lt;br /&gt;
			bgGrid.nz[v + 1] = -d45&lt;br /&gt;
			bgGrid.nz[v + 2] = -d45&lt;br /&gt;
			bgGrid.nz[v + 3] = -d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nz[v + 4] = -d45&lt;br /&gt;
			bgGrid.nz[v + 5] = -d45&lt;br /&gt;
			bgGrid.nz[v + 6] = -d45&lt;br /&gt;
			bgGrid.nz[v + 7] = -d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.u[v + 0] = 0&lt;br /&gt;
			bgGrid.u[v + 1] = 0&lt;br /&gt;
			bgGrid.u[v + 2] = 1&lt;br /&gt;
			bgGrid.u[v + 3] = 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.u[v + 4] = 0&lt;br /&gt;
			bgGrid.u[v + 5] = 0&lt;br /&gt;
			bgGrid.u[v + 6] = 1&lt;br /&gt;
			bgGrid.u[v + 7] = 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.v[v + 0] = 0&lt;br /&gt;
			bgGrid.v[v + 1] = 1&lt;br /&gt;
			bgGrid.v[v + 2] = 1&lt;br /&gt;
			bgGrid.v[v + 3] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.v[v + 4] = 0&lt;br /&gt;
			bgGrid.v[v + 5] = 1&lt;br /&gt;
			bgGrid.v[v + 6] = 1&lt;br /&gt;
			bgGrid.v[v + 7] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.i[i + 0] = v + 0 - 1&lt;br /&gt;
			bgGrid.i[i + 1] = v + 1 - 1&lt;br /&gt;
			bgGrid.i[i + 2] = v + 2 - 1&lt;br /&gt;
			bgGrid.i[i + 3] = v + 0 - 1&lt;br /&gt;
			bgGrid.i[i + 4] = v + 2 - 1&lt;br /&gt;
			bgGrid.i[i + 5] = v + 3 - 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.i[i + 6] = v + 4 - 1&lt;br /&gt;
			bgGrid.i[i + 7] = v + 5 - 1&lt;br /&gt;
			bgGrid.i[i + 8] = v + 6 - 1&lt;br /&gt;
			bgGrid.i[i + 9] = v + 4 - 1&lt;br /&gt;
			bgGrid.i[i + 10] = v + 6 - 1&lt;br /&gt;
			bgGrid.i[i + 11] = v + 7 - 1&lt;br /&gt;
&lt;br /&gt;
			v = v + 8&lt;br /&gt;
			i = i + 12&lt;br /&gt;
&lt;br /&gt;
			-- create top and bottom&lt;br /&gt;
			bgGrid.x[v + 0] = x - 1&lt;br /&gt;
			bgGrid.x[v + 1] = x + 1&lt;br /&gt;
			bgGrid.x[v + 2] = x + 1&lt;br /&gt;
			bgGrid.x[v + 3] = x - 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.x[v + 4] = x - 1&lt;br /&gt;
			bgGrid.x[v + 5] = x + 1&lt;br /&gt;
			bgGrid.x[v + 6] = x + 1&lt;br /&gt;
			bgGrid.x[v + 7] = x - 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.y[v + 0] = y + .1&lt;br /&gt;
			bgGrid.y[v + 1] = y + .1&lt;br /&gt;
			bgGrid.y[v + 2] = y&lt;br /&gt;
			bgGrid.y[v + 3] = y&lt;br /&gt;
&lt;br /&gt;
			bgGrid.y[v + 4] = y&lt;br /&gt;
			bgGrid.y[v + 5] = y&lt;br /&gt;
			bgGrid.y[v + 6] = y - .1&lt;br /&gt;
			bgGrid.y[v + 7] = y - .1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.z[v + 0] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 1] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 2] = 0 + zOff&lt;br /&gt;
			bgGrid.z[v + 3] = 0 + zOff&lt;br /&gt;
&lt;br /&gt;
			bgGrid.z[v + 4] = 0 + zOff&lt;br /&gt;
			bgGrid.z[v + 5] = 0 + zOff&lt;br /&gt;
			bgGrid.z[v + 6] = .1 + zOff&lt;br /&gt;
			bgGrid.z[v + 7] = .1 + zOff&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nx[v + 0] = 0&lt;br /&gt;
			bgGrid.nx[v + 1] = 0&lt;br /&gt;
			bgGrid.nx[v + 2] = 0&lt;br /&gt;
			bgGrid.nx[v + 3] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nx[v + 4] = 0&lt;br /&gt;
			bgGrid.nx[v + 5] = 0&lt;br /&gt;
			bgGrid.nx[v + 6] = 0&lt;br /&gt;
			bgGrid.nx[v + 7] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.ny[v + 0] = d45&lt;br /&gt;
			bgGrid.ny[v + 1] = d45&lt;br /&gt;
			bgGrid.ny[v + 2] = d45&lt;br /&gt;
			bgGrid.ny[v + 3] = d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.ny[v + 4] = -d45&lt;br /&gt;
			bgGrid.ny[v + 5] = -d45&lt;br /&gt;
			bgGrid.ny[v + 6] = -d45&lt;br /&gt;
			bgGrid.ny[v + 7] = -d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nz[v + 0] = -d45&lt;br /&gt;
			bgGrid.nz[v + 1] = -d45&lt;br /&gt;
			bgGrid.nz[v + 2] = -d45&lt;br /&gt;
			bgGrid.nz[v + 3] = -d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.nz[v + 4] = -d45&lt;br /&gt;
			bgGrid.nz[v + 5] = -d45&lt;br /&gt;
			bgGrid.nz[v + 6] = -d45&lt;br /&gt;
			bgGrid.nz[v + 7] = -d45&lt;br /&gt;
&lt;br /&gt;
			bgGrid.u[v + 0] = 0&lt;br /&gt;
			bgGrid.u[v + 1] = 0&lt;br /&gt;
			bgGrid.u[v + 2] = 1&lt;br /&gt;
			bgGrid.u[v + 3] = 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.u[v + 4] = 0&lt;br /&gt;
			bgGrid.u[v + 5] = 0&lt;br /&gt;
			bgGrid.u[v + 6] = 1&lt;br /&gt;
			bgGrid.u[v + 7] = 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.v[v + 0] = 0&lt;br /&gt;
			bgGrid.v[v + 1] = 1&lt;br /&gt;
			bgGrid.v[v + 2] = 1&lt;br /&gt;
			bgGrid.v[v + 3] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.v[v + 4] = 0&lt;br /&gt;
			bgGrid.v[v + 5] = 1&lt;br /&gt;
			bgGrid.v[v + 6] = 1&lt;br /&gt;
			bgGrid.v[v + 7] = 0&lt;br /&gt;
&lt;br /&gt;
			bgGrid.i[i + 0] = v + 0 - 1&lt;br /&gt;
			bgGrid.i[i + 1] = v + 1 - 1&lt;br /&gt;
			bgGrid.i[i + 2] = v + 2 - 1&lt;br /&gt;
			bgGrid.i[i + 3] = v + 0 - 1&lt;br /&gt;
			bgGrid.i[i + 4] = v + 2 - 1&lt;br /&gt;
			bgGrid.i[i + 5] = v + 3 - 1&lt;br /&gt;
&lt;br /&gt;
			bgGrid.i[i + 6] = v + 4 - 1&lt;br /&gt;
			bgGrid.i[i + 7] = v + 5 - 1&lt;br /&gt;
			bgGrid.i[i + 8] = v + 6 - 1&lt;br /&gt;
			bgGrid.i[i + 9] = v + 4 - 1&lt;br /&gt;
			bgGrid.i[i + 10] = v + 6 - 1&lt;br /&gt;
			bgGrid.i[i + 11] = v + 7 - 1&lt;br /&gt;
&lt;br /&gt;
			v = v + 8&lt;br /&gt;
			i = i + 12&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	bgGrid.verts = v - 1&lt;br /&gt;
	bgGrid.tris = bgGrid.verts / 2&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function render()&lt;br /&gt;
&lt;br /&gt;
	local w,h = video.getScreenSize()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	video.setMaterial(testMaterial)&lt;br /&gt;
&lt;br /&gt;
	do&lt;br /&gt;
		local a, r, g, b = {}, {}, {}, {}&lt;br /&gt;
		local intensity = 200 + math.floor(55 * math.random())&lt;br /&gt;
		for v=1,bgGrid.verts do&lt;br /&gt;
			a[v] = 255&lt;br /&gt;
			r[v] = intensity&lt;br /&gt;
			g[v] = 128&lt;br /&gt;
			b[v] = 128&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		video.renderTriangleListWithNormals(&lt;br /&gt;
			bgGrid.verts, bgGrid.tris, bgGrid.i,&lt;br /&gt;
			bgGrid.x, bgGrid.y, bgGrid.z,&lt;br /&gt;
			bgGrid.nx, bgGrid.ny, bgGrid.nz,&lt;br /&gt;
			bgGrid.u, bgGrid.v,&lt;br /&gt;
			a, r, g, b&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for i=1,#chain.links do&lt;br /&gt;
		local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(chain.links[i].body)&lt;br /&gt;
		local bevel = transformBevel(chain.links[i].bevel, cx, cy, x1, y1, x2, y2)&lt;br /&gt;
&lt;br /&gt;
		local a, r, g, b = {}, {}, {}, {}&lt;br /&gt;
		local intensity = 200 + math.floor(55 * math.random())&lt;br /&gt;
		for v=1,bevel.verts do&lt;br /&gt;
			a[v] = 255&lt;br /&gt;
			--if chain.links[i].isPointInside then&lt;br /&gt;
			--	r[v] = 0&lt;br /&gt;
			--	g[v] = intensity&lt;br /&gt;
			--	b[v] = 0&lt;br /&gt;
			--else&lt;br /&gt;
				r[v] = intensity&lt;br /&gt;
				g[v] = intensity&lt;br /&gt;
				b[v] = intensity&lt;br /&gt;
			--end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		video.renderTriangleListWithNormals(&lt;br /&gt;
			bevel.verts, bevel.tris, bevel.i,&lt;br /&gt;
			bevel.x, bevel.y, bevel.z,&lt;br /&gt;
			bevel.nx, bevel.ny, bevel.nz,&lt;br /&gt;
			bevel.u, bevel.v,&lt;br /&gt;
			a, r, g, b&lt;br /&gt;
		)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for index, obstacle in ipairs(obstacles) do&lt;br /&gt;
		local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(obstacle.body)&lt;br /&gt;
		local bevel = transformBevel(obstacle.bevel, cx, cy, x1, y1, x2, y2)&lt;br /&gt;
&lt;br /&gt;
		local a, r, g, b = {}, {}, {}, {}&lt;br /&gt;
		local intensity = 200 + math.floor(55 * math.random())&lt;br /&gt;
		for v=1,bevel.verts do&lt;br /&gt;
			if obstacle.doFlash then&lt;br /&gt;
				a[v] = 255&lt;br /&gt;
				r[v] = 255&lt;br /&gt;
				g[v] = 255&lt;br /&gt;
				b[v] = 255&lt;br /&gt;
			else&lt;br /&gt;
				a[v] = 255&lt;br /&gt;
				r[v] = intensity&lt;br /&gt;
				g[v] = 0&lt;br /&gt;
				b[v] = 0&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		video.renderTriangleListWithNormals(&lt;br /&gt;
			bevel.verts, bevel.tris, bevel.i,&lt;br /&gt;
			bevel.x, bevel.y, bevel.z,&lt;br /&gt;
			bevel.nx, bevel.ny, bevel.nz,&lt;br /&gt;
			bevel.u, bevel.v,&lt;br /&gt;
			a, r, g, b&lt;br /&gt;
		)&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for index, item in ipairs(items) do&lt;br /&gt;
		local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(item.body)&lt;br /&gt;
		local bevel = transformBevel(item.bevel, cx, cy, x1, y1, x2, y2)&lt;br /&gt;
&lt;br /&gt;
		local a, r, g, b = {}, {}, {}, {}&lt;br /&gt;
		local intensity = 200 + math.floor(55 * math.random())&lt;br /&gt;
		for v=1,bevel.verts do&lt;br /&gt;
			a[v] = 255&lt;br /&gt;
			r[v] = intensity&lt;br /&gt;
			g[v] = intensity&lt;br /&gt;
			b[v] = intensity&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		video.renderTriangleListWithNormals(&lt;br /&gt;
			bevel.verts, bevel.tris, bevel.i,&lt;br /&gt;
			bevel.x, bevel.y, bevel.z,&lt;br /&gt;
			bevel.nx, bevel.ny, bevel.nz,&lt;br /&gt;
			bevel.u, bevel.v,&lt;br /&gt;
			a, r, g, b&lt;br /&gt;
		)&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	video.render3dScene()&lt;br /&gt;
	--video.renderSpriteState3d(circleSprite, 0, 0, -0.01, 0, 1.0 / 96.0, false, 255, 255, 0, 0)&lt;br /&gt;
&lt;br /&gt;
	video.setMaterial(transparentMaterial)&lt;br /&gt;
	for index, obstacle in ipairs(transparent) do&lt;br /&gt;
&lt;br /&gt;
		if obstacle.activeTimer and obstacle.activeTimer &amp;gt; 0 then&lt;br /&gt;
&lt;br /&gt;
			local cx, cy, x1, y1, x2, y2 = myPhysics:getEntityXForm(obstacle.body)&lt;br /&gt;
			local bevel = transformBevel(obstacle.bevel, cx, cy, x1, y1, x2, y2)&lt;br /&gt;
&lt;br /&gt;
			local a, r, g, b = {}, {}, {}, {}&lt;br /&gt;
			local intensity = 200 + math.floor(55 * math.random())&lt;br /&gt;
			for v=1,bevel.verts do&lt;br /&gt;
				a[v] = 128&lt;br /&gt;
				r[v] = intensity&lt;br /&gt;
				g[v] = intensity&lt;br /&gt;
				b[v] = intensity&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			video.renderTriangleListWithNormals(&lt;br /&gt;
				bevel.verts, bevel.tris, bevel.i,&lt;br /&gt;
				bevel.x, bevel.y, bevel.z,&lt;br /&gt;
				bevel.nx, bevel.ny, bevel.nz,&lt;br /&gt;
				bevel.u, bevel.v,&lt;br /&gt;
				a, r, g, b&lt;br /&gt;
			)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if gameData.gameOver &amp;gt; 0 then&lt;br /&gt;
		if gameData.gameOver == 1 then&lt;br /&gt;
			video.renderText(&amp;quot;You won&amp;quot;, 400, 300 - 20, 1)&lt;br /&gt;
		elseif gameData.gameOver == 2 then&lt;br /&gt;
			video.renderText(&amp;quot;You lost&amp;quot;, 400, 300, 1)&lt;br /&gt;
		end&lt;br /&gt;
		video.renderText(&amp;quot;Press Ctrl+R to Play Again&amp;quot;, 400, 300 + 20, 1)&lt;br /&gt;
		video.renderText(&amp;quot;Press Q to Quit&amp;quot;, 400, 300 + 30, 1)&lt;br /&gt;
&lt;br /&gt;
		video.renderText(&amp;quot;A Game by Jens Bergensten for Ludum Dare 14&amp;quot;, 400, 550, 1)&lt;br /&gt;
		video.renderText(&amp;quot;http://www.oxeyegames.com&amp;quot;, 400, 565, 1)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
hook.add(&amp;quot;frameRender&amp;quot;, render)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function keyPressed(key)&lt;br /&gt;
&lt;br /&gt;
	if key == 81 then -- Q&lt;br /&gt;
&lt;br /&gt;
		daisy.exitGame()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
hook.add(&amp;quot;keyPress&amp;quot;, keyPressed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== vectorMath.lua ===&lt;br /&gt;
&lt;br /&gt;
This is a vector math lua file that we use in many projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-- GLOBALS&lt;br /&gt;
&lt;br /&gt;
_vectorMath = {}&lt;br /&gt;
&lt;br /&gt;
-- LOCALS&lt;br /&gt;
local vectorMath = _vectorMath&lt;br /&gt;
&lt;br /&gt;
vectorMath.cross2 = function(x, y, z)&lt;br /&gt;
	return y * z, -x * z&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
vectorMath.cross22 = function(x1, y1, x2, y2)&lt;br /&gt;
	return x1 * y2 - y1 * x2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
vectorMath.dot2 = function(x1, y1, x2, y2)&lt;br /&gt;
	return x1 * x2 + y1 * y2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
vectorMath.normalize2 = function(x, y)&lt;br /&gt;
	local length = math.sqrt(vectorMath.dot2(x, y, x, y))&lt;br /&gt;
	return x / length, y / length&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
vectorMath.xFormMultiply = function(formX, formY, formCX1, formCY1, formCX2, formCY2, x, y)&lt;br /&gt;
&lt;br /&gt;
	local newX = formCX1 * x + formCX2 * y&lt;br /&gt;
	local newY = formCY1 * x + formCY2 * y&lt;br /&gt;
&lt;br /&gt;
	return newX + formX, newY + formY&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
vectorMath.xFormInvert = function(formX, formY, formCX1, formCY1, formCX2, formCY2, x, y)&lt;br /&gt;
&lt;br /&gt;
	x = x - formX&lt;br /&gt;
	y = y - formY&lt;br /&gt;
&lt;br /&gt;
	local d = formCX1 * formCY2 - formCY1 * formCX2&lt;br /&gt;
&lt;br /&gt;
	local oldX = (formCY2 * x - formCX2 * y) / d&lt;br /&gt;
	local oldY = (formCX1 * y - formCY1 * x) / d&lt;br /&gt;
&lt;br /&gt;
	return oldX, oldY&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
vectorMath.pointToLineSquareDistance = function(x, y, x1, y1, x2, y2)&lt;br /&gt;
&lt;br /&gt;
	-- get vector from start to test point and to end&lt;br /&gt;
	local px, py = x - x1, y - y1&lt;br /&gt;
	local vx, vy = x2 - x1, y2 - y1&lt;br /&gt;
&lt;br /&gt;
	-- also get vectors from the other end, to see if the test point is between&lt;br /&gt;
	local px2, py2 = x - x2, y - y2&lt;br /&gt;
	local vx2, vy2 = x1 - x2, y1 - y2&lt;br /&gt;
&lt;br /&gt;
	-- the dots between these vectors must have equal signs&lt;br /&gt;
	local dot1 = vectorMath.dot2(px, py, vx, vy)&lt;br /&gt;
	local dot2 = vectorMath.dot2(px2, py2, vx2, vy2)&lt;br /&gt;
	if (dot1 &amp;lt; 0 and dot2 &amp;gt; 0) or (dot1 &amp;gt; 0 and dot2 &amp;lt; 0) then&lt;br /&gt;
		-- return the distance to the closest end point&lt;br /&gt;
		local dist1 = px * px + py * py&lt;br /&gt;
		local dist2 = px2 * px2 + py2 * py2&lt;br /&gt;
		if dist1 &amp;lt; dist2 then&lt;br /&gt;
			return dist1&lt;br /&gt;
		end&lt;br /&gt;
		return dist2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	-- project the test vector on the line vector, and calculate rejection&lt;br /&gt;
	local scale = dot1 / (vx*vx + vy*vy)&lt;br /&gt;
	local nx, ny = vx * scale - px, vy * scale - py&lt;br /&gt;
&lt;br /&gt;
	return nx * nx + ny * ny&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Category:Daisymoon</id>
		<title>Category:Daisymoon</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Category:Daisymoon"/>
				<updated>2010-02-07T11:25:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: /* Getting Started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
* [[Introduction to Daisymoon]]&lt;br /&gt;
** [[Projects Using Daisymoon]]&lt;br /&gt;
** [[DaisyMoon License]]&lt;br /&gt;
* [[Daisymoon Tools|Tools]]&lt;br /&gt;
* '''Tutorials'''&lt;br /&gt;
* '''Examples'''&lt;br /&gt;
** [[SimpleBreak]] - Super simple break-out game&lt;br /&gt;
** [[Drag the Wall]] - Game made for Ludum Dare 14, using 3d camera and box2d physics&lt;br /&gt;
&lt;br /&gt;
== Daisymoon API ==&lt;br /&gt;
&lt;br /&gt;
* [[DaisyMoon Application]]&lt;br /&gt;
* [[Daisy Library]]&lt;br /&gt;
** [[Engine Hooks]]&lt;br /&gt;
* [[Video Library]]&lt;br /&gt;
* [[Audio Library]]&lt;br /&gt;
* [[Physics Object]]&lt;br /&gt;
* [[File Objects]]&lt;br /&gt;
* [[Network Library]]&lt;br /&gt;
* [[GUI Library]]&lt;br /&gt;
** [[GUI Artwork]]&lt;br /&gt;
&lt;br /&gt;
== Getting Involved ==&lt;br /&gt;
&lt;br /&gt;
* [[Engine Suggestions]]&lt;br /&gt;
&lt;br /&gt;
== Oxeye Game Studio Texture Packages ==&lt;br /&gt;
&lt;br /&gt;
* [[Texture Builder]]&lt;br /&gt;
&lt;br /&gt;
== Other Resources ==&lt;br /&gt;
&lt;br /&gt;
* [http://lua-users.org/ Lua Users Wiki]&lt;br /&gt;
* [http://lua-users.org/wiki/MathLibraryTutorial Lua Math Library]&lt;br /&gt;
* [http://lua-users.org/wiki/StringLibraryTutorial Lua String Library]&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/Engine_Suggestions</id>
		<title>Engine Suggestions</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/Engine_Suggestions"/>
				<updated>2010-02-06T23:22:18Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: /* Under Evaluation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Under Evaluation ==&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Library'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Type'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Problem/Suggestion'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
{{EngineSuggestion|video|feature|A way to enable/disable/get fullscreen from lua.|}}&lt;br /&gt;
{{EngineSuggestion|video|feature|A way to enable/disable/get v-sync from lua.|}}&lt;br /&gt;
{{EngineSuggestion|video|feature|A way to get a list of available screen modes.|}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Implemented ==&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Library'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Type'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Problem/Suggestion'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
{{EngineSuggestion|physics|bug/feature|Re-use of body id's within the physics engine. An app will after long usage with creation and deletion of bodies start to print out warning messages|Fixed in DaisyMoon 1.1.0}}&lt;br /&gt;
{{EngineSuggestion|gui|feature|A way to set focus to an element|Added [[setFocus|element:setFocus()]] for edit fields in DaisyMoon 1.1.0}}&lt;br /&gt;
{{EngineSuggestion|daisy|feature|A way to restart the app from a command.|Added [[resetGame|daisy.resetGame()]] in DaisyMoon 1.1.0}}&lt;br /&gt;
{{EngineSuggestion|daisy|feature|output from print cannot be removed without restarting game. Would be awesome with a function to clear that printout|Added [[clearPrint|daisy.clearPrint()]] in DaisyMoon 1.1.0}}&lt;br /&gt;
{{EngineSuggestion|network|missing functionality|Hosts cannot disconnect individual clients|Added [[disconnectClient|network:disconnectClient(id)]] in DaisyMoon 1.1.0}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Discarded ==&lt;br /&gt;
{| border=2 cellpadding=3 cellspacing=0 style=&amp;quot;margin: 0 0 1em 1em; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Library'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Type'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Problem/Suggestion'''&lt;br /&gt;
|style=&amp;quot;background:#c7c7e0&amp;quot;| '''Comment'''&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/DaisyMoon_Application</id>
		<title>DaisyMoon Application</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/DaisyMoon_Application"/>
				<updated>2010-02-06T20:30:37Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: /* Application Versions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The DaisyMoon application is the program that contains the Daisy engine and executes the Lua scripts. The application has some global settings and shortcuts that can't be modified from the scripts.&lt;br /&gt;
&lt;br /&gt;
=== Application Shortcuts ===&lt;br /&gt;
&lt;br /&gt;
* '''Alt+F4''' (Ctrl+Q on MacOS X) quits the game. You can also quit the game from Lua by calling [[exitGame]].&lt;br /&gt;
* '''Ctrl+R''' resets the game and forces it to unload and reload all Lua scripts.&lt;br /&gt;
&lt;br /&gt;
=== Application Settings ===&lt;br /&gt;
&lt;br /&gt;
DaisyMoon reads settings from ''daisyMoon.cfg'' before running any Lua scripts. Modify this file if you want to setup things before Lua is started. Currently available settings are:&lt;br /&gt;
&lt;br /&gt;
* '''screenWidth''' and '''screenHeight''' the window's resolution.&lt;br /&gt;
* '''fullscreen''' set this to 1 if the game should start in fullscreen.&lt;br /&gt;
&lt;br /&gt;
The configuration file looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
settings {&lt;br /&gt;
	screenWidth = 1024;&lt;br /&gt;
	screenHeight = 768;&lt;br /&gt;
	fullscreen = 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, this is not a Lua table.&lt;br /&gt;
&lt;br /&gt;
=== Application Versions ===&lt;br /&gt;
&lt;br /&gt;
==== v1.1.0 ====&lt;br /&gt;
&lt;br /&gt;
* Added [[disconnectClient]]&lt;br /&gt;
* Added [[getVersion]]&lt;br /&gt;
* Added [[setFocus]]&lt;br /&gt;
* Added [[clearPrint]]&lt;br /&gt;
* Changed physics entity numbering so that body id numbers can be reused&lt;br /&gt;
* Corrected collision detection for edge shapes&lt;br /&gt;
* Corrected [[setTextColor]] for buttons&lt;br /&gt;
&lt;br /&gt;
==== v1.0.2 ====&lt;br /&gt;
&lt;br /&gt;
* Corrected a network crash bug that would occur quite often (such as, &amp;quot;all the time&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
==== Various Beta Versions ====&lt;br /&gt;
&lt;br /&gt;
A number of beta versions was released with the early prototypes, such as House Globe and Because it's fun, Fay.&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	<entry>
		<id>http://www.oxeyegames.com/wiki/index.php/GetVersion</id>
		<title>GetVersion</title>
		<link rel="alternate" type="text/html" href="http://www.oxeyegames.com/wiki/index.php/GetVersion"/>
				<updated>2010-02-06T20:26:33Z</updated>
		
		<summary type="html">&lt;p&gt;Jeb: Created page with '{{DaisyMethod | daisy.getVersion() | Fetches the current DaisyMoon version. The version number is divided into major (major releases), minor (new features) and build (bug fixes) ...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DaisyMethod |&lt;br /&gt;
daisy.getVersion()&lt;br /&gt;
|&lt;br /&gt;
Fetches the current DaisyMoon version. The version number is divided into major (major releases), minor (new features) and build (bug fixes) versions.&lt;br /&gt;
&lt;br /&gt;
This method is available in DaisyMoon 1.1.0 and later.&lt;br /&gt;
|&lt;br /&gt;
{{NoParams}}&lt;br /&gt;
|&lt;br /&gt;
Returns three integers, the major, minor and build version numbers. For example, in the first version that had this method, it would return 1, 1 and 0.&lt;br /&gt;
}}&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   local major, minor, build = daisy.getVersion()&lt;br /&gt;
   print(&amp;quot;DaisyMoon v&amp;quot; .. major .. &amp;quot;.&amp;quot; .. minor .. &amp;quot;.&amp;quot; .. build)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jeb</name></author>	</entry>

	</feed>