Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Python help needed (creating small game)

I'm currently using the book "Learn Python the Hard Way" and I'm supposed to be making my own game at this point. I just have a few questions! If any experienced Python users can quickly answer them that'd be great(: skype is devonray96
I've read "Learn Python the hard way" and I didn't like it AT ALL.
I don't think it's a good python introduction book.

I have a copy of the official python tutorial, and it's really great and simple.

You can check it online at http://docs.python.org/2/tutorial/
I will check it out, thank you very much!
(Oct 28, 2013 07:48 PM)Deadmau5_ Wrote:  I've read "Learn Python the hard way" and I didn't like it AT ALL.
I don't think it's a good python introduction book.

I have a copy of the official python tutorial, and it's really great and simple.

You can check it online at http://docs.python.org/2/tutorial/

hahaha reading book titled like that for sure does not encourage me to try giving the lang a shot at. especially as a n00b
Need A Different Or A NEW PORN WEBSITE!!!WHY??

1. WE GOT PORN
2. WE GOT PORN
3. THERE IS A SPIN WHEEL!!!

Visit Mine!! BOO-TUBE
Well here is the problem I have: I am creating a small game, and I want the user to be able to pick one of two sides at the beginning of the game. For example, If it was StarWars based, I will have my main script with the intro to the game, then allow the user to raw_input if they want to play the game on the good side, or the bad side. and based on their input i want a specific script to run that has their choice of the game on it. Sorry if this is confusing...
(Oct 29, 2013 07:54 PM)DevonRay Wrote:  Well here is the problem I have: I am creating a small game, and I want the user to be able to pick one of two sides at the beginning of the game. For example, If it was StarWars based, I will have my main script with the intro to the game, then allow the user to raw_input if they want to play the game on the good side, or the bad side. and based on their input i want a specific script to run that has their choice of the game on it. Sorry if this is confusing...

I wouldn't start a game at your level yet, until you understand what classes are and how to use them properly would probably be the first place to start...

but for what you asked:
Code
def good():
  print("you picked good team!")

def evil():
  print("you picked evil team!")

choice = '':
while choice not in ["1","2"]:
  choice = raw_input("pick a side\n1. good team\n2. evil team")
if choice == "1":
  good()
elif choice == "2":
  evil()
Learn Python The Hard Way is exactly what is sounds like. Hard. What I suggest to start out with is something like scratch, or stencyl. Now I know I'm gonna get some crazy replies saying "Don't tell him to use some sort of crap program like that" but I myself still use Scratch extensively. It helps me create an idea for a game, without going to the time and effort to actually coding the whole thing from start to finish. Its also a good way to learn programming command flow, and to learn how programming works in general.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by SkidyMar 29, 2018 06:54 AM 3 164 Mar 29, 2018 06:54 AM
Last Post: .kr.
[Python] by JuiceWaterJul 11, 2017 05:54 PM 2 111 Jul 11, 2017 05:54 PM
Last Post: JuiceWater