<?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: Sun Defender: Progress #2</title>
	<atom:link href="http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/</link>
	<description></description>
	<lastBuildDate>Fri, 03 Sep 2010 09:28:49 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: maggy</title>
		<link>http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/comment-page-1/#comment-18104</link>
		<dc:creator>maggy</dc:creator>
		<pubDate>Wed, 18 Aug 2010 17:47:12 +0000</pubDate>
		<guid isPermaLink="false">http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/#comment-18104</guid>
		<description>hi, i have a problem with rmca, last year i started getting airtime from them and i contacted jet to stop putting airtime into my phone but i still get the airtime now my phone has beeb barred i cannot make outgoing calls from last year May till today, i called them more than 20 times but nothing has been done.Please help me. My number is 072 728 1284.

Thanx</description>
		<content:encoded><![CDATA[<p>hi, i have a problem with rmca, last year i started getting airtime from them and i contacted jet to stop putting airtime into my phone but i still get the airtime now my phone has beeb barred i cannot make outgoing calls from last year May till today, i called them more than 20 times but nothing has been done.Please help me. My number is 072 728 1284.</p>
<p>Thanx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stoney</title>
		<link>http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/comment-page-1/#comment-1874</link>
		<dc:creator>Stoney</dc:creator>
		<pubDate>Sun, 26 Jul 2009 22:22:27 +0000</pubDate>
		<guid isPermaLink="false">http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/#comment-1874</guid>
		<description>There are few possibilites to solve your concern:
1. You need to store the indexNumber for the bullets that have been removed. That solution is not elegant and it&#039;s a lot of work, so I wouldn&#039;t recommand it. 

2. Don&#039;t remove/destroy the bullet objects when you are done with them, just fill them with an empty dummy image and dummy values. And when need the bullet again, just check if the bullet has the dummy image/values and if this is the case fill this dummy bullet object with the real values. It&#039;s not particularly a good solution either, because it can use up a lot of memory, but could be an interesting idea if you want to stick with (dynamic) arrays.

3. I just found a nice example on how to use TList: http://www.delphibasics.co.uk/RTL.asp?Name=TList. You can remove an object with yourList.Delete(indexNumber); but I&#039;m not quite sure if it reorders automatically, so you may need to use yourList.Sort(...) afterwards.

I hope that helps.</description>
		<content:encoded><![CDATA[<p>There are few possibilites to solve your concern:<br />
1. You need to store the indexNumber for the bullets that have been removed. That solution is not elegant and it&#8217;s a lot of work, so I wouldn&#8217;t recommand it. </p>
<p>2. Don&#8217;t remove/destroy the bullet objects when you are done with them, just fill them with an empty dummy image and dummy values. And when need the bullet again, just check if the bullet has the dummy image/values and if this is the case fill this dummy bullet object with the real values. It&#8217;s not particularly a good solution either, because it can use up a lot of memory, but could be an interesting idea if you want to stick with (dynamic) arrays.</p>
<p>3. I just found a nice example on how to use TList: <a href="http://www.delphibasics.co.uk/RTL.asp?Name=TList" rel="nofollow">http://www.delphibasics.co.uk/RTL.asp?Name=TList</a>. You can remove an object with yourList.Delete(indexNumber); but I&#8217;m not quite sure if it reorders automatically, so you may need to use yourList.Sort(&#8230;) afterwards.</p>
<p>I hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/comment-page-1/#comment-1845</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Sat, 25 Jul 2009 21:14:33 +0000</pubDate>
		<guid isPermaLink="false">http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/#comment-1845</guid>
		<description>Yeah, I&#039;m already using dynamic arrays &amp; objects:

pBullet = Object
         public
         x,y,xspeed,yspeed,img: integer;
    end;

{ Later on  }
if(not(firing)) then exit;
     setlength(PBullets,length(PBullets)+1);
     PBullets[length(PBullets)-1].img := 2;
     PBullets[length(PBullets)-1].x := round(x)+8;
     PBullets[length(PBullets)-1].y := round(y)+5;
     PBullets[length(PBullets)-1].xspeed := 350;
     PBullets[length(PBullets)-1].yspeed := 0;

I just haven&#039;t added anything in to check if the bullets are outside of the screen, and if they are, delete them.

The main problem I foresee is when removing the bullets - I&#039;m not sure how I&#039;d go about removing them from the array... With Java&#039;s vectors, it&#039;s easy. Just do yourVector.Remove(indexNumber); and it removes the entry at the index + reorders the vector to fill in the gap.</description>
		<content:encoded><![CDATA[<p>Yeah, I&#8217;m already using dynamic arrays &#038; objects:</p>
<p>pBullet = Object<br />
         public<br />
         x,y,xspeed,yspeed,img: integer;<br />
    end;</p>
<p>{ Later on  }<br />
if(not(firing)) then exit;<br />
     setlength(PBullets,length(PBullets)+1);<br />
     PBullets[length(PBullets)-1].img := 2;<br />
     PBullets[length(PBullets)-1].x := round(x)+8;<br />
     PBullets[length(PBullets)-1].y := round(y)+5;<br />
     PBullets[length(PBullets)-1].xspeed := 350;<br />
     PBullets[length(PBullets)-1].yspeed := 0;</p>
<p>I just haven&#8217;t added anything in to check if the bullets are outside of the screen, and if they are, delete them.</p>
<p>The main problem I foresee is when removing the bullets &#8211; I&#8217;m not sure how I&#8217;d go about removing them from the array&#8230; With Java&#8217;s vectors, it&#8217;s easy. Just do yourVector.Remove(indexNumber); and it removes the entry at the index + reorders the vector to fill in the gap.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stoney</title>
		<link>http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/comment-page-1/#comment-1801</link>
		<dc:creator>Stoney</dc:creator>
		<pubDate>Fri, 24 Jul 2009 13:13:37 +0000</pubDate>
		<guid isPermaLink="false">http://matt-shaffer.com/blog/2009/07/20/sun-defender-progress-2/#comment-1801</guid>
		<description>Nice progress so far :)
Can&#039;t wait to play it.

Just a note on your need for Java&#039;s vectors: Aren&#039;t Pascal dynamic arrays enough?
Something like following (it don&#039;t exactly how the Andorra 2D objects look like neither how you managed your classes, so it&#039;s just a simple idea):

TBullet = class
  private
    fPositon: TPoint; // or something similar
    fSprite: TSpriteObject;
  public
    constructor Create;
    procedure Draw;
    procedure Update;
end;

TPlayer = class
  private
    Bullet: array of TBullet;
    fNumber: Integer;
  public
    constructor Create;
    procedure Shoot;
    procedure Draw;
    procedure Update;
end;

TGame = class
  private
   ...
  public
    constructor Create;
    procedure Draw;
    procedure Update;
end;

procedure TBullet.Draw;
begin
  // Draw Bullet @ fPosition
end;

procedure TBullet.Update;
begin
  // Move Bullet to the right
end;

procedure TPlayer.Shoot;
begin
  fNumber := fNumber + 1;
  SetLength(Bullet, fNumber);
  Bullet[fNumber] := TBullet.Create;
end;

procedure TPlayer.Draw;
var i: Integer;
begin
  for i := 0 to High(Bullet) do Bullet.Draw;
end;

procedure TPlayer.Update;
var i: Integer;
begin
  for i := 0 to High(Bullet) do Bullet.Update;
end;

procedure TGame.Draw;
begin
  // Draw TPlayer 
end;

procedure TGame.Update;
begin
  // Collision detection
  // If bullets hit the right of the screen, destroy them
end;


Again, just an idea and not tested. It&#039;s just how I would solve this and the framework I&#039;m using would support something like that.</description>
		<content:encoded><![CDATA[<p>Nice progress so far <img src='http://matt-shaffer.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Can&#8217;t wait to play it.</p>
<p>Just a note on your need for Java&#8217;s vectors: Aren&#8217;t Pascal dynamic arrays enough?<br />
Something like following (it don&#8217;t exactly how the Andorra 2D objects look like neither how you managed your classes, so it&#8217;s just a simple idea):</p>
<p>TBullet = class<br />
  private<br />
    fPositon: TPoint; // or something similar<br />
    fSprite: TSpriteObject;<br />
  public<br />
    constructor Create;<br />
    procedure Draw;<br />
    procedure Update;<br />
end;</p>
<p>TPlayer = class<br />
  private<br />
    Bullet: array of TBullet;<br />
    fNumber: Integer;<br />
  public<br />
    constructor Create;<br />
    procedure Shoot;<br />
    procedure Draw;<br />
    procedure Update;<br />
end;</p>
<p>TGame = class<br />
  private<br />
   &#8230;<br />
  public<br />
    constructor Create;<br />
    procedure Draw;<br />
    procedure Update;<br />
end;</p>
<p>procedure TBullet.Draw;<br />
begin<br />
  // Draw Bullet @ fPosition<br />
end;</p>
<p>procedure TBullet.Update;<br />
begin<br />
  // Move Bullet to the right<br />
end;</p>
<p>procedure TPlayer.Shoot;<br />
begin<br />
  fNumber := fNumber + 1;<br />
  SetLength(Bullet, fNumber);<br />
  Bullet[fNumber] := TBullet.Create;<br />
end;</p>
<p>procedure TPlayer.Draw;<br />
var i: Integer;<br />
begin<br />
  for i := 0 to High(Bullet) do Bullet.Draw;<br />
end;</p>
<p>procedure TPlayer.Update;<br />
var i: Integer;<br />
begin<br />
  for i := 0 to High(Bullet) do Bullet.Update;<br />
end;</p>
<p>procedure TGame.Draw;<br />
begin<br />
  // Draw TPlayer<br />
end;</p>
<p>procedure TGame.Update;<br />
begin<br />
  // Collision detection<br />
  // If bullets hit the right of the screen, destroy them<br />
end;</p>
<p>Again, just an idea and not tested. It&#8217;s just how I would solve this and the framework I&#8217;m using would support something like that.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
