+ 1
How i can write the logic code to move a ball in pong game in pygame.
2 Antworten
+ 5
tha ball have x pos, y pos, x speed and y speed, if the x pos is less than 0 x pos set to 0 and x speed set to - xspeed, if the ball x is greater than the screen width, the ball x set to the screen width and x speed set to - xspeed. The same in y pos and y speed.
+ 3
try to write collisions to players you with the same logic