Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Mar 2013
Offline Last Active Jul 17 2015 02:34 PM

#5205577 Creating a game with Python

Posted by on 20 January 2015 - 11:43 AM

I can recommend pySFML. It's  a binding of popular SFML C++ library.


For source code, you can lurk github.com. There're many projects, small and big, you will surely find some reference there.

#5187730 Can you give me an example shows the meaning of the concept?

Posted by on 17 October 2014 - 04:23 PM

Sorry for hard understanding smile.png



stop apologizing, just get your shit together, geez...

#5181693 What happen if "self" in second argument

Posted by on 20 September 2014 - 06:15 AM

Hello there.


Quick question: are you familiar with OOP?


'self.' is just a pythonic way of saying member of a class, or more like an instance of a class


Really quick comparison:

class jedi
    int force;
    double lightsaber;
class jedi(object):
    def __init__(self):
        self.force = 0
        self.lightsaber = 0

In both cases force and lightsaber are class members, each instance of jedi will have their own force and lightsaber.



and python is designed that you need to pass 'self' (class instance) to its method among other arguments.

#5181621 Can you explain to me this code !

Posted by on 19 September 2014 - 03:06 PM

when you type 100

it will check  if the number has 1 or 0

1. The script works fine, deal with it.

2. Try using 'print' on every variable that you're not sure on what value it is.

3. Your posts will keep getting downvoted as long as they doesn't contain any useful information/doesn't improve the discussion, etc. In simple words: you're spamming.


I'm done. good luck with your learning.

#5181492 Can you explain to me this code !

Posted by on 19 September 2014 - 03:31 AM

Lysy i read the code!!

ok i need answer for this question to be sure !

Try to type 100 you will get 
You greedy bastard! Good job!
that's mean 
dead("You greedy bastard!")
& i should get that 
if "0" in choice or "1" in choice:
how_much = int(choice)


Sorry for hard understanding


Yes, this is correct, why you need to ask such a trivial question, when you can just run the code to be sure. It seems futile trying to help you out.

#5181352 Can you explain to me this code !

Posted by on 18 September 2014 - 02:15 PM


55 isn't less than 50 so when we don't get dead("You greedy bastard!")

def dead(why):
    print why, "Good job!"

exit(0) ends up a script.


Please, read code first, google/bing it later.

#5181339 Can you explain to me this code !

Posted by on 18 September 2014 - 01:22 PM

    if "0" in choice or "1" in choice:
        how_much = int(choice)
        dead("Man, learn to type a number.")

That is a correct result for your input. Study this if-else clause, google/bing on what type raw_input returns, and how does 'in' keyword works on whatever type the 'choice' variable is.

#5181333 Can you explain to me this code !

Posted by on 18 September 2014 - 12:59 PM

Hi there.


This code is really simple, tell us explicitly which line do you have trouble understanding? raw_input? int()? if else? def? We cannot help you that way, and it's not the first time you know.

And yeah it works, it's copy-pasted from some tutorial if I recall.

#5180279 Where to Begin?

Posted by on 14 September 2014 - 11:44 AM

Here you go, FAQ:


#5175046 Strange output when writing to a file object and printing it out

Posted by on 20 August 2014 - 10:18 AM

Programming is just another name for 'problem solving'.

You should learn to solve problems by yourself, only this way you will become a programmer.


You don't need to hurry, it seems that you see something strange in your code/output, and you're posting a question here seconds later. This is just WRONG.

When you've got problem, consider at least googling it first. Experiment, try to solve it somehow. Have you solved any programming problem by yourself? Have you even tried?

Because when you solve a problem by yourself, that's where the satisfaction hits. Right now you're just copy/pasting code, not programming. Many users gave you many good advices here so far, yet you seem to ignore them all, and just waiting for your programming problems to be solved by someone else. You won't get any further if you keep doing it that way.


My advice:

Try not posting you problems here for a few days. and solve them on your own.

#5174539 Help me, i can't understand well :)

Posted by on 18 August 2014 - 02:37 PM

Yep. You should take it slow. There is no hurry.



i wrote it the topic & i continue trying to to understand it i was going to see at night my understanding was right or not but now i i think i understand i take long time to understand but i think that's not problem right ?&i will try to write the code with myself it will be hard but i will write it


Best way to be sure, that you understand a piece of code, is to modify it, so it does something different. If it does what you thought it would do, you can assume that you understand that particular piece of code.

#5174284 list index out of Range

Posted by on 17 August 2014 - 10:26 AM



sry what should i do to ask  !?


Simple 'Hi, I got a little problem here, can you help me?', then explain problem in few words, attach screens and code if needed.

Also, to be honest, as much as I want to help you, I just cannot go through posts with almost none punctuation, and forms like 'u' instead od 'you'.

You're learning Python, you should already know that readability matters!


Enough with this offtopic.

#5174246 list index out of Range

Posted by on 17 August 2014 - 05:19 AM

Also, simply pasting code and screenshot is not the most polite way of asking for help.

#5174088 problem while setup the py2exe(not found in the registry )

Posted by on 16 August 2014 - 08:13 AM

Well, did you install Python 2.7? There is a difference between Python 3.x and Python 2.x

But if you did install Python 2.7, my guess would be check if you got x32 or x64 version, and compare it with version of py2exe installer you downloaded.

#5172318 buttons that have a render method

Posted by on 08 August 2014 - 11:20 AM


Sorry Lysy what I want to know is am I doing what you would do to create components for a UI on a game that uses a loop for updating and rendering objects to the screen.  Is there another way to make UI's for this type of game since the screen is getting redrawn 60 times a second or whatever I have it limited to.  I just want to know the correct way to do it.


Yeah, you're doing it right. All the elements that render on screen should be called in a game loop. I think you should also do some research on 'state machines'. You will be able to create menu, game screen and many others, and your code will stay clear and will attract females.


Also I recommend this famous article about managing game loop: