EvilZone
Programming and Scripting => Projects and Discussion => : hanorotu August 20, 2012, 10:57:54 PM
-
I have learned a lot about python in the past 2 or three days. My whole weekend was nothing but studying and constantly practicing. So for my first python project I will be developing a text based game in which you have life points, different story lines (later on)
But yeah, should be fun. I will keep updated on the project here.
-
Cool. At one point I tried to make a tetris game in Python using only if/else statements...... it kinda worked..... I guess... Haha. Anyways, good luck. I will keep this post checked hardcore
-
Awesome! I think this is going to be a lot of if/elses xD
-
Instead of if/else look.to use switches (c++ word for them. Idk the python term) then make a function for each room and use the switch to change rooms. I found this to be an easy way to make the code a little more bearable
-
Awesome! I think this is going to be a lot of if/elses xD
Bad Idea. js
-
Instead of if/else look.to use switches (c++ word for them. Idk the python term) then make a function for each room and use the switch to change rooms. I found this to be an easy way to make the code a little more bearable
I second the fuck out of that. If/else statements are messy. You'll find switches are much more efficient and alot neater.
EDIT: @Daemon, I think it's probably still called switch statements. That term is used in Javascript I'm sure it's in most other languages too.
-
Alright, I'm on it. Thanks for the help! I can use all of it I can get lol
Python's lack of a 'switch' statement has garnered much discussion and even a PEP. The most popular substitute uses dictionaries to map cases to functions, which requires lots of defs or lambdas.
-
http://pastebin.com/x504jVFE
First very very rough draft of the first level. Don't ask me how to make another loop after this one for the second level cause I honestly don't know yet. I'll cross that bridge when I come to it lol
-
http://pastebin.com/x504jVFE (http://pastebin.com/x504jVFE)
First very very rough draft of the first level. Don't ask me how to make another loop after this one for the second level cause I honestly don't know yet. I'll cross that bridge when I come to it lol
Use separate classes for all elements. Player, items, rooms, etc. Then you could use one main game loop.
-
Yes, like Techb said - use Classes. It's a MUST for this kind of project.
On a side note, maybe you could make it nice looking with some colored text, using Curses, or just Urwid (http://excess.org/urwid/) if Curses is too hard.
-
Thanks all. Ill work on it