Re: [pygame] move problems

2009-04-10 Thread Yanom Mobis
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

Re: [pygame] move problems

2009-04-10 Thread Yanom Mobis
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

Re: [pygame] move problems

2009-04-09 Thread Ian Mallett
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])

Re: [pygame] move problems

2009-04-09 Thread Brian Song
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

Re: [pygame] move problems

2009-02-18 Thread Michael George
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

Re: [pygame] move problems

2009-02-11 Thread Johan Ceuppens
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

Re: [pygame] move problems

2009-02-11 Thread Yanom Mobis
: [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

Re: [pygame] move problems

2009-02-11 Thread James Paige
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

Re: [pygame] move problems

2009-02-11 Thread pymike
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

Re: [pygame] move problems

2009-02-11 Thread Yanom Mobis
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

Re: [pygame] move problems

2009-02-11 Thread Yanom Mobis
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

[pygame] move problems

2009-02-10 Thread Yanom Mobis
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

Re: [pygame] move problems

2009-02-10 Thread RB[0]
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:

Re: [pygame] move problems

2009-02-10 Thread maniaxx
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