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

How to make a chunk of code to wait for a few seconds

On my mini-mage project, whenever a unit on the chessboard is either wounded or killed, the square on which the unit is gets outlined of respectively a yellow or red colour. Once this happens, I have to wait for the next Player click in order to…
Techoplite
  • 605
  • 9
  • 23
0
votes
1 answer

Trying to control the speed of my loop for Pong

I'm trying to get my pong game to run the loop at a certain fps, but I've tried a couple things and it hasn't worked and I wasn't taught how to use pygame speed/clock so I gotta figure it out on my own I'm trying to make the loop run at a certain…
IJH
  • 107
  • 1
  • 7
0
votes
1 answer

Python Pygame text overlay printing on top of itself each time

I'm currently wanting to use an old piece of Python code called python slideshow with time and weather (github). I'm using a Raspberry Pi and I've got it all setup and it works perfectly in landscape (normal) mode. This is a slideshow application…
user1721451
  • 247
  • 6
  • 15
0
votes
0 answers

Why does using delta time in physics computations produce slower code than expected?

I have a simple projectile motion simulation built using Pygame. I limited the FPS to 60 and calculated the delta time for each frame. I then use this delta time to update the position of my projectile. However, the problem is, the update seems to…
adrianp
  • 999
  • 1
  • 8
  • 13
0
votes
0 answers

pygame freezes in limited for loop

pygame freezes in this loop at around cycle 150. The loop continues, but pygame stops updating here's my code: import pygame from cv2 import imread # the only one needed! (to get image size) could of used pygame though... image =…
thomask
  • 1
  • 1
0
votes
1 answer

Pygame can't run over 60 FPS

I'm running a Pygame simulation with Python 3 on OSX. For some reason I cannot exceed 60 fps, but ideally I would be able to run it very high to run multiple trials in a short amount of time. Im using clock = pygame.time.Clock() at the top of my…
muZero
  • 948
  • 9
  • 22
0
votes
2 answers

Why is my character ignoring the clock tick when i add the background?

This is what happens when i don't have a background: https://www.youtube.com/watch?v=S-bv-j8le24 this is the code: import pygame pygame.init() #####Variables##### white = (255,255,255) black = (0,0,0) red = (255,0,0) green = (0,255,0) blue =…
0
votes
1 answer

My Python program crashes when I press the exit button. It works fine otherwise. I am using Pygame module. The code is attached below

I am reading data from a file. Basically, those are coordinates where I want my ball to appear after every iteration. The code is working fine except for the fact that the output window 'Trial 1' crashes as soon as I press the exit button. This…
0
votes
1 answer

Pygame has input lag when using pygame.time.delay()

My goal for my program is for it to loop over images and display them on the screen. When the user presses space, it is supposed goes to a new screen. For some reason, there is a lag from when the user presses space and when it breaks out of the…
0
votes
1 answer

How to set a clicking clock in a pygame window

#!/usr/bin/python # -*- coding: utf-8 -*- import pygame import sys import datetime import time class TextPicture(pygame.sprite.Sprite): def __init__(self, speed, location): pygame.sprite.Sprite.__init__(self) now =…
Black Bob
  • 105
  • 1
  • 13
0
votes
1 answer

Pickling pygame clock

I am currently looking into implementing a save functionality to a small rpg I have made using the shelve module which uses pickle. After finding out I couldn't pickle pygame surfaces I followed advice suggesting passing a dictionary key instead as…
Sorade
  • 915
  • 1
  • 14
  • 29
0
votes
2 answers

How to make a digital clock within a status bar in pygame (without tkinter)?

Currently I am doing an assignment for school to create a game in Pygame. I am stuck on the process of creating a clock which determines the; days, hour, and minute. So far I have created some code but my Pygame crashes when ever I run it. I know…
Joshua
  • 35
  • 1
  • 9
-1
votes
0 answers

Pygame.time.set_timer confusion

hello so I have just recently started using pygame to try and make a flappy bird clone. I am trying to use pygame.time.set_timer to refresh the jump every so often, but when I try I still can't jump more than once Here's my code import pygame import…
-1
votes
1 answer

pygame.time.Clock.get_fps does not exist

so I am trying to display my fps in game, but whenver I try to use the pygame.time.Clock.get_fps function, it says it does not exict as an atribute I tried: clock =…
aadnnn1
  • 53
  • 1
  • 4
1 2 3 4
5