Questions tagged [pygame-clock]

This tag is for questions about clocks and timing in pygame.

The tag is related to . Timing is supported by the pygame.time module.

74 questions
0
votes
1 answer

Is there any relation between fps and how fast a surfaces moves on the screen?

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,…
0
votes
1 answer

Stuck in infinite loop and I don't know how to get out of it

I am stuck in an infinite loop but I'm not sure how to get out of it. I am trying to build a clicker game and want an automatic character to deal damage for me. I haven't spent much time refining it all and it's probably messy and inconvenient, but…
0
votes
1 answer

I am making a game on pygame but when I come a to the 'WIN.blit', it gives me an error

I am making a game on pygame but when I come a to the 'WIN.blit', it gives me an error. I am using MacOs. I think the problem is the width and the height which I set to 900 , 500. Please help me out. import pygame import os WIDTH,…
user17217721
0
votes
2 answers

End screen in python using pygame

I am creating my first Pygame project a flappy bird but I want to display a end screen that displays score as soon as player gets out. I am working with following code. import pygame import pygame.freetype import random import…
Devansha
  • 38
  • 1
  • 6
0
votes
1 answer

Pygame: pygame.time.Clock, or time.sleep

I have a partner in this Pygame project. So it's for fun, and it's Snake. He says to use time.sleep instead of pygame.clock since it is 'better'. Is his choice better, or is mine better?
tdserapio
  • 41
  • 1
  • 8
0
votes
1 answer

pygame - constant frame rate

I would like to achieve a frame rate as constant as possible in my Pygame game. This answer (Setting a fixed FPS in Pygame, Python 3) explains how to give a fluent and frame-rate-independant result, but this is not the same as a constant frame…
Big Bro
  • 797
  • 3
  • 12
0
votes
1 answer

CREATING A REACTION TIME TEST GAME IN PYGAME

I am trying to create a reaction time test game in python using pygame for gui. Since, I am fairly new to the technology, I am stuck at a portion of the code as how to register further keypresses and then record time accordingly. This is my code…
0
votes
1 answer

Show final time on victory screen

In my game I have a chronometer running. The chronometer is defined in the 'Play' class(which is used for everything related to when the player is controlling the character), not in the 'Victory' class(which purpose is to show an image when you…
Marc Casas
  • 11
  • 3
0
votes
1 answer

Why do I get a constant 0 fps in pygame

I am not getting any frames even though I have set my clock tick to 60 and it is in the right space. I also know its not my computer because I have run larger games with better frames. Also it cant be the indentation because I have it intended…
Elfed
  • 23
  • 4
0
votes
1 answer

How do I kill my the player if it lands on a certain block

So my problem is that when I land on block 3 or lava my player doesn't die and I have tried if tile == '3': display.blit and the stuff that goes inside it but on the lines after I put pygame.quit and on the next line sys.exit it…
0
votes
0 answers

Time delays on sprites

I have only been learning pygame for a few weeks mainly following different arcade style game tutorials. Have adapted a pong game and am trying to insert two delays, one when ball hits border (edge of screen behind paddle) then a reset and time…
0
votes
1 answer

Is it possible to reset a Timer in PyGame?

first time poster here, so I hope you guys can help me :) I'm working on a project in which I want to play a game of SET. It all works (JEEJ), however I want to be able to use some sort of time function. This will do the following: at start of game…
N0ukz
  • 3
  • 2
0
votes
1 answer

How to set a timer for a specific item in pygame

I'm very inexperienced with pygame & python.. I was wacthing a youtube tutorial about making a platform game with pygame. Everything works just as intended except for one thing.. I want to increase my characters jumping height temporarily but i just…
0
votes
1 answer

I have created hitboxes for my flappy dragon but the hitboxes are either not colliding or doesn't produce an output. How do i fix that?

I'm trying to make a flappybird game for my Python programming class and I used cues like drag.hit() that causes them to print("hit") everytime the hitboxes supposedly collides. However, the collision of dragon and stumpy hitbox are not working and…
iZLaPrix
  • 25
  • 1
  • 4
0
votes
2 answers

how do you display time in the format 00:00? Currently, it displays the time in a decimal format

the timer works but i am having trouble displaying it in the format 00:00 - Currently, it displays the time in a decimal format for exapmle: 2.547959356:688.9846939 while True: # main game loop mouseClicked = False …
Nneoma
  • 11
  • 3