+ 1

How i can write the logic code to move a ball in pong game in pygame.

25th Feb 2019, 3:43 AM
Maninder $ingh
Maninder $ingh - avatar
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.
25th Feb 2019, 6:10 AM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
+ 3
try to write collisions to players you with the same logic
25th Feb 2019, 6:11 AM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar