rotating squares in a rotating grid
#pydroid #pygame #algorithm
For the joy of tinkering: Bernhard Bablok shows you how you can use gestures to browse a document on your Raspberry Pi
https://www.makerspace-online.com/use-gestures-to-browse-a-document-on-your-raspberry-pi/?utm_source=mms
#gestures #project #OpenHardware #RaspberryPi #APDS9960 #OpenSource #Blinka #PyGame
It's 2025 and I am still not 100% sure how to have #PyGame go to sleep and wait for *either* an event from the keyboard/mouse/controller *or* an event from the network *or* a vblank interrupt without some kind of hard-coded polling timeout. Various attempts I've made at this in the past have violated thread safety rules and I'm not sure the documentation even covers all the constraints I need to preserve. #python
J'installe pygame sur ma Debian Bookworm avec apt install python3-pygame et apparemment y'a pas le répertoire des exemples ?
On fait comment pour les avoir, alors ?
I can hardly believe it.
Deepseek, which runs locally on my regular laptop WITHOUT internet access, responded to my question of whether it could write me a game in Python similar to “PONG” with the following:
------
Can you write a python scrip to run a game like the classic Pong game?
Thinking...
Okay, so I want to create a Python script for a classic Pong game. Let me
think about how to approach this.
First, I remember that Pong is a two-player game where each player controls
a paddle, and they hit a ball back and forth. The goal is to make the ball
go past the opponent's paddle. So, I need to set up the game window, create
paddles for both players, a ball, and handle their movements.
I think using Pygame would be a good idea since it's a library designed for
creating games in Python. I'll need to initialize Pygame and set up the
display. The screen size can be something like 800x600 pixels. Setting the
title of the window to "Pong" makes sense.
Next, defining colors is important for visibility. White for the paddles and
ball, and black for the background. That should make everything stand out
clearly.
Now, I need to define the game objects: the left paddle, right paddle, and
the ball. Each will have their own positions and dimensions. For example,
the left paddle could be on the left side of the screen, centered
vertically. The same goes for the right paddle but on the opposite side. The
ball should start in the center.
Handling user input is crucial. I'll need to listen for key presses—like the
Up and Down arrows for moving the paddles. For each frame, if a key is
pressed, adjust the paddle's position accordingly. But I also need to make
sure the paddles don't move off the screen, so I should check their
positions against the window boundaries.
The ball movement involves updating its position based on its velocity.
Collision detection with the walls (top and bottom of the screen) will
reverse the y-component of the velocity. When the ball hits a paddle, it
should bounce back, changing the x-component of the velocity. This means I
need to check for collisions between the ball and each paddle.
Scoring is another important aspect. If the ball goes past the left or right
side, the corresponding player gets a point. Updating the score display will
require rendering text on the screen.
Putting it all together, the main loop will handle drawing the objects,
updating positions based on input and physics, checking for collisions, and
managing scoring. I'll also need to set a frame rate using Pygame's clock to
control how fast everything updates.
I should test each part as I go—maybe first make sure the paddles move
correctly without the ball, then add the ball movement, collision with
walls, paddle collisions, and finally scoring. Debugging will be necessary
if something doesn't work right, like the ball not bouncing or the paddles
moving too fast.
In summary, the steps are: set up Pygame, create game objects, handle user
input, move objects, detect collisions, update scores, and display
everything on screen. I'll write the code step by step, making sure each
part works before moving on to the next.
...done thinking.
Certainly! Below is a Python script that creates a classic Pong game using
the Pygame library:
This script creates a simple Pong game with the following features:
1. Two players can play using their respective controls:
- Player on the left uses 'W' and 'S' keys to move up and down.
- Player on the right uses UP and DOWN arrow keys.
2. The ball bounces off the paddles and walls.
3. Points are scored when the ball goes past an opponent's paddle.
4. The score is displayed in the top center of the screen.
To run this game:
1. Make sure you have Pygame installed. If not, install it using pip:
```
pip install pygame
```
import pygame
import random
# Initialize Pygame
pygame.init()
# Set up the display
width = 800
height = 600
window = pygame.display.set_mode((width, height))
pygame.display.set_caption(„Pong Game“)
# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
# Paddle dimensions
paddle_width = 10
paddle_height = 100
# Ball dimensions
ball_size = 15
# Paddles positions
left_paddle_y = height / 2 – paddle_height / 2
right_paddle_y = height / 2 – paddle_height / 2
# Ball position and speed
ball_x = width / 2
ball_y = height / 2
ball_speed_x = random.choice([-5, 5])
ball_speed_y = random.choice([-5, 5])
# Score
score_left = 0
score_right = 0
font = pygame.font.Font(None, 36)
# Game loop variables
clock = pygame.time.Clock()
running = True
while running:
# Handle events
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Get keys pressed
keys = pygame.key.get_pressed()
# Move left paddle
if keys[pygame.K_w]:
left_paddle_y -= 5
if keys[pygame.K_s]:
left_paddle_y += 5
more --->
https://word.undead-network.de/2025/08/22/ich-kann-es-kaum-glauben-i-can-hardly-believe-it/
#ai #code #deepseek #pygame #python
Orienting myself in the IDE of mu (for python)
Initially it looks strange; no normal menu for help/about
It must be geared towards UI novices?
Game dev on iBook G4 with NetBSD - What can you do with a laptop enough to drink even in the Puritan ex-colonies? 21 ... - https://hackaday.com/2025/07/23/game-dev-on-ibook-g4-with-netbsd/ #retrocomputing #netbsd #pygame #ibook #ppc
Hey! I've been creating a #game #engine #framework in #vala
Its ECS based, and its called Veggies (eat your veggies!).
My reasoning for this framework is to have a game framework alternative to #csharp. I'm not liking the encroachment #microsoft has over #gamedev and #indiedev
The video is the well known bunny mark demo. Renders up to 16000 bunnies before being under 30 fps. Still needs a lot of optimization.
I'm taking ideas from frameworks like #pygame, #pine, #FNA and #excaliburjs
What's the simplest way to visually convey text, aside from morse code blinking?
I'm doing some experiments in #pygame to work out just how low-res I can go with scrolling text and still be legible.
These three animations show text scrolling across a simulated display with 1px, 2px and 3px width. I'm using a 5x3 pixel font from adafruit.
I think 2px is *barely* readable.
Imgur link because I can't upload the WEBMs to my masto instance for some reason.
Yay our first game together (me and 12y old) is now on FlatHub! We built it as a vibe coding exercise, learning pygame and Python together
Give it a go, two players on the same keyboard or two gamepads. 120 seconds, the one that gets more asteroids wins.
Solidna znajomość składni i struktur danych Pythona
Więcej informacji https://lttr.ai/AfCOk
Umiejętność korzystania z gotowych modułów i rozszerzeń
Więcej informacji https://lttr.ai/Ae5dI
Check out MacroKnight! My latest #game for the #lispgamejam written with #hylang and #pygame
Enigma to doskonały przykład na to, jak edukacja technologiczna może być kreatywna i inspirująca dla osób w każdym wieku.
Więcej informacji https://lttr.ai/AeXGF
Warto zaznaczyć, że tworzenie gier w Pythonie wymaga nie tylko umiejętności programistycznych, ale także kreatywności i zdolności rozwiązywania różnych problemów.
Więcej informacji https://lttr.ai/Ad5kl