Intermediate tutorial 1

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Intermediate tutorial 1

Post by Asimov » July 14th, 2012, 12:00 pm

Hi Chilli,

Last night I watched a little more of the class tutorial.

I still don't understand why there is a class inside a class.

There is a class scoreboard and inside that class is a class score.

Why don't you just make a class called score, and not bother with scoreboard.
The scoreboard class does not seem to be needed except as a wrapper for the inside class.

Am I missing something?

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Intermediate tutorial 1

Post by chili » July 14th, 2012, 1:56 pm

There is no real reason to put the scoreboard inside of the game class.
In fact, it would be better to put it in a separate file, that way it would be even easier to reuse it in a number of projects.

However, it is most definately preferable to have a scoreboard class which contains a private internal score class. Think about the recursion. There are tasks that take place on every iteration of the recursion, and then there are tasks that happen only at the beginning or the end of the recursion (special cases). The wrapper class handles those very nicely. It also manages the anchor pointer to the first element of the list, holds the name of the file on disk, and completely hides the fact that a linked list is being used from the client (in this case the game class).
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Intermediate tutorial 1

Post by Asimov » July 14th, 2012, 2:58 pm

Hi Chillie,

Thanks for the explanation. I have watched all your videos so far, and this is basically the the first one that I am finding hard to get a grip on. Going to carry on watching though. I will probably have a scoreboard in my game later.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Intermediate tutorial 1

Post by chili » July 14th, 2012, 3:20 pm

Don't worry too much about it brah, as long as you got the basic syntax down that's enough for now. We are going to be using classes A LOT after I explain the framework, so you'll have plenty opportunities to see how systems can be crafted using them.
Chili

Post Reply