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

[pygame] Re: PyGame Windows Key Behaviour



Hi there, thanks for fast responses

@ Julian: Equal means exakt the same function with the same
playerspeed variable - but under other conditions:
it compares the position of the cpuplayer and the ball and rearranges
the cpuplayer
def move_player_a(ball_y):
    global a_y
    if a_y + 31 > ball_y and a_y > 0:
        #up
        a_y += seconds * playerspeed * -1
    elif a_y + 31 < ball_y and a_y + 95 < 360:
        #down
        a_y += seconds * playerspeed * 1

i will have to take a look at framerates
thanks for that hint

@ Ian: i will also check pygame.key.get_pressed(). thx

@ Brian: The complete code is here http://pastebin.com/ic44uvfU
code was growing with my pygame knowledgement, so it isn't as nice as
i would like to have it ;)
but as additional info, pictures where used as background and as bars