r/pythonarcade • • Nov 27 '17

Notes or examples on performance?

2 Upvotes

Hi! On example Drawing Shapes with Classes there's this comment

Because this is redraws the shapes from scratch each frame, this is slow and inefficient, but we'll show how to make it faster in the chapter on performance.

The next one is about Falling Snow but I didn't find anything like that there. Am I missing anything? Can you point me to some example or notes such as refered in the comment? I'm new to game programming and am trying to find my way around. Thanks!


r/pythonarcade • • Oct 29 '17

What is "ShapeElementList"?

2 Upvotes

Line 15 of the "Skylines" example code reads

shape_list = arcade.ShapeElementList()

What is "ShapeElementList"? Running the example code gives me the error AttributeError: module 'arcade' has no attribute 'ShapeElementList', and I don't see it mentioned in any of the API listings or index.


r/pythonarcade • • Oct 17 '17

Using Python Arcade for PyWeek 24 and loving it!

Thumbnail
pyweek.org
2 Upvotes

r/pythonarcade • • May 11 '17

Questions about `Window.set_update_rate` method

2 Upvotes

There is a set_update_rate in class Window.

Are we supposed to override this method, or to invoke it?

Invoking this method on the __init__ of the Window subclass, or at a later point in a setup method, did not produce any effect (that is: did not change the update-rate).

class MyApplication(arcade.Window):

    def __init__(self, width, height):
        super().__init__(width, height)
        self.set_update_rate(0.1):

    def setup(self):
        self.set_update_rate(0.1):

One (ugly) workaround I tried was to override it, and pass my desired value to its super-class version (ignoring the incoming parameter).

def set_update_rate(self, rate):
    # the passed parameter is ignored
    super().set_update_rate(0.1)

I can't imagine this to be the way it was intended. Unfortunately, I also did not find any example where this method is used.

How are we supposed to use this method?

P.S. For the time being I bypassed the whole thing altogether by scheduling periodic invocations to a "custom" update method (called "update_logic" or anything else but "update"). Like this:

def setup(self):
    arcade.schedule(self.my_update, 0.1)

def my_update(self, delta_time):
    # update positions

It would be nice to use the built-in functionality, though.


r/pythonarcade • • Nov 08 '16

Collision detection without sprites

2 Upvotes

Is there a way of doing collision detection without going to sprites? I want my students to be able to extend moving of rectangles into making a simple game of pong.

i.e. something similar to:

def doRectsOverlap(rect1, rect2): for a, b in [(rect1, rect2), (rect2, rect1)]: # Check if a's corners are inside b if ((isPointInsideRect(a.left, a.top, b)) or (isPointInsideRect(a.left, a.bottom, b)) or (isPointInsideRect(a.right, a.top, b)) or (isPointInsideRect(a.right, a.bottom, b))): return True

return False

def isPointInsideRect(x, y, rect): if (x > rect.left) and (x < rect.right) and (y > rect.top) and (y < rect.bottom): return True else: return False


r/pythonarcade • • Jul 23 '16

Demo with Python Pymunk library, and the Arcade library

Thumbnail
youtu.be
2 Upvotes

r/pythonarcade • • Jul 22 '16

Pinball using new Arcade physics engine

Thumbnail
youtu.be
2 Upvotes

r/pythonarcade • • Oct 06 '26

ffmpeg and opencv

1 Upvotes

I assume most folk are using OpenCV, are there alternative routes to follow for someone who is just following samples at this stage? Or is OpenCV just the easy way to import media and get it to play back?

I'm asking about use of ffmpeg mainly because I'm thinking about adding ffmpeg anyway in order to pre-process video in background as part of unpacking all game media files. And that just feels like a load of space OpenCV already blew the executable up by almost 40K. What size are people typically zipping up to?


r/pythonarcade • • Aug 18 '25

Arcade 3.3.0 not using custom font loaded from TTF

1 Upvotes

Hi there,

I'm trying to load a custom font from a .ttf file into Python Arcade. I'm using arcade.load_font("path/to/file.ttf") and that's not throwing any exceptions, so I believe the font is being loaded.

However, my arcade.Text object is not using the font. Here's my code:

arcade.load_font("Assets/Fonts/CopperplateGothic.ttf")

self
.actionsLabel = arcade.Text("Actions", font_name="CopperplateGothicStd-32BC", color=highlightColour, font_size=32, x=0, y=buttonY+buttonHeight+20, batch=
self
.headingTexts)

print(self.actionsLabel.font_name)

No matter what version of the font name I use in the Text constructor, it always fails back to Segoe UI.

I've tried:
The name as shown in the Windows font viewer, "Copperplate Std 32 BC" (this is also how the font appears in the font selector in other programs).
The name as shown in the properties of the font file, "CopperplateGothicStd-32BC"
The filename, with and without the extension.

I've even converted the file to OpenType and tried passing that to load_font(), to no avail.

I have confirmed the code is working, because if I change font_name to "MS Comic Sans", I get kindergarten font as expected.

Is it possible that my font file was created in a non-compliant way, such that it can be imported, but not displayed? Is it some conflict because the font is installed in my system, and I'm trying to load it in programatically?

I've googled till I'm blue in the face, but most of the results I can find are about PyGame or PIL. Any advice, suggestions, or tips, would be greatly appreciated!

TIA.


r/pythonarcade • • Jul 30 '25

draw_rectangle_filled, draw_xywh_rectangle_filled, draw_lbwh_rectangle_filled

1 Upvotes

I'm using Python arcade on a MacBook. I'm running it in two different ways: either in a virtual environment on in the system installation of Python:

- from system installation

- from virtual environment run in a VS Code terminal

In the system installation, the methods draw_rectangle_filled and draw_xywh_rectangle_filled both exist and work. Running "pip show arcade" says arcade is at version 2.6.17 and python3 is at version 3.11.6.

In the virtual environment, neither of those exists, but draw_lbwh_rectangle does exist. Running "pip show arcade" also says arcade is at version 2.6.17. Also, Python in the virtual environment is version 3.11.6

Why the confusing difference between these? I'm getting ready to teach arcade to one of my tutoring students. He's on Windows and I want to make sure I'm not getting some weird Mac behavior.


r/pythonarcade • • May 26 '25

Getting xbox controller to work?

1 Upvotes

How can i get an xbox controller to work with Arcade (it's an "elite" version, if this matter)...
For some reason it has no issues with finding my PS5 controller. Also, in menus, like if you have a game where it says Press Any Button to Start, it seems impossible to get it to work even if button presses works great in-game (from the PS5 dual sense).
I am on 3.2.0.
Many thanks


r/pythonarcade • • Feb 27 '25

Setting background color of Text object

1 Upvotes

Apparently, there is no 'background' attribute for a Text object. I can use 'draw_debug()', but then I get the anchor point showing also.

Is there a way to change the color of the background and the outline of a Text object?


r/pythonarcade • • Oct 27 '22

Set color from a list of names

1 Upvotes

I am porting a game that I made with Turtle graphics, and running into trouble with the colors. I used color names as dictionary keys for several sprite attribute, including their colors. I can't figure out how to use the same dictionary to set the colors of my sprite in arcade. For instance, suppose my allowable colors are

CAR_COLORS = ["RED", "BLACK", "RAJAH", "BRIGHT_GREEN", "BRIGHT_NAVY_BLUE", "BOYSENBERRY"]

I know I could use (for example) myspriteclassinstance.color = arcade.color.RAJAH But I want to store those colors names as strings, not as arcade colors...I want to be able to use them as lookup keys also:

myspriteclassinstance.colorname = "RAJAH"
myspriteclassinstance.threat = THREATLIST[myspriteclassinstance.colorname]
myspriteclassinstance.color = ???????? #I don't know what to put here, but I want it to be RAJAH colored.

Any suggestions?


r/pythonarcade • • Oct 17 '22

I just started coding with python arcade, I don't know much about coding but I'm trying to get into it. Is there a way of running python arcade codes faster? It takes like 2 min to run my game

1 Upvotes

r/pythonarcade • • Aug 07 '22

Error installing Arcade

1 Upvotes

Hey everybody. I'm trying to install Arcade through PyCharm, and I keep getting and install error, with the following log:

Usage:
C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] <requirement specifier> [package-index-options] ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] -r <requirements file> [package-index-options] ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] [-e] <vcs project url> ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] [-e] <local project path> ... C:\Users\Redacted\AppData\Local\Programs\Python\Python38-32\python.exe -m pip install [options] <archive url/path> ...

no such option: --build-dir

Does this mean i have to install through the command line? Any help would be appreciated!

UPDATED: I ran the pip install arcade command from the command window, and it seemed to install properly. I'm not getting that message about installing a requirement in PyCharm.


r/pythonarcade • • Oct 01 '21

Trouble with Moving Platforms

1 Upvotes

Hallo! I'm just trying to get the grips and make a simple platformer. I more or less copied the example code and went from there. Now I have the 'problem' that my player sprite is not keeping up with the speed of the horizontally moving platforms and falls off after a short while, intstead of just standing there, relaxing. I have no clue, what I changed to trigger such behavior. Could there be a simple solution? Thanks for your help!


r/pythonarcade • • Jul 23 '21

Double jump?

1 Upvotes

How do I add double jump to my game when I have pymunk? I tried to use the line: self.physics_engine.enable_multi_jump(2) but I got the following error:AttributeError: 'PymunkPhysicsEngine' object has no attribute 'enable_multi_jump'


r/pythonarcade • • Jun 24 '21

How would you have a background sound working?

1 Upvotes

I kind of want one song to play in the background then either when you click to play the game the song stops. It seems with just the arcade.play_sound function it does not stop until the song stops even if u quit the application. How would you do this


r/pythonarcade • • Oct 06 '20

Window display options

1 Upvotes

My window keeps opening on my secondary display. I can't find anything referring to this in the docs, SO, google or here. Is this something arcade supports or will I have to use stuff like pywin32?


r/pythonarcade • • Apr 13 '20

How does the bullet move on the "sprite bullet" example?

1 Upvotes

I am speaking about this code:

https://arcade.academy/examples/sprite_bullets.html#sprite-bullets

I can see in lines 45 and 67 the bullet list is created.

Lines 105 draws them.

Lines 124 creates the sprite and line 131 sets the "change_y" property to BULLET_SPEED, and then it's added to the list.

But then "on_update" I can see how it is calculated to see if the bullet hits a coin or if it's off-screen.

But I cant see how the bullet moves.


r/pythonarcade • • Apr 11 '20

How to get touch input

1 Upvotes

Hello. I am interested in making a game with the python arcade game library and wish to know if it's possible to get touchscreen input with that. And if it's possible please can you provide any resource (example). Thanks in advance πŸ‘


r/pythonarcade • • Apr 03 '20

Blank screen after I run code once

1 Upvotes

I just installed arcade yesterday but I am able to run the example codes only once. If I try run the code again in brings a blank screen and it won't show anything till I restart my system. Is there a way to fix this.

I am using MX Linux (debian buster) and I run my code through the terminal.


r/pythonarcade • • Mar 25 '20

enemies don't move in my python game

1 Upvotes

import arcade # объявляСм ΠΌΠΎΠ΄ΡƒΠ»ΡŒ

SCREEN_WIDTH = 1000 #Ρ‰ΠΈΡ€ΠΈΠ½Π° ΠΎΠΊΠ½Π°

SCREEN_HEIGHT = 650 #Π΄Π»ΠΈΠ½Π° ΠΎΠΊΠ½Π°

SCREEN_TITLE = "Platformer"#Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ ΠΎΠΊΠ½Π°

TILE_SCALING = 0.6

class MyGame(arcade.Window):#Π³Π»Π°Π²Π½Ρ‹ΠΉ класс прилоТСния

def __init__(self):#функция 'ΠΈΠ½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ'

super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)#Π΄Π°Π½Π½Ρ‹Π΅ ΠΎΠΊΠ½Π°

arcade.set_background_color(arcade.csscolor.BLACK)#Ρ†Π²Π΅Ρ‚ ΠΎΠΊΠ½Π°

self.set_mouse_visible(False)#ΠΎΡ‚ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ курсора

self.enemy = arcade.Sprite("sprites/cube.png")#

self.speed = 2

self.sed = 0

self.speed2 = 4

def setup(self):#функия "Π½Π°ΡΡ‚Ρ€ΠΎΠΈΡ‚ΡŒ"

self.enemy_list = arcade.SpriteList()#список self.enemy_list

self.enemy_list.append(self.enemy)

map_name = "maps/coolmap.tmx"

platforms_layer_name = 'ground'

enemy_layer_name = 'Enemy'

my_map = arcade.tilemap.read_tmx(map_name)

self.wall_list = arcade.tilemap.process_layer(my_map, platforms_layer_name, TILE_SCALING)

self.enemy_list = arcade.tilemap.process_layer(my_map, enemy_layer_name, TILE_SCALING)

def on_draw(self):#функция 'Ρ€ΠΈΡΠΎΠ²Π°Ρ‚ΡŒ'""

arcade.start_render()#ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° рисовки

self.enemy_list.draw()#рисовка спиcΠΊΠ° self.enemy_list

self.wall_list.draw()

def on_update(self, delta_time):

self.enemy.update()

self.enemy.change_x = self.speed

def main():#главная функция

""" Main method """

window = MyGame()

window.setup()

arcade.run()

if __name__ == "__main__":

  • main()


r/pythonarcade • • Mar 23 '20

Looking for help with a finite state machine

1 Upvotes

I'm new to the whole state machine but found a python video on youtube, how do I develop this to work with the arcade library?

I've tried putting the arcade.Sprite code into the Entity class but unsure how to do it.

Here's what I've got so far: from enum import Enum, auto import arcade

class States(Enum): idle = auto() chase = auto() patrol = auto() attack = auto() death = auto()

class GameObject: def init(self): self.__state = States.idle

def set_state(self, state):
    self.__state = state

def get_state(self):
    return self.__state

class Entity(GameObject): def init(self): super().init() self.player = arcade.Sprite() self.__health = 100 #self.entity = arcade.Sprite()

def move_right(self):
    self.change_x = 2

def assets(self):
    self.__entity = arcade.Sprite("images/green.png")

def load(self, entity):
    self.__entity = entity

def sub_health(self):
    self.__health -= 20

def set_health(self, health):
    self.__health = health

import arcade

SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_TITLE = "Starting Template"

class MyGame(arcade.Window): """ Main application class.

NOTE: Go ahead and delete the methods you don't need.
If you do need a method, delete the 'pass' and replace it
with your own code. Don't leave 'pass' in this program.
"""

def __init__(self, width, height, title):
    super().__init__(width, height, title)
    self.player = None
    self.player_list = None
    arcade.set_background_color(arcade.color.AMAZON)

    # If you have sprite lists, you should create them here,
    # and set them to None

def setup(self):
    # Create your sprites and sprite lists here

    self.player = Entity()
    self.player.move_right()
    self.player_list = arcade.SpriteList()
    self.player_list.append(self.player)

def on_draw(self):
    """
    Render the screen.
    """

    # This command should happen before we start drawing. It will clear
    # the screen to the background color, and erase what we drew last frame.
    arcade.start_render()
    self.player_list.draw()
    # Call draw() on all your sprite lists below

def on_update(self, delta_time):
    """
    All the logic to move, and the game logic goes here.
    Normally, you'll call update() on the sprite lists that
    need it.
    """
    self.player_list.update()

def on_key_press(self, key, key_modifiers):
    """
    Called whenever a key on the keyboard is pressed.

    For a full list of keys, see:
    http://arcade.academy/arcade.key.html
    """
    pass

def on_key_release(self, key, key_modifiers):
    """
    Called whenever the user lets off a previously pressed key.
    """
    pass

def on_mouse_motion(self, x, y, delta_x, delta_y):
    """
    Called whenever the mouse moves.
    """
    pass

def on_mouse_press(self, x, y, button, key_modifiers):
    """
    Called when the user presses a mouse button.
    """
    pass

def on_mouse_release(self, x, y, button, key_modifiers):
    """
    Called when a user releases a mouse button.
    """
    pass

def main(): """ Main method """ game = MyGame(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) game.setup() arcade.run()

if name == "main": main()


r/pythonarcade • • Mar 11 '20

sprite shivering after corner collision

1 Upvotes

I have found this weird problem when running my own program but I have also later discovered it can be found at the example code programs as well (for example here - https://arcade.academy/examples/sprite_rooms.html#sprite-rooms).

If you collide 2 sprites in particular positions (mainly when they are touching just by the tip of their corners) for example moveable player sprite and wall, the moveable one starts shivering (changing one of the coordinates back and forth repeatedly when pressing button for move into the other sprite location).

It is extremely annoying when there is lot of these wall-type obstacles and you want to move with player between these because it is really easy to run again into this problem.

I am a programming beginner so maybe it is something very common which is easily explainable I just was not able to find anything on this subject across the web. Thanks in advance for any clarifications/responds.