Here is an example code:
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((1000, 500))
clock = pygame.time.Clock()
square = pygame.Surface((350, 350))
square.fill((0, 0, 0))
x_pos = 1000
while True:
screen.fill((255, 255, 255))
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if x_pos <= -350:
x_pos = 1000
x_pos -= 5
screen.blit(square, (x_pos, 50))
clock.tick(60)
pygame.display.update()
Questions:
1 - Does the .tick() method defines how many fps your game runs at? If not, what does it actually do?
2 - The higher the value passed in the .tick() method, the faster the square on the example goes to the left, why does that happen?
3 - Assuming that the .tick() method defines how many fps your game is going to run at, in some games like valorant, league of legends and any other game, when the fps is higher, the game only looks smoother, not faster like in the examples, is there any reason for that?
Thanks!