[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Declaring variables in function as if at code's line-level



That is not true, Ryan. I am currently making a game with Python and
Pygame, and my question is directly related with its development.

On 3/10/12, Ryan Hope <rmh3093@xxxxxxxxx> wrote:
> Why is this even be talked about on the pygame ml? This has nothing to
> do with pygame.
>
> On Sat, Mar 10, 2012 at 6:30 PM, Brian Brown <brobab@xxxxxxxxx> wrote:
>> Hi pygame users, just a simple question-- How can one cause variables
>> at "function-level" to behave like variables at "line-level"? (With
>> basic python code) I just want to avoid using "global" over and over
>> again (in many different functions) while I want to declare, use, and
>> delete all my game's variables inside functions.Thanks.
>>
>> It should make my program very simple and straight-forward if I could
>> do this. (As I have explained in the previous replies to this thread)
>> I would like to know how it can be done-- without immature,
>> unproductive statements like:
>> "Don't freak out at the fact that I used the "class" keyword."
>> Thank you.
>>
>> Matt
>>
>> On 3/10/12, Brian Brown <brobab@xxxxxxxxx> wrote:
>>> That is not true, Chris.
>>>
>>> On 3/10/12, Christopher Arndt <chris@xxxxxxxxxxxxx> wrote:
>>>> On 10.03.2012 23:35, Christopher Night wrote:
>>>>>     DO:
>>>>>     * Access variables.
>>>>>       (Move game according to current-variable-status and player-input)
>>>>>
>>>>>     * Output to graphics and sound card.
>>>>>       (Display game according to current-variable-status.)
>>>>>     LOOP
>>>>>
>>>>>     That's really all we need.
>>>>
>>>> Who's this "we"? Certainly doesn't include me, because I need *a lot*
>>>> more from a programming language.
>>>>
>>>> Brian, I think you should read a bit about namespaces and why they are a
>>>> good thing. You won't get very far with Python with your point of view -
>>>> or in any other programming language for that matter (except maybe PHP -
>>>> just kidding ;) ).
>>>>
>>>>
>>>> Chris
>>>>
>>>
>
>
>
> --
> Ryan Hope, M.S.
> CogWorks Lab
> Department of Cognitive Science
> Rensselaer Polytechnic Institute
>