Jump to content

I'm not a python dev, but a good rule of programming is that classes aren't a bad idea. Organization in your code makes it easier to understand and be read at a later point. Don't worry as much about "minimizing" your code. The line count doesn't matter nearly as much as the quality of the code. Also, comments. You can't go wrong with commenting everything.

 

I've had several projects that I worked on, but didn't comment. When I went back to them a few months later, I barely understood my own code.

I might be wrong.

Link to post
Share on other sites

If you want to make it more modular, you should store game events in external scripts instead of hard-coding them into the main program This allows you to have a main engine that you don't have to modify to add new content. For example, have one main death event handler that can be executed differently depending on what the event is.

 

for a project of this size, however, I don't know how much that'd matter, but if you are considering adding a substantial amount of content to this, that would probably be a good thing to do. Try to reuse code as much as possible. 

 

Also, comment your code.

Link to post
Share on other sites

Lines 186 - 230 are copypaste from 46-90.

 

Personally, I would separate the commands to a file of their own. And the story elements should be in text files that the main program reads appropriately.

 

Also, since you have stats, your earliest working prototype should demonstrate where and how they are used. Currently, your strength and attack stats are not used anywhere. And honestly, your "haskey" stat is a bit unnecessary, since you never properly use it.

 

Other than that, you really should start by having a single story path that goes from start to finish. You can add the branches later, as long as you have a diagram of them. Which you really should have already.

 

If this is a school project: Don't look at the amount of lines in your main program. Ideally, your main program will just act as a hub that accesses multiple other files.

I own and use, sorted from newest to oldest: SteelSeries 6Gv2. Microsoft SideWinder X4. Mionix Naos 7000. Zowie EC1 Evo. Microsoft SideWinder X8. Microsoft IntelliMouse Explorer 3.0. Dell U2414H. Samsung P2270H. AKG K273 Pro. Sennheiser HD555. Razer Goliathus Speed Medium. Func 1030 L. Qpad CT Medium.

I used to own: Razer DeathAdder 3G. Razer Krait. IntelliMouse Optical 1.1. SteelSeries QcK.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×