Python Forum
bouncing ball with variable collision points (in time)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bouncing ball with variable collision points (in time)
#2
First off, please edit your post, select the code part and click the python code button (blue/yellow snakes) to format it properly.

For your question, you can adjust the speed of the ball and hence, its timing by changing the speed you update the screen OR by changing how far it jumps with each frame.

You can slow the update rate by adding a delay in your while loop. Try importing time and use the time.sleep() function. It's in seconds so you will want to use a small value like 0.01.

Play with your gravity variable to make the ball "move" faster although you will have to compensate for the bounce getting lower each time through.

If you need to get any more fancy with this app I suggest learning pygame or Vpython. Turtle is pretty limited.
"So, brave knights, if you do doubt your courage or your strength, come no further, for death awaits you all with nasty, big, pointy teeth!" - Tim the Enchanter
Reply


Messages In This Thread
RE: bouncing ball with variable collision points (in time) - by Marbelous - Jul-24-2020, 02:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to read rainfall time series and insert missing data points MadsM 4 2,220 Jan-06-2022, 10:39 AM
Last Post: amdi40
Star I was making code for collision for my character izmamonke 2 2,108 Aug-06-2021, 04:30 PM
Last Post: izmamonke
  How to define a variable in Python that points to or is a reference to a list member JeffDelmas 4 2,695 Feb-28-2021, 10:38 PM
Last Post: JeffDelmas
  SOLVED - Collision detection - TURTLE OuateDePhoque 9 11,481 Nov-18-2020, 06:29 PM
Last Post: OuateDePhoque
  The count variable is giving me a hard time in this code D4isyy 2 1,988 Aug-09-2020, 10:32 PM
Last Post: bowlofred
  How can i change the direction of the ball based on player's xcor and ycor collisions MohammedSohail 0 1,789 May-25-2020, 08:39 AM
Last Post: MohammedSohail
  Player object wont recognize collision with other objects. Jan_97 3 2,737 Dec-22-2019, 04:08 PM
Last Post: joe_momma
  AttributeError: 'Ball' object has no attribute 'hit_paddle' meza1123 1 3,523 Jan-30-2019, 07:25 PM
Last Post: buran
  Would like to input a date variable and determine whether it is within the time range harold 3 2,602 Jan-05-2019, 09:04 AM
Last Post: Gribouillis
  Could not build the ssl module while installing python3.7 from tar ball badfish 1 7,848 Dec-11-2018, 04:33 AM
Last Post: badfish

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020