Community

AS3 New Class Question

Posted Jun 27, '09 at 5:33am

kevinseven11

kevinseven11

37 posts

Iron - Serf

To my understanding you dont even have to make your own class, but it will just make the code run smoother? It sounds wrong but Im not sure.
Thanks.

Posted Jun 27, '09 at 2:07pm

Captain_J_Sheridan

Captain_J_Sheridan

319 posts

Wood - Squire

Although I don't see the logic, but just like in C++, it's probably faster, or else, why go trough all the trouble?

 

Posted Jun 27, '09 at 4:44pm

dank

dank

1,007 posts

Gold - Lord

Moderator

Why would you ever want to make a game without the use of classes? Its one of the many reasons why game programmers use OO languages.

 

Posted Jun 27, '09 at 5:38pm

Captain_J_Sheridan

Captain_J_Sheridan

319 posts

Wood - Squire

I guess he's talking of making his own class

I don't get the logic, you spend more lines and have to make a call for an external resource, how can it be faster?

 

Posted Jun 28, '09 at 5:06pm

Kurt5

Kurt5

26 posts

Wood - Squire

From what I get, making your own classes in AS3 simply makes the code or game or whatever run faster and avoid any errors because things are spelt out within the actions. I'm still learning but, most of what I understand so far says there not nescesary but usefull.

 

Posted Jun 28, '09 at 6:50pm

kevinseven11

kevinseven11

37 posts

Iron - Serf

okay so the whole

package kevinseven11spackage  {
   public class kevinclass {
//Blah blah
                           }
                              }

is kinda an option to learn becuase cant you just use the built in ones for literly everything?

 

Posted Jun 28, '09 at 7:23pm

dank

dank

1,007 posts

Gold - Lord

Moderator

Yes, kinda, but AS3 is OO for a reason, plus it's a lot more efficient to write and debug code that has been properly written using OO programming methods. Before you think of coding any sizable game (anything over 200 lines), you should know what objects, classes, packages, interfaces, inheritance, encapsulation, and polymorphism are how to implement them.

 

Posted Jun 28, '09 at 8:34pm

jdoggparty

jdoggparty

1,862 posts

Wood - Prince

It does run a lot faster when you make your own class. It's weird/

 

Posted Jun 29, '09 at 6:26am

PixelSmash

PixelSmash

341 posts

Gold - Squire

I don't know about speed, but the idea behind OOP is that you can reuse programming / classes. Good OOP can use 30-60% more time to write, but it's easier to debug, and when written right, it can be reused often - which saves time on a new project.

 

Posted Jun 29, '09 at 1:52pm

herofmb

herofmb

32 posts

Iron - Serf

Like Dank and PixelSmash said, by fully using OOP features, your code will be easyer to write, debug and reuse. But all these facilities have a price. To implement objects, their methods and atributes, you'll need tables in memory to store what methods and atributes belongs to what objects, and so on. That means that a non-OOP language, like C, is faster and needs less memory usage, but it is also more complicated to write complex code. That's why, even having to pay the price for the OOP, large companyes develop their softwares using OOP languages.

 

Posted Jun 30, '09 at 12:24am

kevinseven11

kevinseven11

37 posts

Iron - Serf

alright thanks guys, I guess I will learn more about classes and more.
Thanks.

 
Reply to AS3 New Class Question

You must be logged in to post a reply!