Author Topic: [Python]Text based game based on the movie "Saw"  (Read 1734 times)

0 Members and 1 Guest are viewing this topic.

Offline hanorotu

  • Dj Rapture
  • VIP
  • Majesty
  • *
  • Posts: 1173
  • Cookies: 98
  • ( ͡° ʖ ͡°)
    • View Profile
    • Rapture
[Python]Text based game based on the movie "Saw"
« on: 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.


Life is hard, then you get buried.
If you want to use my work all of my music is licensed under GNU General Public License v3 (GPL-3) - http://bit.ly/TfUOBA

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python]Text based game based on the movie "Saw"
« Reply #1 on: August 20, 2012, 11:22:25 pm »
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
Blog: rexmckinnon.tumblr.com

Offline hanorotu

  • Dj Rapture
  • VIP
  • Majesty
  • *
  • Posts: 1173
  • Cookies: 98
  • ( ͡° ʖ ͡°)
    • View Profile
    • Rapture
Re: [Python]Text based game based on the movie "Saw"
« Reply #2 on: August 20, 2012, 11:24:23 pm »
Awesome! I think this is going to be a lot of if/elses xD


Life is hard, then you get buried.
If you want to use my work all of my music is licensed under GNU General Public License v3 (GPL-3) - http://bit.ly/TfUOBA

Offline Daemon

  • VIP
  • Baron
  • *
  • Posts: 845
  • Cookies: 153
  • A wise man fears a gentle mans anger
    • View Profile
Re: [Python]Text based game based on the movie "Saw"
« Reply #3 on: August 21, 2012, 12:47:44 am »
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
This lifestyle is strictly DIY or GTFO - lucid

Because sexploits are for h0edays - noncetonic


Xires burns the souls of HF skids as a power supply

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python]Text based game based on the movie "Saw"
« Reply #4 on: August 21, 2012, 01:23:07 am »
Awesome! I think this is going to be a lot of if/elses xD


Bad Idea. js
Blog: rexmckinnon.tumblr.com

Offline lucid

  • #Underground
  • Titan
  • **
  • Posts: 2683
  • Cookies: 243
  • psychonaut
    • View Profile
Re: [Python]Text based game based on the movie "Saw"
« Reply #5 on: August 21, 2012, 02:09:28 am »
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.
« Last Edit: August 21, 2012, 02:10:29 am by lucid »
"Hacking is at least as much about ideas as about computers and technology. We use our skills to open doors that should never have been shut. We open these doors not only for our own benefit but for the benefit of others, too." - Brian the Hacker

Quote
15:04  @Phage : I'm bored of Python

Offline hanorotu

  • Dj Rapture
  • VIP
  • Majesty
  • *
  • Posts: 1173
  • Cookies: 98
  • ( ͡° ʖ ͡°)
    • View Profile
    • Rapture
Re: [Python]Text based game based on the movie "Saw"
« Reply #6 on: August 21, 2012, 02:43:38 am »
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.
« Last Edit: August 21, 2012, 02:56:51 am by hanorotu »


Life is hard, then you get buried.
If you want to use my work all of my music is licensed under GNU General Public License v3 (GPL-3) - http://bit.ly/TfUOBA

Offline hanorotu

  • Dj Rapture
  • VIP
  • Majesty
  • *
  • Posts: 1173
  • Cookies: 98
  • ( ͡° ʖ ͡°)
    • View Profile
    • Rapture
Re: [Python]Text based game based on the movie "Saw"
« Reply #7 on: August 22, 2012, 12:43:44 am »
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


Life is hard, then you get buried.
If you want to use my work all of my music is licensed under GNU General Public License v3 (GPL-3) - http://bit.ly/TfUOBA

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [Python]Text based game based on the movie "Saw"
« Reply #8 on: August 22, 2012, 02:02:37 am »
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.
>>>import this
-----------------------------

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python]Text based game based on the movie "Saw"
« Reply #9 on: August 22, 2012, 09:02:24 am »
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 if Curses is too hard.

Offline hanorotu

  • Dj Rapture
  • VIP
  • Majesty
  • *
  • Posts: 1173
  • Cookies: 98
  • ( ͡° ʖ ͡°)
    • View Profile
    • Rapture
Re: [Python]Text based game based on the movie "Saw"
« Reply #10 on: August 22, 2012, 12:33:28 pm »
Thanks all. Ill work on it


Life is hard, then you get buried.
If you want to use my work all of my music is licensed under GNU General Public License v3 (GPL-3) - http://bit.ly/TfUOBA