I kind of do that now, but with user defined types, but it would be nice to 
use classes more.  do loops are your friend.  :P

----- Original Message ----- 
From: "Thomas Ward" <[EMAIL PROTECTED]>
To: "Gamers Discussion list" <[email protected]>
Sent: Monday, June 12, 2006 1:01 PM
Subject: Re: [Audyssey] AutoIt in game development was Re: Rail Racer mouse


> Hi, Liam.
> When you do make the jump from VB to something else just know languages,
> the good ones, now use an oop design structure. I personally can't live
> without object oriented programming in games. It makes programming much
> easier, you can re use code much easier, any changes made to the
> underlying class can effect one or more classes and objects, and well it
> is just plane better.
> Think about a small example to get your thoughts flowing on how cool
> this is.
> Let's say you have a spaceship game and you want to have a procedure,
> method, function, sub whatever you want to call it that updates the
> shields on every friendly and enemy ship in the game. There is a hard
> way to do this and an easy way to do this. So let's compare the two.
>
> In structured programs, one not using oop, you might write a procedure
> that does something like this
>
> Sub UpdateShields()
> if(shipShields1 < 100)
> shipShields1 = 100
> End If
> if(shipShields2 < 100)
> shipShields2 = 100
> End If
> End Sub
>
>
> If you never used an object oriented design you might think the above
> sub was really cool. Sure it works, but if you have several enemy ships
> you are going to be testing every ship, and coding your brains out when
> you can write one if statement in VB .net and update all ships at once.
> Now, look at a cleaner way of doing this.
>
> class Ship
>
> ' ship shield variable
> Private shipShields As Integer
>
> ' Update all ships shields
> Public Sub UpdateShields()
> if(shipShields  < 100)
> shipShields = 100
> End If
> End Sub
> End Class
>
> On the surface of this you are probably wondering what is the point of
> this class, and how do I save time, coding, whith this. Ok, lets say you
> have several objects labeled ship1 through ship5. Let's show you how to
> update them quickly.
>
> ' Check to see if shields
> ' are at 100 for all ships
> public Sub ChargeShields()
> ship1.UpdateShields()
> ship2.UpdateShields()
> ship3.UpdateShields()
> ship4.UpdateShields()
> ship5.UpdateShields()
> End Sub
>
> For this simple example the point might not seam so big a deal. However,
> when you work with massive programs where several things need updated
> from lasers, shields, missiles, whatever an oop design pays off in the
> end. You end up saving time coding, the code is cleaner, and instead of
> an update function which checks every ships shield variable directly it
> is up to the class to do that for you.
> Not only that. You can take this class file and rename it, modify it,
> and use it it in your next game project. You can also use it hole if
> your game is an other spaceship style game. All the code is there, and
> all you have to do is reference the class by creating objects to access
> the data.
>
>
> _______________________________________________
> Gamers mailing list .. [email protected]
> To unsubscribe send E-mail to [EMAIL PROTECTED] You can 
> visit
> http://audyssey.org/mailman/listinfo/gamers_audyssey.org to make
> any subscription changes via the web.
>
> 


_______________________________________________
Gamers mailing list .. [email protected]
To unsubscribe send E-mail to [EMAIL PROTECTED] You can visit
http://audyssey.org/mailman/listinfo/gamers_audyssey.org to make
any subscription changes via the web.

Reply via email to