VOOZH about

URL: https://www.geeksforgeeks.org/python/making-an-object-jump-with-gravity-using-arcade-module-in-python3/

⇱ Making an object jump with gravity using arcade module in Python3 - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Making an object jump with gravity using arcade module in Python3

Last Updated : 23 Jul, 2025

The Arcade library is a modern Python Module used widely for developing 2D video games with compelling graphics and sound. Arcade is an object-oriented library. It can be installed like any other Python Package. Now, it’s up to the necessity of the developer, what type of game, graphics, and sound he/she wants to use using this toolkit. So, in this article, we will learn how to make an object jump with gravity using the Arcade library in Python. And for understanding that concept, let's take an example of a robust ball.

Following are the steps:

Step 1: Import arcade module .

import arcade

Step 2: Define parameters of the output screen.

# Size of the screen
WIDTH = 600
HEIGHT = 600
TITLE = "Robust Ball "

Step 3: Define the radius of the ball.

# Size of the ball.
BALL_RADIUS = 50

Step 4: Define the value of gravitational constant.

# gravity 
GRAVITATIONAL_CONSTANT = 0.3

Step 5: Define a bouncing velocity for the ball.

# Percent of velocity maintained on a bounce.
BOUNCE = 0.9

Step 6: Define a function to draw a ball using arcade.draw_circle_filled() .

Step 7: Define function to Figure out if we hit the left or right edge so that we can reverse.

Step 8: Also, Define function to Figure out if we hit the bottom so that we can reverse.

Step 9: Use the above defined function and provide input to them.

Step 10: Last and foremost step is to define the main function that contains arcade function to assign output window a proper width, height and title.

Complete Code for better Understanding:

Comment
Article Tags:
Article Tags: