<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Instance</title><link>https://sourceforge.net/p/hpg-projects/wiki/Instance/</link><description>Recent changes to Instance</description><atom:link href="https://sourceforge.net/p/hpg-projects/wiki/Instance/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 20 Jan 2023 12:16:59 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/hpg-projects/wiki/Instance/feed" rel="self" type="application/rss+xml"/><item><title>Instance modified by Hugh Greene</title><link>https://sourceforge.net/p/hpg-projects/wiki/Instance/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;In ENIGMA, an &lt;a class="" href="../instance" title="wikilink"&gt;instance&lt;/a&gt; refers to an actual&lt;br/&gt;
instance, or representation, or copy, if you will, of an&lt;br/&gt;
&lt;a class="" href="../object" title="wikilink"&gt;object&lt;/a&gt;. An instance is to an object as you are to&lt;br/&gt;
the human species. An object can have any number of instances, each&lt;br/&gt;
functioning independently of one another with their own set of &lt;a class="" href="../locals" title="wikilink"&gt;local&lt;br/&gt;
variables&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="uses"&gt;Uses&lt;/h2&gt;
&lt;p&gt;When an object is created and its behavior programmed (e.g. a bullet),&lt;br/&gt;
then when it is created in the game that is an instance of that object.&lt;br/&gt;
So when a player shoots, then every bullet is its own instance.&lt;/p&gt;
&lt;h2 id="built-in-variables"&gt;Built-in variables&lt;/h2&gt;
&lt;p&gt;Every instance have built in variables that are local to the instance&lt;br/&gt;
itself. They are updated automatically or can be set.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;x - x position of the instance.&lt;/li&gt;
&lt;li&gt;y - y position of the instance.&lt;/li&gt;
&lt;li&gt;xprevious - x position the instance was in the previous step.&lt;/li&gt;
&lt;li&gt;yprevious - y position the instance was in the previous step.&lt;/li&gt;
&lt;li&gt;direction - This is the direction of the instance. Its position is&lt;br/&gt;
    updated every step according to the speed and direction.&lt;/li&gt;
&lt;li&gt;speed - The amount of pixels the instance will move every step in&lt;br/&gt;
    the set direction.&lt;/li&gt;
&lt;li&gt;hspeed - Horizontal speed component. It changes automatically&lt;br/&gt;
    according to the speed and direction.&lt;/li&gt;
&lt;li&gt;vspeed - Vertical speed component. It also changes according to the&lt;br/&gt;
    speed and direction.&lt;/li&gt;
&lt;li&gt;friction - Amount of speed the instance will lose every step.&lt;/li&gt;
&lt;li&gt;gravity - Amount of gravity in pixels per second.&lt;/li&gt;
&lt;li&gt;gravity_direction - The direction gravity will pull.&lt;/li&gt;
&lt;li&gt;solid - Whether the instance is solid or not.&lt;/li&gt;
&lt;li&gt;persistent - Whether the instance is persistent.&lt;/li&gt;
&lt;li&gt;object_index&lt;strong&gt;*&lt;/strong&gt; - Index of the object this is an instance of.&lt;/li&gt;
&lt;li&gt;id&lt;strong&gt;*&lt;/strong&gt; - The unique identifier for the instance (&amp;gt;= 100000).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;*&lt;/strong&gt;These variables are constant and cannot be changed.&lt;/p&gt;
&lt;h2 id="functions"&gt;Functions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;- Create an instance of the specified object at the position (x,y).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Destroys the calling instance.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns whether an instance of type obj exists. obj can be an&lt;br/&gt;
    object, an instance id, or the keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns the id of the (n+1)'th instance of type obj. obj can be&lt;br/&gt;
    an object or the keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns the number of instances of type obj. obj can be an object&lt;br/&gt;
    or the keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns the id of the instance of type obj furthest away from&lt;br/&gt;
    (x,y). obj can be an object or the keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns the id of the instance of type obj nearest to (x,y). obj&lt;br/&gt;
    can be an object or the keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns the id of the instance of type obj at position (x,y).&lt;br/&gt;
    When multiple instances are at that position the first is returned.&lt;br/&gt;
    obj can be an object or the keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;- Returns the id of the instance of type obj met when the current&lt;br/&gt;
    instance is placed at position (x,y). obj can be an object or the&lt;br/&gt;
    keyword all.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hugh Greene</dc:creator><pubDate>Fri, 20 Jan 2023 12:16:59 -0000</pubDate><guid>https://sourceforge.netd930c377ae56d99b3f7d8b1eef4600a1a315e268</guid></item></channel></rss>