Trying my hand at Python (Door Game)


DOOR GAME

So, I did it. I tried out a different programming language than C# or UnityScript. The result? A game. It was written in Python. I have done Python before, but it was quite awhile ago. If you have a Python launcher you can run it from there. Please note that if you want the game’s content to be a surprise, than you will probably want to NOT open up the actual script before you play it 😉 The script is zipped in the file below, if you can handle the massive file download (sarcasm, lol):

Click to Download

The internets are a great place to learn Python 😛

Enjoy!

-SS

Advertisements

Published by

waylonlathern

(stopsecretdesign.wordpress.com) I have been doing 3d for awhile now and have become skilled in both the worlds of 3d design and game development. As such, i have created a blog to show my artistic talent and share tutorials with others :)

17 thoughts on “Trying my hand at Python (Door Game)”

  1. Finally! Someone who likes Python like I do! I am a Python programmer after all. You did enjoy coding in Python, right? 😛

    Confession: I read the code before I played it, only because I can’t run it on Android. 😛 Good concept, despite it being so… [REMOVED ON GROUNDS OF SPOLIER]. I caught a few things you might want to work on, I’ll tell you later. 😉

    Oh, yes. The web of internet sites is a great place me to learn Python. 😛

    1. It was actually pretty simple 😛 Of course I had tried it awhile back, but coming back to it, I used a few things and I got going really quickly 😛 From there it was as simple as creating some game logic 😀 As for enjoyment, I don’t remember it as really being fun, but after you come out of something as simple and powerful as Unity, chances are other forms of game development won’t be as ‘fun’ 😛 I want to learn more about it though. If I’m going to be getting a job coding in the future, it would be helpful to know a few different languages. 🙂

      1. I could say more, but here are the two top things:

        Make the user input case-insensitive, that way the user is not forced to type ‘Blue’ or ‘Red’ exactly. Do this by appending .lower() to the input check. So it changes to if chosen.lower() == 'run':. You’ll also have to make the string all lowercase too (which you’ve already done).
        Good job on using .format() to format your strings! It is the best way to do it, the end. I use it in all my code. Say… were you clicking through by Code page while writing this? Because I noticed I got lots of clicks to my code the day before you posted this… 😛

      2. I think I looked at some of your code the day I posted this, maybe I looked at it before… Thanks for the feedback though 😛 I’ll have to remember that! +1 for Python simplicity XD

      1. Oh shush Machine. 😛

        Ignore that comment, SS. He too as a Python launcher installed. He’s just too used to me confusing him as to why I code in Python and not C++ to understand others don’t know about programs such as cx_Freeze. 😛

      2. Actually Le, I’m very aware you can compile scripts into executables. I’m just wondering why you use Python for desktop applications where it’s really not “meant” to be used. There are better languages for desktop applications. Python should be used for websites that need complex scripting, like YouTube. 😛

        Learn how to use it for web development and you might actually get a job somewhere! 😛

      3. cx_Freeze…. Cool! Thanks Le! 😛 I like Python because it’s simple to use and I know how to use it. That’s about it. I do have Xcode installed though… 😛

      4. Bleh, Mac users. I actually know some Objective C and Cocoas… but no Mac to write and compile the code on. 😛 I can spend the same amount on a PC and get a GPU with 4GB of VRAM (inside joke for SS :P). Their laptops are the best though–I have yet to find laptops that match Apple’s build quality… but their desktops are just a rip-off, especially since you can buy consumer 1600p displays now. 😛

  2. I finally got around to play this Door Game. Few issues here:
    1. raw_input only works in Python 2. Python 3 uses just input. Future reference. What I said about .lower() still works.
    2. I’ll avoid talking about how the game works and spoilers. 😛
    3. I noticed you use print() (AKA the print function because of the () ) instead of the print statement (no () ). As I said in my tutorial it is not a true function. +1 for using it anyway for better Py3K compatibility.
    4. I need to write a full tut on using .format(), but it is always appended to the string itself, not the parentheses of print(). In Py3 (what I code with), I kept getting an AttributeError because print is a true function. Next time, when you use .format(), always append it directly to the string, like so:

    name = "Stopsecret"
    job = "3D artist"

    # Note .format() is attached to the string itself
    print("{0} is a long time {1}.".format(name, job))
    # Once more, without it wrapped in print
    message = "{0} is a long time {1}.".format(name, job)
    print(message)

    Do this, and you are already a better Python programer. 😉

Comments and feedback are appreciated :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s