disappointed with my code

Bill Baxter dnewsgroup at billbaxter.com
Mon Mar 17 20:16:27 PDT 2008


Saaa wrote:
>> Is there really nothing you can give as an example?
>>
>> Are you writing in a procedural style?  OO-style?  What is it you don't 
>> like about your code?  Are you repeating yourself a lot?  Do interfaces 
>> between components seem to be too confusing or reveal too much 
>> implementation detail?  Say more about what sorts of problems you have.
>>
>> --bb
> 
> No OO, all procedural I think.
> Lets just say I write in a C-style in D.
> Just recently I included the use of packages.
> 
> I think my main problem is that my program goes through a certain amount of 
> stages (game) but all I could come up with is:
> enum { INTRO, LEVEL_1, LEVEL_2,etc}
> and everywhere do things like this:
> if(stage==LEVEL_1 || stage==LEVEL_2) ...
> 
> A lot of times do things need to wait a few iterations, which I solve by 
> adding local variables which count till zero.
> 
> I expect that with every 'oh is that possible' reply' my code will be a lot 
> more pleasing. 

Ah, game code.  Well I'll let the game programming folks take this one, 
then.  ;-)

If you can't show your code, then perhaps the best thing you can do is 
to read the code of existing games that people have made with D.  I know 
Kenta Cho has code you can look at 
(http://www.asahi-net.or.jp/~cs8k-cyu/index_e.html).

Probably others can suggest examples of what they think are nicely coded 
games in D.

--bb


More information about the Digitalmars-d-learn mailing list