Open In App

Arcade Library in Python

For many years, Python game programmers were limited to the Pygame Module. But, now we have other choices as well i.e Arcade Python Library. 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. It was written by Paul Vincent Craven, a computer science professor at Simpson College in Iowa, USA. 

Installation

To install this module, just simply run the following command on your command prompt:



pip install arcade






Implementation

The following steps illustrate how to create a basic drawing using an arcade module:

Syntax-



arcade.open_window(Width, Height, Title)

Syntax-

arcade.set_background_color(arcade.color.color_name)

Syntax-

arcade.start_render()

Syntax-

arcade.finish_render()

Syntax-

arcade.run()

Example 1: Python program that uses arcade to draw a circle.




# Import module
import arcade
 
# Specify Parameters
Width = 500
Height = 700
Title = "Welcome to Arcade"
Radius = 100
 
# Open the window
arcade.open_window(Width, Height, Title)
 
# Set the background color
arcade.set_background_color(arcade.color.BLUE)
 
# start drawing
arcade.start_render()
 
# Draw a Pink circle
arcade.draw_circle_filled(
    Width/2 , Height/2 , Radius , arcade.color.PINK
)
# Finish drawing
arcade.finish_render()
 
# Display everything
arcade.run()

 
 

Output:

 

 

Example 2: Python program that creates a pattern of circles using the arcade

 




# Import module
import arcade
 
#Specify Parameters
Width = 500
Height = 700
Title = "Welcome to Arcade"
Radius = 200
 
# Open the window
arcade.open_window(Width, Height, Title)
 
# Set the background color
arcade.set_background_color(arcade.color.BLACK)
 
# start drawing
arcade.start_render()
 
# Draw a BLUE circle
arcade.draw_circle_filled(
    Width/2 , Height/2 , Radius , arcade.color.BLUE
)
 
# Draw a Red circle
arcade.draw_circle_filled(
    Width/2 , Height , Radius , arcade.color.RED
)
 
# Finish drawing
arcade.finish_render()
# Display everything
arcade.run()

 
 

Output:

 

Arcade is a set of python modules which is a modern Python framework used in designing 2D video games. In Arcade, we have gripping computer graphics and sound libraries in order to design high quality and user-friendly games. Arcade was developed by Paul Vincent Craven. Arcade needs support for OpenGL 3.3+.

Interesting facts about Arcade Library:

Active road-map of Arcade version 2 development :

  1. Version 2.4.3 was released 2020-09-30. It is the latest version of arcade that has Added PyInstalled hook and tutorial, ShapeLists have no longer share position between instances and with GUI improvement.
  2. Version 2.4.2 was released 2020-09-08. It has GPU transformations with the mouse and Updates downloadable .zip for platformer example code to match current code in documentation and much more.
  3.  Arcade 2.4.1 was released 2020-07-13. Support for defining your own frame buffers, shaders, and more advanced OpenGL programming, PyMunk engine for a platform, etc.

Article Tags :