<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Rotating bitmap in local and global axis ?</title>
		<link>http://www.allegro.cc/forums/view/617439</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 07 Jun 2018 01:30:42 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My 2D top-down shooter game wants some syntactic sugar to rotate the bitmap and the whole bitmap around another bitmap or point (which is the player). Please help me out <br />Thanks in advance
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Tue, 05 Jun 2018 03:52:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Do yourself a favor and draw out what you want to do on paper and look at the math. Then it should be clear how to proceed programming your app.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 05 Jun 2018 06:00:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre>rotate_bitmap_around_another_bitmap<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Cookies please.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Tue, 05 Jun 2018 11:00:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey Dizzy, looks like your shell is still intact. Glad to hear it. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>Drop some sick beats
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 05 Jun 2018 11:36:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Edgar Reynaldo and Dizzy Egg - than you for the replay. <br />I will try to sort out a way to do that using trigonometry or simple geometric mathematics.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Tue, 05 Jun 2018 12:58:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s the sum of two angles and a point rotated around the circle.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 05 Jun 2018 20:28:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Take the rotation of the world, add in the rotation of the object in the world with it, then draw it on your rotated world.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Tue, 05 Jun 2018 22:38:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Edgar Reynaldo and Neil Roy- thank you for replying <br />I fixed it using the transform 
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_identity_transform"><span class="a">al_identity_transform</span></a><span class="k2">(</span><span class="k3">&amp;</span>transform<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_translate_transform"><span class="a">al_translate_transform</span></a><span class="k2">(</span><span class="k3">&amp;</span>transform, <span class="k3">-</span>playerX, <span class="k3">-</span>playerY<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_rotate_transform"><span class="a">al_rotate_transform</span></a><span class="k2">(</span><span class="k3">&amp;</span>transform, cameraRotation <span class="k3">*</span> <span class="n">3</span>.<span class="n">14</span> <span class="k3">/</span> <span class="n">180</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_translate_transform"><span class="a">al_translate_transform</span></a><span class="k2">(</span><span class="k3">&amp;</span>transform, playerX, playerY<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_use_transform"><span class="a">al_use_transform</span></a><span class="k2">(</span><span class="k3">&amp;</span>transform<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
when drawing the player i used rotation (360 - cameraRotation), so that the player won&#39;t rotate, rather the world will rotate around the player.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Tue, 05 Jun 2018 23:29:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thinkal_VB, glad you solved it. See, you could do it!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 06 Jun 2018 02:45:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Edgar Reynaldo, for your compliments and help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Wed, 06 Jun 2018 16:23:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You should probably use a few more decimal places with your 3.14 constant there or after you spin the camera a few times it will start being off...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 07 Jun 2018 00:13:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617439/1037731#target">Elias</a> said:</div><div class="quote"><p> You should probably use a few more decimal places with your 3.14 constant there or after you spin the camera a few times it will start being off...</p></div></div><p>He should use <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_PI"><span class="a">ALLEGRO_PI</span></a></span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Eric Johnson)</author>
		<pubDate>Thu, 07 Jun 2018 00:27:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you Elias and Eric Johnson, <br />I used #define PI 3.14159f in my actual code. <br />That code was purely representational(in the post). However, thank you for letting me know about the ALLEGRO_PI. I will change my code to use ALLEGRO_PI as it is more precise.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thinkal VB)</author>
		<pubDate>Thu, 07 Jun 2018 01:30:42 +0000</pubDate>
	</item>
</rss>
