> Ok, I'm getting closer. I did this: > > if event.type == USEREVENT: > keys = pygame.key.get_pressed() > if keys[K_UP]: > self.player.move = 1 > elif keys[K_DOWN]: > self.player.move = 2 > elif keys[K_LEFT]: > self.player.move = 3 > elif keys[K_RIGHT]: > self.player.move = 4 > > Here's how it works: > player.move = 0-4 where 0 = stop, 1 = up, 2 = down, 3 = left, 4 = right You need separate values for x and y. and don't use elifs, use a set of ifs. The way you're doing it disallows for diagonal movement and creates some other issues.
- [pygame] my rpg game (so far) Michael Fiano
- Re: [pygame] my rpg game (so far) Nicholas Dudfield
- Re: [pygame] my rpg game (so far) Michael Fiano
- Re: [pygame] my rpg game (so far) Paul Pigg
- Re: [pygame] my rpg game (so far) Charlie Nolan
- Re: [pygame] my rpg game (so far) James Hancock
- Re: [pygame] my rpg game (so far) Michael Fiano
- Re: [pygame] my rpg game (so far) Casey Duncan
- Re: [pygame] my rpg game (so far) Charlie Nolan
- Re: [pygame] my rpg game (so far) Michael Fiano
- Re: [pygame] my rpg game (so f... Luke Paireepinart
- Re: [pygame] my rpg game (... Matt Pearson
- Re: [pygame] my rpg game (so f... Michael Fiano
- Re: [pygame] my rpg game (... Jake b
- Re: [pygame] my rpg game (... Michael Fiano
- Re: [pygame] my rpg game (... Michael Fiano
- Re: [pygame] my rpg game (... Patrick Mullen
- Re: [pygame] my rpg game (... Michael Fiano
- Re: [pygame] my rpg game (... Michael Fiano
- Re: [pygame] my rpg game (... Kris Schnee
- Re: [pygame] my rpg game (... Michael Fiano