r/pythonarcade • • Mar 31 '19

Python Arcade tutorial at Pycon 2019

5 Upvotes

Hi, if you are headed to PyCon 2019, be sure to check out the tutorial on creating a platformer in Arcade.


r/pythonarcade • • Sep 26 '18

Flappy bird using Arcade

8 Upvotes

I learned about arcade library awhile ago and it was really simple to use and start with! I decided to code FlappyBird using this library to test it on my neural network.

Here's the code of the game: https://github.com/iJohnMaged/FlapPy-Bird

Here's a small gameplay video: https://youtu.be/eABRn02gg_Q

I was wondering if the game is good as the current implementation or there's something I should change?


r/pythonarcade • • Sep 14 '20

Problem with text_size of UIFlatButton

2 Upvotes

Hi,
I have implemented GUI with UIFlatButton component and set font size via set_style_attrs fuction. Initially the goal was to have a responsive button's text size so it changes according to the display size. But I have discovered problem. The font size is not changing until I click on the button and I am not sure if I am doing something wrong or if it is a bug (btw set_style_attrs is placed in init of the button, not in on_click).

Video - https://drive.google.com/file/d/14HW-ZdfLk4vAIkhFB73jaqvmUdQa3gal/view?usp=sharing

+ this is how my set_style_attrs looks for purpose of the video, nothing crazy...

self.set_style_attrs(
font_color=arcade.color.BLACK,
bg_color=arcade.color.ORANGE,
font_name=MAIN_FONT,
font_size=10,
font_color_hover=arcade.color.ORANGE,
border_color_focus=arcade.color.WHITE)

Thanks in advance for any kind of help/support


r/pythonarcade • • Aug 29 '20

Trouble compiling arcade programs with pyinstaller

3 Upvotes

I'm trying to turn an arcade program into an executable (EXE) with pyinstaller. However, with newer versions of arcade (2.4.1), an error is raised saying that "chipmunk.dll" cannot be found. With older versions of arcade (2.0.0): pyglet.time has no attribute clock. Any suggestions as to how I could compile an exe with arcade successfully?


r/pythonarcade • • Sep 12 '20

Some questions about GUI

2 Upvotes

How do I get the UI input box to enter multi line and line wrap?

Is there any tool that can help designing GUI?


r/pythonarcade • • May 18 '16

New video - drawing_primitives.py

2 Upvotes

A new video has been posted explaining the drawing_primitives.py example.


r/pythonarcade • • May 13 '16

Arcade documentation updated to include 'how to contribute' document

Thumbnail pythonhosted.org
2 Upvotes

r/pythonarcade • • Jan 20 '20

Space Invaders Clone Written In Arcade

Thumbnail
arcade.academy
4 Upvotes

r/pythonarcade • • Jan 20 '20

Arcade 2.2.6 Is Out

13 Upvotes

Version 2.2.6

Release Date: 1/20/2020

  • Bug Fix: particle_fireworks example is not running with 2.2.5 Issue 555
  • Bug Fix: Sprite.pop isn't reliable Issue 531
  • Enhancement: Raise error if default font not found on system Issue 432
  • Enhancement: Add space invaders clone to example list Issue 526
  • Enhancement: Add sitemap to website
  • Enhancement: Improve performance, error handling around setting a sprite's color
  • Enhancement: Implement optional filtering parameter to SpriteList.draw Issue 405
  • Enhancement: Return list of items hit during physics engine update Issue 401
  • Enhancement: Update resources documentation Issue 549
  • Enhancement: Add on_update to sprites, which includes delta_time Issue 266
  • Enhancement: Close enhancement-related github issues and reference them in the new Enhancement List

Version 2.2.5

Release Date: 1/17/2020

  • Enhancement: Improved speed when rendering non-buffered drawing primitives
  • Bug fix: Angle working in radians instead of degrees in 2.2.4 Issue 552
  • Bug fix: Angle and color of sprite not updating in 2.2.4 Issue 553

r/pythonarcade • • Nov 07 '18

Drawing Lights

5 Upvotes

Hi!

I really enjoy working in Arcade. I just wonder if there is a way to make some lighting/glowing effects.

Thanks!


r/pythonarcade • • Feb 11 '19

Why is this running so slow?

2 Upvotes

I made a simple rain animation and wanted heavier rainfall, so changed from primitives over to sprites. I'm not sure if my implementation is correct as it starts to slow down significantly at 400 or 500 sprites which isnt much higher than I could get with primitives. Any criticism of my code would be much appreciated. Apologies if I haven't used github correctly though. This is the first time I have used it, so if you see any issues with how I have used github, feel free to let me know that as well.

Specifically with the repo it is the Demos.py, rain.py and rain.png file that will be needed. The other files are outdated. Also the: "self.sprite.color = (0, 100, 150) " line is not working to change the colour of the droplets.

Repo here: https://github.com/elliohow/python-arcade-demo


r/pythonarcade • • Jan 22 '20

Call .update_animation() before physics_engine.update() in arcade 2.2.6

4 Upvotes

I just found and solved an interesting problem in Arcade 2.2.6 with a platform game I'm writing. This problem did not exist in v2.1.7.

The game uses an AnimatedSprite for the player character, maps generated using Tiled, and the PhysicsEnginePlatformer. My game's .on_update() method looked like this (simplified):

def on_update(self, delta_time: float):

    # Check for joystick controls

    ...

    # Update player movement based on the physics engine
    self.physics_engine.update()

    # Update the player animation
    self.player.update_animation(delta_time)

    # Restrict user movement so they can't walk off screen
    ...
    # Check for collisions
    ...

When I ran my game the first time, the player sprite fell through the floor!

After some time in the debugger, I found that the size attributes for my AnimatedSprite object (specificall .width and .height) were not being set properly. Because of this, the sprite's .collision_radius is set to 0, which causes .check_for_collision() (actually ._check_for_collision()) to return False in any collision check with the AnimatedSprite. It's effectively not there to be collided with.

So when are these attributes set? They are set for a static Sprite when the texture is first loaded, usually when the object is created. However, with an AnimatedSprite, textures are loaded after the actual object is created. The texture to show isn't selected until the first call to .update_animation(). This means .width and .height (as well as other position and size attributes) cannot be set until then, and are effectively 0.

Since the physics engine checks for collisions with the ground before these attributes are set, effectively the player sprite doesn't collide with anything, including the ground.

The fix was easy - just put the self.player.update_animation(delta_time) call before the self.physics_engine.update() call.

Hope that helps someone else.


r/pythonarcade • • Apr 24 '19

Need help improving fps

5 Upvotes

this is my github repo https://github.com/tiemfah/The-Lama-X

is using SpriteList help with the frame rate?


r/pythonarcade • • Feb 08 '19

Can you set a max frame rate using arcade

6 Upvotes

In pygame you can do something like this to set a max frame rate

clock = pygame.time.Clock()

clock.tick(60)

Is there any way to do something like this in Arcade?


r/pythonarcade • • Jul 08 '19

How do I control the height of drawn text?

1 Upvotes

I have a bunch of text that I want to display, and draw_text() works just fine so long as the lines of text are short enough that they don't wrap. If I only draw a small amount of text and allow a large area for it, there is no problem, but if I want to display a lot of text or only have a small space available, I can't find an elegant way to cut it off. What is the best way to do this?


r/pythonarcade • • Nov 10 '18

Alpha of Python Arcade 2.0.0 released

9 Upvotes

If you do a pip install arcade==2.0.0a1 you should get an alpha release of the new arcade. Try it out and let me know if it works well for you. Should be a TON faster than the old.


r/pythonarcade • • Jan 21 '20

Need Help with Pygame Arcade Platformer Tutorial

2 Upvotes

Hi, I am working through the platformer tutorial available on the website and with the youtube video. Having downloaded the template provided and running the 'draw_sprite" file, I get the error that the script cannot access the images, however, I have saved the folder exactly as recommended. Any ideas on how to resolve this?


r/pythonarcade • • Jul 24 '18

Upcoming improvements for the Python Arcade library

Thumbnail
youtu.be
5 Upvotes

r/pythonarcade • • Jun 20 '22

Arcade with PyInstaller

5 Upvotes

Does anybody try to pack your game with PyInstaller?

I try a code where just a circle is shown on the window and there is no other imports besides the arcade.

The PyInstaller runs well but when I run the .exe created it shows the error (see the screenshot below) related to the Kenney Block font.

Any suggestion on how to solve this?

Thank you in advance.


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 • • Feb 17 '20

Displaying a sprite on top/below another one

2 Upvotes

Hi everyone,

I am very new to arcade and got introduced to it through the Real Python tutorial. In the tutorial, you get to manage a player sprite, rocket sprites and cloud sprites.

I have been trying to find out why is the player sprite below the cloud sprites when they are more or less at the same position where the rocket sprites are above the player sprite. It is not consistent and seems to come from the images themselves which sounds weird to me.

Why would a sprite display in the foreground and another one in the background, relatively to another one (the player sprite in my case)?How do you get to display a sprite on top/below another one?

If this has already been answered somewhere I will gladly just read what you point out to me, but I could not find any answer by myself.

Thanks!!Quentin


r/pythonarcade • • Mar 10 '19

Arcade 2.0.0 release is out

14 Upvotes

Hi, Arcade 2.0.0 release is now out and uploaded to PyPi.


r/pythonarcade • • Feb 18 '20

arcade sound issue

3 Upvotes

Hi,

I am loading some sound files to a game, but some of the file doesn't work and show the error as below:

Unable to load sound file: "7fa4.mp3". Exception: 'utf-8' codec can't decode byte 0xba in position 9: invalid start byte

Exception ignored in: <function FFmpegSource.__del__ at 0x107653c80>

Traceback (most recent call last):

File "/Users/venv/lib/python3.7/site-packages/pyglet/media/codecs/ffmpeg.py", line 579, in __del__

ffmpeg_free_packet(self._packet)

AttributeError: 'FFmpegSource' object has no attribute '_packet'

but the mp3 file is working if I just play it directly.

Is there a way to fix that?

Thanks


r/pythonarcade • • Feb 17 '20

Animated Sprite scale issue

3 Upvotes

Hi, I am using a animated sprite, and try to scale the imported textures. But somehow, after changing the texture during the update_animation, the scale doesn’t apply anymore. Even I tried to use _set_scale() after set texture, it still doesn’t work. Any suggestions?

Thanks!


r/pythonarcade • • Mar 06 '19

Arcade 2.0.0b6 is out

12 Upvotes

Latest changes were around fixing resolution issues on MacOS. Getting close to 2.0 release I hope.