Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:58:21+00:00 2026-05-28T13:58:21+00:00

Basically, I’ve wanted to get back into Python, so I decided to make a

  • 0

Basically, I’ve wanted to get back into Python, so I decided to make a small game in pygame, where there is a bouncy ball which you need to keep bouncing in the air. The problem is that when I use the functions clock.tick() and clock.get_time(), get_time should return the time passed in milliseconds, but it passes time in milliseconds*10.

My code:

GRAVITY = 10

def move(self, delta):
    self.x+= (self.vx * delta)
    self.y+= (self.vy * delta)

def speed(self, delta):
    self.vy += (GRAVITY * delta)

clock.tick()

while True:
    clock.tick()
    delta = (clock.get_time() / 100) #should be /1000
    ball.move(delta)
    ball.speed(delta)

It works smoothly like in real world when its /100, but works really slow then its /1000.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:58:22+00:00Added an answer on May 28, 2026 at 1:58 pm

    I think part of the problem might be truncation from dividing by “1000” instead of “1000.0”. You can verify clock.tick is working with this:

    import pygame
    pygame.init()
    i = 0
    clock = pygame.time.Clock()
    while i < 10: # Just run a few cycles to check the output
        res = clock.tick(1) # Caps framerate to 1 fps
        print res # This should print out 1000
        i += 1
    

    Note that clock.tick already returns the delta and is normally used to cap the framerate. If left uncapped, you might have a really high FPS, giving a small delta and, when divided by an int, isn’t larger than 1 so you rarely get a number at all.

    Also, make sure you have all your units right, that you really want to be converting to seconds

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I
Basically there is a file called 8puzzle.py and I want to import the file
Basically what I'm trying to do is make a very simple vertical bullet projectile
Basically I'm trying to improve on the Ghosts in a Pacman game I'm making.
Basically my task is to make the counter on a micro controller board count
Basically, I'm using python to print out some information in the terminal and some
Basically I have converted a tab delimited txt file into a list containing a
Basically what I want to do it this: a pdb file contains a location
Basically, something better than this: <input type=file name=myfile size=50> First of all, the browse
Basically I have some code to check a specific directory to see if an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.