<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: When Things Collide, We Detect!</title>
	<atom:link href="http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/</link>
	<description>Game Development Demystified! and other thoughts...</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:34:18 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tweebiebird</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-2683</link>
		<dc:creator>Tweebiebird</dc:creator>
		<pubDate>Tue, 30 Aug 2011 06:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-2683</guid>
		<description>is there a way to say if it doesn&#039;t intersect ru a piece of code.Like

if (enemyBR.Doesn&#039;t_Intersect(missileBR))
{
    if (keyboardState.IsKeyDown(Keys.A))
{
ball1Position.X -= 10;
}   
}</description>
		<content:encoded><![CDATA[<p>is there a way to say if it doesn&#8217;t intersect ru a piece of code.Like</p>
<p>if (enemyBR.Doesn&#8217;t_Intersect(missileBR))<br />
{<br />
    if (keyboardState.IsKeyDown(Keys.A))<br />
{<br />
ball1Position.X -= 10;<br />
}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmeth</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-1953</link>
		<dc:creator>Jimmeth</dc:creator>
		<pubDate>Tue, 26 Apr 2011 03:05:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-1953</guid>
		<description>Thanks! It worked :D</description>
		<content:encoded><![CDATA[<p>Thanks! It worked :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nazeeh</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-1948</link>
		<dc:creator>nazeeh</dc:creator>
		<pubDate>Mon, 25 Apr 2011 17:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-1948</guid>
		<description>hmm....yeah... you&#039;re drawing the ball first, then covering it with the background, then witht he bler. Draw the background first, then the bler then the ball and see if it fixes it :)</description>
		<content:encoded><![CDATA[<p>hmm&#8230;.yeah&#8230; you&#8217;re drawing the ball first, then covering it with the background, then witht he bler. Draw the background first, then the bler then the ball and see if it fixes it :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmeth</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-1945</link>
		<dc:creator>Jimmeth</dc:creator>
		<pubDate>Mon, 25 Apr 2011 00:48:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-1945</guid>
		<description>&quot;ball&quot; won&#039;t appear... Any ideas?


using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace WindowsGame1
{
    /// 
    /// This is the main type for your game
    /// 
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Texture2D ball;
        Vector2 ballPosition;
        Texture2D background;
        Texture2D bler;
        Rectangle blerBR;
        Rectangle ballBR;
        Vector2 blerPosition;

        public Game1()
        {
            

            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = &quot;Content&quot;;
            
        }

        /// 
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// 
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            if (!graphics.IsFullScreen)
                graphics.ToggleFullScreen();
            


            base.Initialize();
        }

        /// 
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// 
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ball = Content.Load(&quot;ag&quot;);
            background = Content.Load(&quot;image9&quot;);
            bler = Content.Load(&quot;bler&quot;);

            blerPosition = new Vector2(10, 10);
            ballPosition = new Vector2(50, 50);

            blerBR = new Rectangle((int)blerPosition.X, (int)blerPosition.Y, bler.Width, bler.Height);
            ballBR = new Rectangle((int)ballPosition.X, (int)ballPosition.Y, ball.Width, ball.Height);



        }

        /// 
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// 
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        /// 
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// 
        /// Provides a snapshot of timing values.
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            blerBR.X = (int)blerPosition.X;
            blerBR.Y = (int)blerPosition.Y;
            ballBR.X = (int)ballPosition.X;
            ballBR.Y = (int)ballPosition.Y;

            if (blerBR.Intersects(ballBR))
            {
                ballPosition.X -= 5;
            }





            KeyboardState Keyboardstate = Keyboard.GetState();
            if (Keyboardstate.IsKeyDown(Keys.Up))
            {
                ballPosition.Y -= 5;
            }
            if (Keyboardstate.IsKeyDown(Keys.Down))
            {
                ballPosition.Y += 5;
            }
            if (Keyboardstate.IsKeyDown(Keys.Left))
            {
                ballPosition.X -= 5;
            }
            if (Keyboardstate.IsKeyDown(Keys.Right))
            {
                ballPosition.X += 5;
            }

            base.Update(gameTime);
        }

        /// 
        /// This is called when the game should draw itself.
        /// 
        /// Provides a snapshot of timing values.
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
      Rectangle rect;

        rect.X = 0;

      rect.Y = 0;

       rect.Width = graphics.GraphicsDevice.Viewport.Width;

       rect.Height = graphics.GraphicsDevice.Viewport.Height;

            spriteBatch.Begin();
            spriteBatch.Draw(ball, ballPosition, Color.White);
            spriteBatch.Draw(background, rect, Color.Tomato);
            spriteBatch.Draw(bler, blerPosition, Color.White);
            spriteBatch.End();




            base.Draw(gameTime);
        }
    }
}</description>
		<content:encoded><![CDATA[<p>&#8220;ball&#8221; won&#8217;t appear&#8230; Any ideas?</p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using Microsoft.Xna.Framework;<br />
using Microsoft.Xna.Framework.Audio;<br />
using Microsoft.Xna.Framework.Content;<br />
using Microsoft.Xna.Framework.GamerServices;<br />
using Microsoft.Xna.Framework.Graphics;<br />
using Microsoft.Xna.Framework.Input;<br />
using Microsoft.Xna.Framework.Media;<br />
using Microsoft.Xna.Framework.Net;<br />
using Microsoft.Xna.Framework.Storage;</p>
<p>namespace WindowsGame1<br />
{<br />
    ///<br />
    /// This is the main type for your game<br />
    ///<br />
    public class Game1 : Microsoft.Xna.Framework.Game<br />
    {</p>
<p>        GraphicsDeviceManager graphics;<br />
        SpriteBatch spriteBatch;<br />
        Texture2D ball;<br />
        Vector2 ballPosition;<br />
        Texture2D background;<br />
        Texture2D bler;<br />
        Rectangle blerBR;<br />
        Rectangle ballBR;<br />
        Vector2 blerPosition;</p>
<p>        public Game1()<br />
        {</p>
<p>            graphics = new GraphicsDeviceManager(this);<br />
            Content.RootDirectory = &#8220;Content&#8221;;</p>
<p>        }</p>
<p>        ///<br />
        /// Allows the game to perform any initialization it needs to before starting to run.<br />
        /// This is where it can query for any required services and load any non-graphic<br />
        /// related content.  Calling base.Initialize will enumerate through any components<br />
        /// and initialize them as well.<br />
        ///<br />
        protected override void Initialize()<br />
        {<br />
            this.IsMouseVisible = true;</p>
<p>            if (!graphics.IsFullScreen)<br />
                graphics.ToggleFullScreen();</p>
<p>            base.Initialize();<br />
        }</p>
<p>        ///<br />
        /// LoadContent will be called once per game and is the place to load<br />
        /// all of your content.<br />
        ///<br />
        protected override void LoadContent()<br />
        {<br />
            // Create a new SpriteBatch, which can be used to draw textures.<br />
            spriteBatch = new SpriteBatch(GraphicsDevice);</p>
<p>            ball = Content.Load(&#8221;ag&#8221;);<br />
            background = Content.Load(&#8221;image9&#8243;);<br />
            bler = Content.Load(&#8221;bler&#8221;);</p>
<p>            blerPosition = new Vector2(10, 10);<br />
            ballPosition = new Vector2(50, 50);</p>
<p>            blerBR = new Rectangle((int)blerPosition.X, (int)blerPosition.Y, bler.Width, bler.Height);<br />
            ballBR = new Rectangle((int)ballPosition.X, (int)ballPosition.Y, ball.Width, ball.Height);</p>
<p>        }</p>
<p>        ///<br />
        /// UnloadContent will be called once per game and is the place to unload<br />
        /// all content.<br />
        ///<br />
        protected override void UnloadContent()<br />
        {<br />
            // TODO: Unload any non ContentManager content here<br />
        }</p>
<p>        ///<br />
        /// Allows the game to run logic such as updating the world,<br />
        /// checking for collisions, gathering input, and playing audio.<br />
        ///<br />
        /// Provides a snapshot of timing values.<br />
        protected override void Update(GameTime gameTime)<br />
        {<br />
            // Allows the game to exit<br />
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)<br />
                this.Exit();</p>
<p>            blerBR.X = (int)blerPosition.X;<br />
            blerBR.Y = (int)blerPosition.Y;<br />
            ballBR.X = (int)ballPosition.X;<br />
            ballBR.Y = (int)ballPosition.Y;</p>
<p>            if (blerBR.Intersects(ballBR))<br />
            {<br />
                ballPosition.X -= 5;<br />
            }</p>
<p>            KeyboardState Keyboardstate = Keyboard.GetState();<br />
            if (Keyboardstate.IsKeyDown(Keys.Up))<br />
            {<br />
                ballPosition.Y -= 5;<br />
            }<br />
            if (Keyboardstate.IsKeyDown(Keys.Down))<br />
            {<br />
                ballPosition.Y += 5;<br />
            }<br />
            if (Keyboardstate.IsKeyDown(Keys.Left))<br />
            {<br />
                ballPosition.X -= 5;<br />
            }<br />
            if (Keyboardstate.IsKeyDown(Keys.Right))<br />
            {<br />
                ballPosition.X += 5;<br />
            }</p>
<p>            base.Update(gameTime);<br />
        }</p>
<p>        ///<br />
        /// This is called when the game should draw itself.<br />
        ///<br />
        /// Provides a snapshot of timing values.<br />
        protected override void Draw(GameTime gameTime)<br />
        {<br />
            GraphicsDevice.Clear(Color.CornflowerBlue);<br />
      Rectangle rect;</p>
<p>        rect.X = 0;</p>
<p>      rect.Y = 0;</p>
<p>       rect.Width = graphics.GraphicsDevice.Viewport.Width;</p>
<p>       rect.Height = graphics.GraphicsDevice.Viewport.Height;</p>
<p>            spriteBatch.Begin();<br />
            spriteBatch.Draw(ball, ballPosition, Color.White);<br />
            spriteBatch.Draw(background, rect, Color.Tomato);<br />
            spriteBatch.Draw(bler, blerPosition, Color.White);<br />
            spriteBatch.End();</p>
<p>            base.Draw(gameTime);<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nazeeh</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-1777</link>
		<dc:creator>nazeeh</dc:creator>
		<pubDate>Fri, 18 Mar 2011 08:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-1777</guid>
		<description>You need to do a spritebatch.begin first, then draw, then end :)</description>
		<content:encoded><![CDATA[<p>You need to do a spritebatch.begin first, then draw, then end :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reisuke</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-587</link>
		<dc:creator>Reisuke</dc:creator>
		<pubDate>Fri, 08 Jan 2010 18:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-587</guid>
		<description>nazeeh, if you don`t mind help me out a bit here.
Does this look ok for the kind of class you were saying? If so, how will I use it in my code exactly? Cause, i`ve tried it, and I get no errors compiling, but I can`t see it drawn, even though I added the draw command.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;


namespace When_Things_Collide_We_Detect
{
    class CollidingSprite
    {
        private Rectangle bounds;
        public Vector2 Position = new Vector2(0, 0);
        private Texture2D cSpriteTexture;

        public void LoadContent(ContentManager theContentManager, string theAssetName)
        {
            cSpriteTexture = theContentManager.Load(theAssetName);
            bounds = new Rectangle(0, 0, cSpriteTexture.Width, cSpriteTexture.Height);
        }

        public void Draw(SpriteBatch theSpriteBatch)
        {
            theSpriteBatch.Draw(cSpriteTexture, Position, new Rectangle(0, 0, cSpriteTexture.Width, cSpriteTexture.Height), Color.Red, 0.0f, new Vector2(cSpriteTexture.Width / 2, cSpriteTexture.Height / 2), 0.0f, SpriteEffects.None, 0);
        }
    }
}</description>
		<content:encoded><![CDATA[<p>nazeeh, if you don`t mind help me out a bit here.<br />
Does this look ok for the kind of class you were saying? If so, how will I use it in my code exactly? Cause, i`ve tried it, and I get no errors compiling, but I can`t see it drawn, even though I added the draw command.</p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using Microsoft.Xna.Framework;<br />
using Microsoft.Xna.Framework.Content;<br />
using Microsoft.Xna.Framework.Graphics;</p>
<p>namespace When_Things_Collide_We_Detect<br />
{<br />
    class CollidingSprite<br />
    {<br />
        private Rectangle bounds;<br />
        public Vector2 Position = new Vector2(0, 0);<br />
        private Texture2D cSpriteTexture;</p>
<p>        public void LoadContent(ContentManager theContentManager, string theAssetName)<br />
        {<br />
            cSpriteTexture = theContentManager.Load(theAssetName);<br />
            bounds = new Rectangle(0, 0, cSpriteTexture.Width, cSpriteTexture.Height);<br />
        }</p>
<p>        public void Draw(SpriteBatch theSpriteBatch)<br />
        {<br />
            theSpriteBatch.Draw(cSpriteTexture, Position, new Rectangle(0, 0, cSpriteTexture.Width, cSpriteTexture.Height), Color.Red, 0.0f, new Vector2(cSpriteTexture.Width / 2, cSpriteTexture.Height / 2), 0.0f, SpriteEffects.None, 0);<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reisuke</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-586</link>
		<dc:creator>Reisuke</dc:creator>
		<pubDate>Fri, 08 Jan 2010 16:05:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-586</guid>
		<description>Sorry, not really. I`m really new to coding so I can`t imagine how I would do it. Anyway, thanks :)</description>
		<content:encoded><![CDATA[<p>Sorry, not really. I`m really new to coding so I can`t imagine how I would do it. Anyway, thanks :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nazeeh</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-584</link>
		<dc:creator>nazeeh</dc:creator>
		<pubDate>Fri, 08 Jan 2010 00:59:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-584</guid>
		<description>Hey Reisuke,

What I mean by that is that you create a Class for your game objects that includes everything they need. So that class would include a member variable that stores the Texture2D for that creature. It would also include a member variable of type Rectangle that is its BoundingRectange, etc. 

Then you can have a Update method in that class that you call in the game&#039;s Update method. The per class Update method would do move the creature around, move the bounding rectangle along with it, etc... 

Hope that makes some sense.</description>
		<content:encoded><![CDATA[<p>Hey Reisuke,</p>
<p>What I mean by that is that you create a Class for your game objects that includes everything they need. So that class would include a member variable that stores the Texture2D for that creature. It would also include a member variable of type Rectangle that is its BoundingRectange, etc. </p>
<p>Then you can have a Update method in that class that you call in the game&#8217;s Update method. The per class Update method would do move the creature around, move the bounding rectangle along with it, etc&#8230; </p>
<p>Hope that makes some sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reisuke</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-583</link>
		<dc:creator>Reisuke</dc:creator>
		<pubDate>Thu, 07 Jan 2010 12:02:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-583</guid>
		<description>How exactly can I create a container object for that?
Sorry if the question is stupid, but I just want to know how it`s done. By the way, great tutorials!</description>
		<content:encoded><![CDATA[<p>How exactly can I create a container object for that?<br />
Sorry if the question is stupid, but I just want to know how it`s done. By the way, great tutorials!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nazeeh</title>
		<link>http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/comment-page-1/#comment-129</link>
		<dc:creator>nazeeh</dc:creator>
		<pubDate>Thu, 03 Jan 2008 17:24:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.nazspace.com/wp/2008/01/02/when-things-collide-we-detect/#comment-129</guid>
		<description>Thanks KaBaL :) That&#039;s a good one. I put it as part of the post. Keep&#039;em coming :)</description>
		<content:encoded><![CDATA[<p>Thanks KaBaL :) That&#8217;s a good one. I put it as part of the post. Keep&#8217;em coming :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

