ok, thanks! by the way, python2.6 won't let me change just one part of a
tuple...
--- On Thu, 4/9/09, Brian Song unlucky...@gmail.com wrote:
From: Brian Song unlucky...@gmail.com
Subject: Re: [pygame] move problems
To: pygame-users@seul.org
Date: Thursday, April 9, 2009, 10:26 PM
Yea... Jakes
oops... that was why my spaceship wasn't moving... lol.
--- On Thu, 4/9/09, Ian Mallett geometr...@gmail.com wrote:
From: Ian Mallett geometr...@gmail.com
Subject: Re: [pygame] move problems
To: pygame-users@seul.org
Date: Thursday, April 9, 2009, 8:53 PM
On Thu, Apr 9, 2009 at 2:48 PM, Yanom
On Thu, Apr 9, 2009 at 2:48 PM, Yanom Mobis ya...@rocketmail.com wrote:
if key[K_RIGHT]:
spaceship.speed=(spaceship.speed[0]+10, spaceship.speed[1])
print(K_RIGHT) #debug
if key[K_RIGHT]:
spaceship.speed=(spaceship.speed[0]-10, spaceship.speed[1])
Yea... Jakes method would do.. or you can just simplify it
spaceship_speed = 10
if keys[K_LEFT]:
x_move += -spaceship_speed
if keys[K_RIGHT]:
x_move += spaceship_self.speed
rect = rect.move(x_move, 0)
BTW... spaceship.speed=(spaceship.speed[0]-10, spaceship.speed[1]) is
unnecessary. No
pymike wrote:
if keys[LEFT]:
print True
This works, because you're checking to see if the 3rd numeral in the
list is positive/true.
Just a minor point - it's actually checking if the 3rd numeral is
non-zero/true.
--Mike
Have a look at my game's game.py file for your key problem.
Love,tullaris.
http://www.mediafire.com/?l4md0edjnmm
2009/2/11 Yanom Mobis ya...@rocketmail.com
this code is in my main game loop
key = pygame.key.get_pressed() #create a key index
if K_UP in key: #check if the up arrow is
: [pygame] move problems
To: pygame-users@seul.org
Date: Tuesday, February 10, 2009, 7:22 PM
-Inline Attachment Follows-
hi,
K_UP has the value 273 and pygame.key.get_pressed() returns a tuple where the
n'th value is 1 if the n'th key was pressed.
This should work:
if key[K_UP
On Wed, Feb 11, 2009 at 03:46:21PM -0800, Yanom Mobis wrote:
if key[K_UP]:
This uses K_UP as the index and returns the value at that index.
if K_UP in key:
The in
don't get why
if key[K_UP]:
works if
if K_UP in key:
doesn't.
--- On *Tue, 2/10/09, mani...@gmx.de mani...@gmx.de* wrote:
From: mani...@gmx.de mani...@gmx.de
Subject: Re: [pygame] move problems
To: pygame-users@seul.org
Date: Tuesday, February 10, 2009, 7:22 PM
-Inline Attachment
ohhh. I get it now.
thanks!
--- On Wed, 2/11/09, pymike pymik...@gmail.com wrote:
From: pymike pymik...@gmail.com
Subject: Re: [pygame] move problems
To: pygame-users@seul.org
Date: Wednesday, February 11, 2009, 6:08 PM
Here's an example:
UP = 0
DOWN = 1
LEFT = 2
RIGHT = 3
keys = [0
ok.
thanks
--- On Wed, 2/11/09, James Paige b...@hamsterrepublic.com wrote:
From: James Paige b...@hamsterrepublic.com
Subject: Re: [pygame] move problems
To: pygame-users@seul.org
Date: Wednesday, February 11, 2009, 6:04 PM
-Inline Attachment Follows-
On Wed, Feb 11, 2009 at 03:46
this code is in my main game loop
key = pygame.key.get_pressed() #create a key index
if K_UP in key: #check if the up arrow is pressed
redcar.speed = (0, -2)
else:
redcar.speed = (0, 0)
redcar.rect = redcar.rect.move(redcar.speed) #move redcar by speed
but
if key[K_UP] should work better :)
On Tue, Feb 10, 2009 at 6:47 PM, Yanom Mobis ya...@rocketmail.com wrote:
this code is in my main game loop
key = pygame.key.get_pressed() #create a key index
if K_UP in key: #check if the up arrow is pressed
redcar.speed = (0, -2)
else:
hi,
K_UP has the value 273 and pygame.key.get_pressed() returns a tuple where the
n'th value is 1 if the n'th key was pressed.
This should work:
if key[K_UP]:
.
this code is in my main game loop
key = pygame.key.get_pressed() #create a key index
if K_UP in key: #check if the
14 matches
Mail list logo