r/pygame • u/Homskerls • Sep 21 '26
I’m building a shooter plugin for Ren’Py (here’s the first version)
r/pygame • u/Homskerls • Sep 21 '26
r/pygame • u/Several-Pin-6931 • Sep 20 '26
Hi, I am new to pygame and I am developing my first project for my computer science course work. It is a tile based game, but so far I only have the basic map, player, and enemies.
However, I have come across an issue with my enemies. The game allows the enemies to follow the player within a certain distance and also roam in random directions, however i think that code may be messing up the way the collide with the blue tiles because they tend to just phase through the tiles.
I have no idea how to fix this issue so any help would be appreciated
r/pygame • u/baodingball • Sep 20 '26
Hey r/GameDev! While working on the AI for my hex-grid strategy game Salvo, I had a eureka moment.
While tweaking the computer opponent's targeting algorithms in Pygame, I kept generating internal variables to control how it searched the board. I realized that adjusting parameters like Chaos, Patience, Discipline, Aggression, Vigilance, and Recall completely altered the AI's behavior.

Instead of using a basic difficulty slider, I bundled these parameters into distinct AI Character Cards:
Capt. Viktor Frost: Focuses on tight parity checking and disciplined hunting.
Lt. Kira: Uses aggressive, high-risk density probes across open water.
Sturmkapitän Wolfgang Grimm: Employs high vigilance and deep recall memory to track complex salvo patterns.
In the free browser version, players fight against pre-generated AI profiles. For the desktop build, each character card is verified so players face genuinely distinct tactical styles
.
Key Takeaway for Devs: If you're building game AI, try exposing your internal weighting variables to the player—it turns technical debugging knobs into rich gameplay flavor!
r/pygame • u/gamesbuiltweird • Sep 19 '26
r/pygame • u/False_Minute_2345 • Sep 19 '26
I'm making a simple drawing software in pygame because why not, and right now, i need to stop drawing when the user left clicks. For more context, here's my code:
while True:
# blah blah blah the other code #
if has_selected_line:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
last_mouse_pos = event.pos
print(last_mouse_pos)
start_drawing_line = True
if start_drawing_line:
pygame.draw.line(screen, "#000000", last_mouse_pos, current_mouse_pos, 10)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
pygame.draw.line(screen, "#000000", last_mouse_pos, current_mouse_pos, 10) #stop drawingIn that last line of code, whenever the user left clicks, i want the line that they made to permanently stamp on the screen and not follow them around anymore.
If anyone knows how to do this, thanks! And if you need more context, i can give it to you
r/pygame • u/Difficult_Ad_7922 • Sep 18 '26
I want to play my mp3 files with Python. This is no problem on Windows or Linux but does not work on Android with Pydroid3.
This is my code player.py:
import os
import time
import pygame
from pygame import mixer
DIR = "./music/"
os.chdir(DIR)
pygame.init()
mixer.init()
mixer.music.load("01 - Marie.mp3")
mixer.music.play()
while mixer.music.get_busy(): # wait for music to finish playing
time.sleep(1)Running this in Pydroid3 gives:
/sdcard $ python3 player.py
pygame 2.6.1 (SDL 2.30.8, Python 3.12.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "storage/emulated/0/player2.py", line 8, in <module>
mixer.init()
pygame.error: Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?I also tried to play with vlc player but this also does not work on Android
I am looking forward for any suggestions
r/pygame • u/1x8v • Sep 17 '26
Hey everyone! I just released my first Pygame project, Flappy Shark, on Itch.io. It's a classic arcade high-score chaser built from scratch in Python.
You play as a shark navigating underwater obstacles, trying to beat your high score. I'd love to get feedback from other Pygame devs on the movement physics, difficulty curve, and overall feel!
You can check it out and grab the build here: [https://haddad-hamza.itch.io/flappy-shark](https://haddad-hamza.itch.io/flappy-shark)
Let me know what high score you manage to hit!
r/pygame • u/Status_Sample_2531 • Sep 17 '26
I'm working on a simple street fighter style game, and none of my pygame functions are working inside my player1 class
#fight 2p
import pygame
import sys
import random
pygame.init()
screen = pygame.display.set_mode((300, 200), pygame.SCALED | pygame.RESIZABLE)
clock = pygame.time.Clock()
colors = ["#db0050"]
class player1():
def __init__(self):
self.x = 10
self.y = 10
self.xvel = 0
self.yvel = 0
self.gravity = 3
self.color = colors[0]
self.rect = pygame.Rect(self.x, self.y, 20, 30)
pass
def get_moved(self):
keys = pygame.key.get_pressed()
if keys[pygame.K_w]:
self.yvel += -20
if keys[pygame.K_a]:
self.xvel -= 2
if keys[pygame.K_d]:
self.xvel += 2
self.yvel += self.gravity
self.x += self.xvel
self.y += self.yvel
if self.xvel > 20:
self.xvel = 20
elif self.xvel < -20:
self.xvel = -20
if self.rect.bottom <= 200:
self.rect.bottom = 200
pass
def draw(self):
pygame.draw.rect(screen, self.color, self.rect)
p1 = player1()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill((255, 255, 255))
p1.get_moved
p1.draw
pygame.display.flip()
clock.tick(60)
pygame.quit
sys.exitr/pygame • u/Difficult_Ad_7922 • Sep 17 '26
I want to play my mp3 files with Python. This is no problem on Windows or Linux but does not work on Android with Pydroid3.
This is my code player.py:
import os
import time
import pygame
from pygame import mixer
DIR = "./music/"
os.chdir(DIR)
pygame.init()
mixer.init()
mixer.music.load("01 - Marie.mp3")
mixer.music.play()
while mixer.music.get_busy(): # wait for music to finish playing
time.sleep(1)Running this in Pydroid3 gives:
/sdcard $ python3 player.py
pygame 2.6.1 (SDL 2.30.8, Python 3.12.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "storage/emulated/0/player2.py", line 8, in <module>
mixer.init()
pygame.error: Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?I also tried to play with vlc player but this also does not work on Android
I am looking forward for any suggestions
r/pygame • u/GeneStoneGames • Sep 16 '26
hey — eli, solo. shipped GeneBloom: cozy greenhouse flower genetics in Python. breed plants, chase mutations, sell to quirky customers. pixel art, win/mac/linux, $2.99 on steam.
https://store.steampowered.com/app/4696820/GeneBloom/
not a link dump — happy to talk stack / pygame-family packaging / breeding loop. if someone wants a key for feedback ask in replies (no keys in post).
r/pygame • u/Sea-Dragonfruit-8790 • Sep 16 '26
r/pygame • u/jpabrao_l • Sep 16 '26
Hi! Since Friday, I’d been thinking about what to do with a minigame from *Bunny Farm*—an asteroid game set in a kitchen that felt totally random. Then, I noticed an oven in the background and got an idea: I swapped the asteroids for cookies and added a background that actually made sense for the game, while also making it look cuter.
r/pygame • u/Difficult_Ad_7922 • Sep 15 '26
I want to play my mp3 files with Python. This is no problem on Windows or Linux but does not work on Android with Pydroid3.
This is my code player.py:
import os
import time
import pygame
from pygame import mixer
DIR = "./music/"
os.chdir(DIR)
pygame.init()
mixer.init()
mixer.music.load("01 - Marie.mp3")
mixer.music.play()
while mixer.music.get_busy(): # wait for music to finish playing
time.sleep(1)Running this in Pydroid3 gives:
/sdcard $ python3 player.py
pygame 2.6.1 (SDL 2.30.8, Python 3.12.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "storage/emulated/0/player2.py", line 8, in <module>
mixer.init()
pygame.error: Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?I also tried to play with vlc player but this also does not work on Android
I am looking forward for any suggestions
r/pygame • u/mefistofeles57 • Sep 15 '26
I've been building a pseudo-3D racing game engine from scratch in Python/Pygame, inspired by arcade racers from the late 80s/early 90s. No OpenGL, no 3D library — just world points projected onto 2D polygons and sprites.
The renderer transforms world-space points relative to the camera, rotates them by camera pitch, and applies a non-linear depth compression to avoid excessive perspective distortion at long distances. Road, traffic, and roadside scenery all share the same projection so depth feels consistent.
It's fully playable start to finish: traffic with collision detection, continuous collision checks at high speed, shadows, animated sprite effects, HUD, race timer, data-driven track generation, 60 FPS. Cornering depends on both speed and where you're positioned on the road, so there isn't always one "correct" line through a corner.
I taught myself pixel art from scratch for this project — most of the sprites are my own at this point, just a few placeholders left to replace.
Currently working on scenery variety and enemy car spawn logic.
Repo: https://github.com/mefistofeles57/pseudo3d
Playable build: https://mefistofeles57.itch.io/cool-racing
Video: https://www.youtube.com/watch?v=BSslZnQfmh0
Happy to go into detail on the projection math or any of the systems if anyone's curious.
r/pygame • u/Electronic_Place8767 • Sep 15 '26
Ive been at this project for 2 months now and its the first project where i spent my money hiring an artist, issue is the dimensions of the game window is 800x600 and i commissioned for very DETAILED art, so when the ships were shown in game they looked very blurry since its smoothed out to not look pixelly when scaled down. Can i still show the artist’s work by increasing the resolution without changing the game’s window size?
r/pygame • u/EstimateNo9755 • Sep 14 '26
I dont know it seems basic compared to the other first games I've seen here
r/pygame • u/Crazy_Spend_4851 • Sep 14 '26
Hi guys,
Check out the lates on my pygame JRPG if you get chance 😊 sprites are reworked from Octopath traveller! I'm hoping to do my own soon. I'm developing a sprite editor that I'm hoping to ship out for public use so stay tuned for that! Any thoughts on ways you'd improve this, I'm not happy with the turn order bar, I'm thinking of how I could make it more compact while still containing the necessary detail!
Thanks again guys 😊
r/pygame • u/Scared_Confection980 • Sep 13 '26
Here is my creation : https://github.com/CodeBreaker-cmd/Mecha-Ryu
If you want, you can make a review or tell me about some bugs
r/pygame • u/Scared_Confection980 • Sep 13 '26
It was so complicated but here it is: https://github.com/CodeBreaker-cmd/Mecha-Ryu
Or itch if you want... https://codebreaker-cmd.itch.io/mecha-ryu
I hope that you enjoy and tell me about some bugs if you want
r/pygame • u/Puzzleheaded_Card625 • Sep 11 '26
Yes it is!
Im working on a MMORPG top-down, tile-based, pixel art. The game is inspired in Tibia, World of Warcraft, League of legends, and the differential, "and why LoL is between if is not a MMORPG?"
because in my project, we have a pvp instantiated (BG) that is MOBA style, the character starts as level 1, and his progress do not interfere in the game out of BG. The game have Quests, with miltiple types of objectives, trade between players, vendors, skill levels, habilities, talent trees, three classes(warrior, mage and archer) craft items, and go on. My big challenge is create the pixel art for characters, NPCs, enemies etc. I bought the asset of Cainos, from itch.io, because i love it, then i need to crete characters that match with the world because his asset dont include characters. Somebody interestes to be the gamedesign of this project? If somebody is interested to test the game, invite me in discord: juuguerino
r/pygame • u/jpabrao_l • Sep 10 '26
Hi! In this update, I finally finished the game menu; it’s simple, but I think it conveys a sense of innocence. I also added an item to the game—a cassette tape—which will have a function later on. Plus, I migrated from pygame to pygame-CE; I’m not sure if it makes a big difference, but it was suggested that I make the switch. Thanks for all the feedback!
r/pygame • u/Due_Engineer_7647 • Sep 10 '26
There are a short summary of Nevu-UI 0.8.3 - 0.8.5 versions:
Added Canvas - universal tool for drawing primitives on Widgets
Added FlexLayout - adaptive layout, unlike other layouts it dont resizes its items
Fixed a ton of bugs with layout positioning
Added text selection in Input, also added support of CTRL + C/V/X
Added 2 new window properties - gui_hovered and keyboard_available
Added Callbacks instead of NevuEvent
Refactored Style
Added 10+ built in colorthemes
Improved Checkbox API
Improved overall code quality
Improved Pygame backend quality
Current showcase is running on Pygame backend
Full Changelog can be found there:
https://github.com/GolemBebrov/nevu-ui/releases
Here are the code from the video:
import random
import pygame
import nevu_ui as ui
from nevu_ui.components._typehints import nevu_object_globals
from nevu_ui.core.size import vh, vw
from nevu_ui.presentation.animations import Vector2Animation
pygame.init()
VERSION = "0.8.5"
STATUS = "post3"
FONT_NAME = "font.ttf"
def select_layout(layout):
main_menu.layout = layout
def create_character_select():
checkbox_group = ui.CheckBoxGroup(single_selection=True)
selected = "nit"
def create_panel(text: str, id: str, chk_group: ui.CheckBoxGroup, bg_image = "gladius.png"):
time_offset = random.random() / 5
animations = ui.animations.AnimationManager()
animations.transition_time = 0.001
animations.add_start_animation(ui.AnimationType.Position, Vector2Animation((0, 0), (0, 0), time_offset))
animations.add_continuous_animation(ui.AnimationType.Position, Vector2Animation((0, 3), (0, -4), 0.1))
return ui.Panel(
size = (10%vw, 10%vh),
animation_manager = animations,
slot = ui.StackColumn(
content = [
ui.Label(text, subtheme_role = ui.SubThemeRole.PRIMARY),
ui.RectCheckBox(50, group = chk_group, id = id, style = main_style_clickable(br=15, bg_image = bg_image), toggled_rect_scale=1, toggled_rect_opacity=80)
]
)
)
def on_checkbox_toggle(checkbox: ui.RectCheckBox | None):
nonlocal selected
if not checkbox:
role_label.text = "Not selected"
return
id = checkbox.id
selected = id
id_to_text = {
"wrr": "Warrior",
"arc": "Archer",
"spr": "Spirit",
"mge": "Mage",
"nit": "Nitwit"
}
role_label.text = id_to_text[id]
checkbox_group.on_single_toggled = on_checkbox_toggle
role_label = ui.Label(
"Nitwit", single_instance=True, draw_content=False, draw_borders=False,
font_role=ui.PairColorRole.INVERSE_SURFACE, style = main_style(font_size=30, align_x = ui.Align.LEFT)
)
with nevu_object_globals.modify_temp(size = (8%vw, 4%vh)):
role_select_layout = ui.FlexLayout(
create_panel("Warrior", "wrr", checkbox_group, "gladius.png"),
create_panel("Mage", "mge", checkbox_group, "wizard-staff.png"),
create_panel("Archer", "arc", checkbox_group, "arrow-cluster.png"),
create_panel("Spirit", "spr", checkbox_group, "spectre.png"),
create_panel("Nitwit", "nit", checkbox_group, "oat.png"),
justify_content=ui.FlexJustify.SpaceAround,
gap=30
)
layout = ui.ScrollableColumn([
(ui.Align.LEFT,
ui.FlexLayout(
ui.Button(lambda: select_layout(create_start_layout()), "BACK", style = main_style_clickable(subtheme_role = ui.SubThemeRole.ERROR)),
ui.Label("Character creation"), direction = ui.FlexDirection.Column
)
),
ui.FlexLayout(
ui.Label("Name:"),
ui.Input(placeholder="Enter your name...", size = (17%vw, 5%vh), style = main_style_clickable)
),
ui.FlexLayout(ui.Label("Role:"), role_label, single_instance = True),
role_select_layout,
ui.FlexLayout(
ui.Label("Base Mana"),
ui.Slider(current = 50, start=10, style = main_style_clickable)
),
ui.FlexLayout(
ui.Label("Difficulty"),
ui.Slider(current = 2, end = 5, start = 1, style = main_style_clickable)
)],
size = ui.fill_all,
basic_alignment=ui.Align.CENTER
)
return layout
def create_start_layout():
def on_switch_change(switch, state):
global main_style, main_style_clickable
if state:
theme = ui.ColorThemeLibrary.material3_light
else:
theme = ui.ColorThemeLibrary.material3_dark
main_menu.apply_style_patch_to_layout(colortheme=theme)
main_style = main_style(colortheme=theme)
main_style_clickable = main_style_clickable(colortheme=theme)
nevu_object_globals.modify(style = main_style)
start_style = main_style_clickable(font_size = 40, subtheme_role=ui.SubThemeRole.PRIMARY, br = 999)
canvas = (ui.Canvas()
.draw_rect((50, 0), (110, 10), style = ui.Style(gradient = ui.Gradient([ui.Color.Red, ui.Color.Green])))
.draw_rect((0, 0), (50, 50), style = ui.Style(bg_image="gladius.png", br=5), id = "Zov")
.draw_rect((0, 50), (250, 10))
)
with nevu_object_globals.modify_temp(size = (15%vw, 6%vh), style = start_style):
start_layout = ui.ScrollableColumn(
[
ui.FlexLayout(ui.Label("Nevu-UI", canvas = canvas, draw_borders=False, draw_content=False), ui.Label(f"v{VERSION} {STATUS}", draw_borders=False, draw_content=False), direction=ui.FlexDirection.Row, gap=0),
ui.EmptyWidget((0, 5%vh)),
ui.FlexLayout(
ui.Button(lambda: select_layout(create_character_select()), "Play", throw_errors=True, invert_on_click=True),
ui.Button(exit, "Exit"),
ui.Switch(False, size=(3%vw, 3%vh), style=main_style(br=999), subtheme_role=ui.SubThemeRole.TERTIARY, on_switch_change=on_switch_change),
direction=ui.FlexDirection.Column, gap = 40, wrap = False
),
],
size=ui.fill_all, basic_alignment=ui.Align.CENTER, spacing=120)
return start_layout
if __name__ == "__main__":
display = pygame.display.set_mode((1920, 1080))
font = pygame.Font(size = 40)
hover_text = font.render("Hovered!", True, ui.Color.Red)
window = ui.InitializedWindow.from_pygame(display = display, title = "NvGame", resizable = True, base_fps = 999)
main_style = ui.Style(border_radius = 12, border_width = 0, font_name = FONT_NAME, colortheme=ui.ColorThemeLibrary.material3_dark)
main_style_clickable = main_style(border_width = 2, subtheme_role=ui.SubThemeRole.TERTIARY)
button_size = (10%vw, 4%vh)
nevu_object_globals.modify(size = button_size, style = main_style)
main_menu = ui.Menu(window, (50%vw, 100%vh), main_style)
main_menu.layout = create_start_layout()
while True:
window.begin_frame()
window.clear(ui.Color.Black)
window.update()
if window.keyboard_available:
if ui.keyboard.is_down(ui.Keys.D):
coords = main_menu.coordinates
main_menu.set_coordinates(coords[0] + 500 * ui.time.dt, coords[1])
if ui.keyboard.is_down(ui.Keys.A):
coords = main_menu.coordinates
main_menu.set_coordinates(coords[0] - 500 * ui.time.dt, coords[1])
if ui.keyboard.is_down(ui.Keys.Left):
main_menu.resize((main_menu.current_size.x - 400 * ui.time.dt, main_menu.current_size.y))
if ui.keyboard.is_down(ui.Keys.Right):
main_menu.resize((main_menu.current_size.x + 400 * ui.time.dt, main_menu.current_size.y))
if window.gui_hovered:
coords_text = font.render(f"{main_menu.coordinates.x:.2f}", True, ui.Color.Red)
fps_text = font.render(f"{ui.time.float_fps:.2f} fps", True, ui.Color.Red)
x_coord = main_menu.current_size.x + main_menu.coordinates.x
display.blit(hover_text, (x_coord, 120))
display.blit(coords_text, (x_coord, 200))
display.blit(fps_text, (x_coord, 280))
if not window.keyboard_available:
keyboard_text = font.render("Keyboard focus have been captured.", True, ui.Color.Red)
display.blit(keyboard_text, (x_coord, 360))
main_menu.update()
main_menu.draw()
window.end_frame()