<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.sierrahelp.com/index.php?action=history&amp;feed=atom&amp;title=Pushing_Objects</id>
	<title>Pushing Objects - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.sierrahelp.com/index.php?action=history&amp;feed=atom&amp;title=Pushing_Objects"/>
	<link rel="alternate" type="text/html" href="http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;action=history"/>
	<updated>2026-12-02T12:15:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=88825&amp;oldid=prev</id>
		<title>Andrew Branscom at 00:27, 2 April 2025</title>
		<link rel="alternate" type="text/html" href="http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=88825&amp;oldid=prev"/>
		<updated>2025-04-02T00:27:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:27, 1 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Pushing Objects&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Pushing Objects&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;By [[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;agiw:&lt;/del&gt;Andrew Baker|Andrew Baker]]&#039;&#039;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;By [[Andrew Baker|Andrew Baker]]&#039;&#039;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Andrew Branscom</name></author>
	</entry>
	<entry>
		<id>http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=70535&amp;oldid=prev</id>
		<title>Andrew Branscom: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=70535&amp;oldid=prev"/>
		<updated>2025-02-16T20:55:19Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:55, 16 February 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Andrew Branscom</name></author>
	</entry>
	<entry>
		<id>http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=70534&amp;oldid=prev</id>
		<title>Andrew Branscom: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=70534&amp;oldid=prev"/>
		<updated>2024-06-03T05:11:31Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:11, 3 June 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Andrew Branscom</name></author>
	</entry>
	<entry>
		<id>http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=70533&amp;oldid=prev</id>
		<title>sierraw&gt;Andrew Branscom at 04:32, 22 March 2018</title>
		<link rel="alternate" type="text/html" href="http://wiki.sierrahelp.com/index.php?title=Pushing_Objects&amp;diff=70533&amp;oldid=prev"/>
		<updated>2018-03-22T04:32:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Pushing Objects&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;By [[agiw:Andrew Baker|Andrew Baker]]&amp;#039;&amp;#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
I was thinking about having a ladder in a room in a game that I could move around and then climb. I thought all day about how I would accomplish this when I figured out this much. In my example, the view in question (o1) is 10 x 20, as is the ego. This code produces a movable character that will push the block in the same direction he is going. The block was originally very sticky, but I fixed this by making it move faster than the ego, which makes it move a little choppy, but not distractingly so.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;agi&amp;quot;&amp;gt;&lt;br /&gt;
// ************************************************************************ &lt;br /&gt;
// &lt;br /&gt;
// Logic 2: Push block &lt;br /&gt;
// &lt;br /&gt;
// ************************************************************************ &lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;defines.txt&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
if (new_room) { &lt;br /&gt;
    load.pic(room_no); &lt;br /&gt;
    draw.pic(room_no); &lt;br /&gt;
    discard.pic(room_no); &lt;br /&gt;
    set.horizon(37); &lt;br /&gt;
    &lt;br /&gt;
    if ((prev_room_no == 1 ||     &lt;br /&gt;
        prev_room_no == 0)) {     &lt;br /&gt;
        position(ego,120,100); &lt;br /&gt;
        status.line.on(); &lt;br /&gt;
        accept.input(); &lt;br /&gt;
    } &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    draw(ego); &lt;br /&gt;
    show.pic(); &lt;br /&gt;
  &lt;br /&gt;
    block_x = 75; //these first two are the push_object&amp;#039;s center dimensions&lt;br /&gt;
    block_y = 75; &lt;br /&gt;
    block_xr  = 85; //follows are the perimeter dimensions of the block. &lt;br /&gt;
    block_yt = 65;  //r is right, t is top, l is left, b is bottom.&lt;br /&gt;
    block_xl = 65; &lt;br /&gt;
    block_yb = 85; &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    animate.obj(o1);  //this is the push block.&lt;br /&gt;
    load.view(2); &lt;br /&gt;
    set.view(o1,2); &lt;br /&gt;
    position.v(o1,block_x,block_y); &lt;br /&gt;
    draw(o1); &lt;br /&gt;
    ignore.objs(o1); &lt;br /&gt;
    &lt;br /&gt;
    obj_speed = 2;  //and this is the code that makes sure the object is non-stick.&lt;br /&gt;
    step.size(pushable_object, obj_speed); &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
get.posn(ego,ego_x,ego_y); &lt;br /&gt;
 &lt;br /&gt;
if (ego_x &amp;gt; block_xl &amp;amp;&amp;amp;             //Is the ego in the perimeter? &lt;br /&gt;
    ego_y &amp;gt; block_yt     &amp;amp;&amp;amp; &lt;br /&gt;
    ego_x &amp;lt; block_xr     &amp;amp;&amp;amp; &lt;br /&gt;
    ego_y &amp;lt; block_yb) { &lt;br /&gt;
    get.dir(ego, this_way);         //Then I simply set the object&amp;#039;s direction to the ego&amp;#039;s.&lt;br /&gt;
    set.dir(o1, this_way); &lt;br /&gt;
    get.posn(o1,block_x, block_y);  //Then I update the object&amp;#039;s coordinates &lt;br /&gt;
    block_xr = block_x;             //and the perimeter as well.&lt;br /&gt;
    block_xr += 10; &lt;br /&gt;
    block_yt = block_y; &lt;br /&gt;
    block_yt -= 10; &lt;br /&gt;
    block_xl = block_x; &lt;br /&gt;
    block_xl -= 10; &lt;br /&gt;
    block_yb = block_y; &lt;br /&gt;
    block_yb += 10; &lt;br /&gt;
} else { &lt;br /&gt;
    stop.motion(o1);  //And when the ego stops or leaves the push object&amp;#039;s perimeter, the object&lt;br /&gt;
}                     //stops. &lt;br /&gt;
 &lt;br /&gt;
if (said(&amp;quot;look&amp;quot;)) { &lt;br /&gt;
    print(&amp;quot;Except for the stone block, this is an empty room.&amp;quot;); &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
return();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The push object is now stick-free for all intents and purposes. Not completely stick-free, but it won&amp;#039;t glue itself to the ego the way it did in my original code.&lt;br /&gt;
&lt;br /&gt;
It would be very simple to add a flag check in the push_object &amp;quot;if&amp;quot; statement so that you can control the &amp;quot;pushability&amp;quot; of the object. For example, if a very large boulder needs to be pushed to a particular area of the screen, but the ego first needs to lift weights until they are strong enough to push the boulder, then you would set up a flag, strong_enough. If strong_enough == FALSE, then the perimeter is ignored, but the object is observed (use observe.objs). If strong_enough == TRUE, then the perimeter is observed, but the object is ignored. It is essential to ignore the object when you want it to be pushed, or the block will not move properly.&lt;br /&gt;
&lt;br /&gt;
It would also be a good idea to set or reset a flag when the boulder is in the final position so that it will stop moving.&lt;br /&gt;
&lt;br /&gt;
Strangely enough, push objects cannot be forced off screen or across black control lines.&lt;br /&gt;
&lt;br /&gt;
The basic code itself is packaged here [[agi:Examples/logic/pushobj.zip|pushobj]]. Download it by right-clicking the hyperlink.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:AGI References]]&lt;br /&gt;
[[Category:Objects]]&lt;/div&gt;</summary>
		<author><name>sierraw&gt;Andrew Branscom</name></author>
	</entry>
</feed>