#game-development
1 messages · Page 2 of 1
Hi, did someone saw my question? Don't you love mathematics :P
both pygame and panda3d work fine with async
wasabi2b is especially made for that
how do i add a timer to my game but its not like a for loop where it ticks down and the text keeps moving down, i just want it ticking down in 1 spot
cool, I'll use pygame
btw with async you can run on web https://pygame-web.github.io/wiki/python-wasm/#main-loop-async
the problem was that i did not use shaders ☹️
can u help me, i made a game with pygame and my player can be controled with the d,a for the x movement jeys, but when i multyplie both of the movement speeds with delta time, the left side goes slower then the right side
Could you send code of your movement logic?
Sounds like a math error did you calculate it the same on both sides
i can but the files are kinda big for discord
Just copy the movement part over
ok
and just saying the variables dx,dy are for TileBased collision detection so when i say dx += or -= then i mean move player
if keys[pygame.K_SPACE] or keys[pygame.K_w]:
self.velocity.y = -7 * dt
if keys[pygame.K_d]:
dx -= 10 * dt
if keys[pygame.K_a]:
dx += 10 * dt
and when i multiplie the acceleration the gravity goes upsidedown
if u want ill send the play's code
*player's code
nvm the right side is slower
Does this also happen if you leave dt out ?
it works fine
and i multiplie the dt without clock.tick but without dt i use clock.tick(FPS) FPS = 60
and the wierder thing that when i hold both of the keys the player stops
but it should go left(because right side is faster somehow)
i use dt like that: last_dt = time.time() dt = time.time() - last_dt
and i put it in the while loop
and i multyplied the dt by 60, i tried it without multiplying and i increesed the move values and its stillt he same
(i multiplie the dt by FPS)
ill send the player's code:
PGbuiltins is my library and its fine with the (vector2s at least)
i pep8 it with black
no tiles are in the list sp the collision detection isnt the problam
so*
And without dt it works?
Because looking at it i couldnt find anything that would make it behave like this
The error would be in here im pretty sure, but i couldnt find anything from looking over it
ok then ty for helping
im just cleaning he code to not create super long chat....
if you want i can send the code again
the*
Maybe you just set some "(" wrong or something small like this
oh and i cant send my PGbuiltins code because its 878 line of code and discord dont alow it
if you want i can call u and show u how to game is working with share screen
nvm ill just send a screenshot
im stuck on its development because of this stupid thing
nvm ill just leave it 😦
bye have a nice day
Hello! Can someone help me installing pygame in Anaconda. I’m using this command in the terminal window:
conda install -c cogsci pygame
But doesn’t work
Btw, I’m using macOS
is there a formular that can be used to make a snake...
i need a chain of entites, that follow each other.
Hello, I need some help. Regarding the code:
mouse_x = -pygame.mouse.get_pos()[0]
#Player control takes (move x, move y, the x position of the mouse cursor)
player.control(0,0,mouse_x)
keys = pygame.key.get_pressed()
if keys[pygame.K_w]:
player.control(2*math.cos(mouse_x), 2*math.sin(mouse_x), mouse_x)
When controlling the actual sprite wabbles and it does not go in the same direction in which I rotate it. Is anything strange in the code? I would like to use math formulas. (Not actual vectors in Pygame).
Thanks.
it looks really good @old axle
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
hello, can someone help me with my game? im stuck.....
Help with what?
Using the Ursina framework
Probably wrong discord server for this
@dawn quiver i did it
YOOOO nice!!!!!
this is the code for it: ```py
if self.directions[0] in (RIGHT, LEFT):
leftright_square_label.draw(self.pos[0][0], self.pos[0][1], self.surface)
if self.directions[0] in (UP, DOWN):
updown_square_label.draw(self.pos[0][0], self.pos[0][1], self.surface)
for p, direction in zip(self.pos[::-1], self.directions[::-1]):
try:
if direction in (RIGHT, LEFT) and direction == predirection:
leftright_square_label.draw(p[0], p[1], self.surface)
if direction in (UP, DOWN) and direction == predirection:
updown_square_label.draw(p[0], p[1], self.surface)
if direction == UP and predirection == LEFT or direction == RIGHT and predirection == DOWN:
bottem_left_square_label.draw(p[0], p[1], self.surface)
if direction == UP and predirection == RIGHT or direction == LEFT and predirection == DOWN:
bottem_right_square_label.draw(p[0], p[1], self.surface)
if direction == DOWN and predirection == LEFT or direction == RIGHT and predirection == UP:
top_left_square_label.draw(p[0], p[1], self.surface)
if direction == DOWN and predirection == RIGHT or direction == LEFT and predirection == UP:
top_right_square_label.draw(p[0], p[1], self.surface)
except UnboundLocalError:
if direction in (RIGHT, LEFT):
leftright_square_label.draw(p[0], p[1], self.surface)
if direction in (UP, DOWN):
updown_square_label.draw(p[0], p[1], self.surface)
predirection = direction
how does the snake look in action?
like this
Awesome :D
i want to create a board game
particularly like chess
it's chushogi (12x12) variant of shogi (Japanese chess)
hmm, im not aware of any specific for board games, but pygame offers some utilities that should suffice
tons of chess games have been made using it(not too sure about shogi though)
chushogi is probably planned to come on https://lishogi.org/ along with other variants
though it for sure will be a fun game to create a program for
these aren't board games, but i think this shows that it provides enough to be able to render chess/shogi
the core logic/engine itself would be separate from the graphics lib you use though!
Someone who was making a chess game using pygame recently:
I see
I've seen shogi being mentioned in some shows, but I don't know anything more than that haha
Might give it a try some day
so first one should first build an "engine" that can work on text notation and calculate possible moves for pieces etc, and output that for the renderer.
implementing AI is the next hard step of course if one wants to ig
seems like you got the idea!
coincidentally, im working on a board game too, implementing it in Rust though
Hmmm, since you ask It in #game-development i think you might want to make games, how far are you at python?
Because i suggest learning the basics and maybe make like a mini rock paper scissors game, or geuss the number rir smth
Hello, sorry for interrupting, I am currently trying to create an mp3 player using the kivy framework.
What is bothering me is how can I create an if condition that detects which audio is playing so it can pause it and play it again? I searched on internet but didn't find what interested me. Here is the code:
import kivy
from kivy.core.audio import SoundLoader
from kivy.uix.floatlayout import FloatLayout
kivy.require('2.0.0') # replace with your current kivy version !
from kivy.uix.button import Button
from kivy.config import Config
import subprocess
from kivy.app import App
from kivy.uix.label import Label
global button
global button0
button = Button(text='', size_hint=(.20,.12), pos =(325, 275),background_normal = 'playbutton.png')
button0 = Button(text='', size_hint=(.20,.12), pos =(150, 275),background_normal = 'pause.png')
global button1
button1 = Button(text='', size_hint=(.10,.12), pos =(70, 275),background_normal = 'back.png')
global button2
button2 = Button(text='', size_hint=(.10,.12), pos =(500, 275),background_normal = 'forward.png')
global buttonrandom
buttonrandom = Button(text='OPEN', size_hint=(.10,.12), pos =(0, 27))
global layout
Config.set('graphics', 'resizable', True)
global sound
sound = SoundLoader.load(filename='C:\\Users\\myusername\\Desktop\\K-391 - Drop it (Original Mix).mp3')
global sound0
sound0 = SoundLoader.load(filename='C:\\Users\\myusername\\Desktop\\Electro House 2012 By K-391.mp3')
class MyApp(App):
def build(self):
layout = FloatLayout()
button = Button(text='|>', size_hint=(.20,.12), pos =(325, 275))
button0 = Button(text='||', size_hint=(.20, .12), pos=(150, 275))
button1 = Button(text='<', size_hint=(.10, .12), pos=(70, 275))
button2 = Button(text='>', size_hint=(.10, .12), pos=(500, 275))
buttonrandom = Button(text='OPEN', size_hint=(.10, .12), pos=(0, 27))
layout.add_widget(button)
layout.add_widget(button0)
layout.add_widget(button1)
layout.add_widget(button2)
layout.add_widget(buttonrandom)
button.bind(on_press=self.press)
button0.bind(on_press=self.stop)
button2.bind(on_press=self.forwar)
button1.bind(on_press=self.back)
return layout
def press(self,event):
#sound = SoundLoader.load(filename='C:\\Users\\myusername\\Desktop\\K-391 - Drop it (Original Mix).mp3')
if sound0 == None:
sound0.play()
if sound == None:
sound.play()
def stop(self,event):
#sound = SoundLoader.load(filename="C:\\Users\\myusername\\Desktop\\K-391 - Drop it (Original Mix).mp3")
sound.stop()
sound0.stop()
def forwar(self,event):
sound.stop()
sound0.play()
def back(self,event):
sound0.stop()
sound.play()
if __name__ == '__main__':
MyApp().run()
Here are screenshots:
When I click the ">", audio1 is playing, next thing I want is that when I click "||" button or "|>" to pause or play audio1. The same is for "<", but the audio2 is playing, I want only to play or pause audio2. I searched everywhere on the internet for that solution, but it didn't help. Could you please be kind to help if you want? In advance, thank you very much.
Tiny Crate is now Open Source!
https://t.co/kN5mlCRds9
All the assets and code in this Godot 3.5 project are free to use. Get modding! (:
#GodotEngine #IndieDev #GameDev #OpenSource
Are we a godot channel now? I guess the assets can be used for other projects, so I guess it's fine.
The assets seems to be made in Aesprite
every box is 0 and the head of the snake is the length value and the tail is minus one each segment up until the end of the tail which would be 1 and once its 0 then its the back ground, once the head moves to a location then the rest of the body is subtracted by one
Not really sure if I understand it correctly.
So the index of the head would decrease?
Using that iterator in some degree to move the snake with a slower speed in the direction of the head?
123456789👄
The blank space is 0
So the next step for the snake I made above is this
0123456789👄
The snake just moved to the right and every number place is now down 1
The fear I have is that either it becomes in some way a blob of objects or the snake separates itself due to speed.
It's ok if it sometimes gets bundled up, but I am trying to accomplish a snake with a tail that is visible at least most of the time.
The snake will also constantly move with a 2d velocity.
I think I better ask some math nerds.
Can anyone here tell me how can I publish my pygame game? Is there any website that can allow me to publish my game for free?
try itch.io
hi, i'm making pong with python but it's weird
guys can someone tell me which book teach create games with python
When i run it, the left paddle will go up with me just pressing and holding the key but with the arrow keys, if i just press and hold then it doesn't do continuously continue going in whichever direction it's going in
thank you so much for your help
i will try this books
honestly, i would say look at some online tutorials to get started with pygame and then just try and build stuff yourself to familiarize yourself with it. This is just how i would learn
honestly, i'm a web developer but I love games so I decided why not try to make games when I have free time
you might be interested in https://pyscript.net/
Run Python code in your HTML.
I'll try it thank thank you
print(bored) if you want any time create website i'm always here
just send me i message and i'll help you
i know a bit of html and css not as much as you tho so i'll let you know if i need help
Ok bay see you soon 👍
is this Python-related ? 🙂
this is, no matter what :
there's also pygame-script which is more oriented toward games and performance/mobile https://pygame-web.github.io and also brython a full javascript implementation of python3+
Can you use separating axis theorem using both left and right normals?
Can someone send me a course about pygame?
The growth of the video gaming industry has been so prominent and incessant over the years that its estimated worth amounts up to billions of dollars currently. Pygame is a framework that is used for developing 2D games using python as the base programming language. There are various functions and options available in pygame that enable the addi...
hopefully its english
anyone know a keyboard detecting module that replit knows
like something I can import to detect button presses
Also do you know of any website where I can just upload my pygame code and then can share the link to any person who can run it and see how my game works!
Uhh, just upload it on dropbox or something, I guess?
You want them to be able to run it on the browser?
That is entirely possible now thanks to @vagrant saddle
Did you try pyautogui??
no but pygame worked
Cool
not exactly I meant if I want to share my game with someone or show them what I have built I could just send a link of website where they can run my game and see how it works.
you can do that with pygbag + itch.io , selecting html5 game uploading your web.zip and it will give you a link + an optionnal password for running the game, they can be run fullwindow or in a iframe, some demos here https://itch.io/c/2563651/pygame-wasm how to here https://pygame-web.github.io/
Are you trying to get pip?
yup
no...
there's option to install it when you install python
you can also run python -m ensurepip --upgrade
hi, i am making a game but i would like the window be in FULSCREEN. The problem is, not everyone have the same screensize. How could i do for manage to adapt my game at every screens ? mention if u can help me, thanks 🙂
Just say pygame.FULSCREEN where you identfy screen, it should just go full screen no matter what size is ur screen
Yes I finnaly found but thank u
No problrem
you should watch this: https://www.youtube.com/watch?v=OdVkEOzdCPw&ab_channel=MasahiroSakuraionCreatingGames
thanks
actully a super interesting and informative video
Hey 👋, I am making a game in arcade and completed a level. I wanted to know would it be better using views for each levels or should I just use methods in a single view
how can I start game development?
i'd suggest discovering pygame
Ight thx
pygame is good for starters but i don't thinK you can get super creative with it, like making 3d things is impossibly hard, so if you are just starting coding yes, pygame is a very good choice, but if you like to be coding games professionally i suggest maybe use pygame to learn the simple things and than code on things like: C# or C++
Oh- thx for the info, i will keep that in mind
no problem
I don't know if this is a good server to ask this question but I haven't found any other discord server to ask it in
Hello smart people! So I am interested in FreePIE as I it is very helpful for some things and I don't know if it has support for Riftcat VRidge, does anybody know any plugins that can achieve that? Thanks!
I need to use it to read the orientation of the virtual headset for proper positional tracking
do anyone know how to add a displayname on top of a rectangle in python with pygame?
def draw(self, win):
pygame.draw.rect(win, self.color, self.rect)
font = pygame.font.Font('freesansbold.ttf', 15)
DisplayNameText=font.render(str(os.environ['COMPUTERNAME']), 1, white)
text_rect = DisplayNameText.get_rect(bottom = self.rect.top)
win.blit(DisplayNameText, text_rect)
this is from my player class there im creating the player object, i tried to make a code that would add a displayname but it would not work.
why does pygame need a rectangle object to draw a rectangle but not the same for lines and circles
Try running with python mygame.py
Tried. Didn't work. Same issue.
Not really used turtle much, but I would guess your program just starts and completes immediately? Maybe look at some other examples using turtle and compare.
There's no errors happening here. The program just closes.
Usually, a lack of turtle. mainloop() , or one of its variants, will cause the window to close because the program will exit, closing everything. turtle. mainloop() should be the last statement executed in a turtle graphics program
Thanks. It worked.
Call this at the end I guess : https://docs.python.org/3/library/turtle.html#turtle.done
Working with a window can be a bit confusing. Usually you need to enter an event loop by calling some function to keep the window open or the program exist immediatly
What you did before was drawing something and then close the window because the program was done.
I think done() and mainloop() are the same
@random cave just making sure you saw this
hello guys, I am a beginner in this field. I want to make a video game like Yu gi oh, with a hub where everybody could create a game and invite his friend to play against. I have no problem making the front, but I am stuck into making the backend, does anybody have some ressources to learn how to make a backend for a game?
it can be outside python, just the theory would be enough
thanks in advance
Looks like a game you can make with pure http or websocket backend if I'm not wrong
The server would store and know the players "items" and the players state
Actions will sent to the server by the player and the server responds. You need to make sure that the player are in the right state before you accept the actions. (spoofing actions when you are not allowed to do them is not an uncommon issue in online games)
Like in a card game you suddenly play a card you don't really have.
or you spawn items on yourself.
oh I see
I've never used any of these objects/protocols
can you give me some links to learn?
i think it could be something like these buzzwords ( i did not read article) https://medium.com/@iftimiealexandru/from-zero-to-hero-with-webrtc-in-javascript-and-python-in-small-snippets-of-code-part-4-daec44e8cf71
probably if you use pygame you can even run everything inside browser
I am using ursina engine if that helps at all, but for a while i've been trying to fix this issue with 360 movement using lerping that causes it to totally readjust and turn the opposite direction to turn again. it turns correctly, but once getting to 270 degrees it just goes all the way around to the other side and not using the shorter route.
input_vector = Vec2(
(held_keys['d'] - held_keys['a']) or held_keys['gamepad left stick x'], (held_keys['w'] - held_keys['s'] or held_keys['gamepad left stick x']))
self.angle = atan2(input_vector.x, input_vector.y)
direction = Vec2(sin(self.angle), cos(self.angle))
if input_vector != 0:
self.position += direction * time.dt * pSpeed
self.angle = atan2(input_vector.x, input_vector.y)
self.rotation_z = lerp(self.rotation_z, degrees(self.angle) if degrees(
self.angle) < 270 else (degrees(self.angle) == 360), 0.2)
That is my rotation and input for movement and rotation
self.rotation_z = lerp(self.rotation_z, degrees(self.angle) if degrees(
self.angle) < 270 else (degrees(self.angle) == 360), 0.2)
Here is the issue part. I have no clue why its using the longer path instead of the shorter path, nor how to make it use the shorter path.
What if you just lerp the input vector instead? Lerping rotation can be complicated
e = Entity(model='quad', z=-1)
e.direction = Vec3(0,0,0)
def update():
input_vector = Vec3((held_keys['d'] - held_keys['a']), (held_keys['w'] - held_keys['s']), 0).normalized()
e.direction = lerp(e.direction, input_vector, .2)
e.look_at_2d(e.position + e.direction)
Thank you, that was a really good idea. I changed some stuff up a bit to make it work with my code and its smooth now
Does anyone know how I can make a non linear terrain in something like arcade?
So far all the levels I have made are using sprites for the terrain, which makes me wonder if the only way to go about it is to make your own sprites and terrain
think of something like hill climb racing, where you have an uneven terrain
Hi all, i'm looking for a lib that can set xinput values for buttons and axises on a controller. I've found a few xinput libs out there, but they all see to be xinput readers for overlays or for reading values. Anyone familiar with a way to control/alter the xinput outputs?
is there a way to convert pygame into exe and prevent anyone from stealing the code? 💀
Not if they know what Python version and some other pieces of data was used to build your game.
If you don't want people to "steal"/see your code, don't publish it online
😔
can anyone help me with a project
i am working on to create new levels
ping me or dm me
but if you can avoid curses you'll have web compatibility
with pyscript(pyodide) or pygame-script(cpython)
you can have a full window xterm on web to run your python code https://pygame-web.github.io/archives/0.2.0/pythons.html
hey guys
I want to start with pygame, is it the best choice ?
How do I render SVGs in pygame? Do I need to write a shader or something?
you just display them like normal bitmap, recent pygame builds have svg support
it is certainly not a bad choice
wait so I have to find some library to convert the SVGs into bitmaps and then use some pygame function?
so where do I find this functionality?
you need to test the build for it
i don't remember which version introduced it exactly
i think it was with SDL2_image 2.5+
so the build that supports svg has not been properly released
it does depend on underlying SDL2 not just pygame build
ymmv
So what's the best
so what do I do now
where can I look to find out how to install this new build
let me see
You can just pip install it.
pip install pygame
Here's me loading and rendering an svg
using Pygame 2.1.2 (latest stable pypi release)
import pygame
pygame.init()
screen = pygame.display.set_mode((500, 500))
img = pygame.image.load("xmas.svg")
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
raise SystemExit
screen.fill("black")
screen.blit(img, (0, 0))
pygame.display.flip()
As pmp-p mentioned, you just load it like any other image
that's convenient
how would I find out in what update that was added in
I don't see anything about SVG
because it's internal to SDL2
ask on pygame discord some folks may know exactly when SDL2 image was upgraded
i only know that wasm build always has it
ahh ok
ho i did not test pnm
i didnt even know it supported pnm haha
what is pnm
pnm is a text format image that's great for web because you can download it from anywhere synchronously
binary files are all problematic on web
browser restrictions so dev does not block pages while getting megabytes of data
imagine a dev working on optic fiber link , and end user is on 3G
haha maybe but webserver tell browsers what files really are in headers ( content-type: )
it does not, but at least you can get your image in a .txt if you want regardless of (sometimes incredibly akward ) browser decisions
ahh so the web browser automatically splits apart binary files that are being transferred but not with text files?
more like it forbids you to download binary files without special flags and servers all allowing your client and domain to do it
very complicated stuff https://scotthelme.co.uk/coop-and-coep/
are you an expert in security?
nope but i hit those restrictions when running pygame on web
oh wow
Why is the SVG image that I blit on to the window blurry?
import pygame
pygame.init()
screen = pygame.display.set_mode((500, 500))
img = pygame.image.load("example.svg")
width, height = img.get_size()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
raise SystemExit
screen.fill("black")
screen.blit(pygame.transform.scale(img, (width*2, height*2)), (0, 0))
pygame.display.flip()
@dawn quiver
well you scale it to a higher resolution than it is
when it becomes a surface, what image format it was before is irrelevant
if you are using svgs for the scalability, you might want to scale the original image itself and then use that
how do I do that?
idk, id assume you are familiar with editing svgs
oh you mean the metadata describing the size
yeah probably
@dawn quiver so I have to open the file, edit the meta tags programmatically, close it, load the image into pygame, and display it?
i suppose that is a way, you might want to ask around in pygame community tho, some of them may know how to take advantage of svgs with pygame in relation to scalability in a better way
do you need a link to the server?
holy, that's neat
a level editor and a super mario clone i made in pygame work still in progress
Hi, did something have interesting videos / documents about multiplayer game ? 😋 I would like to learn how to make them with the best structures 😁
interesting
hello guys, i'd like make a tab on a lot of lines of code. do u know a way to dont do it manually ?
mention if u can help, thanks
I finally found by myself : select ur block of code and press Ctrl + [
Hey I was wondering if anyone knew a good tutorial on Pong with Pygame that's for more experienced programmers, something that uses hitboxes, so i guess just pong if it wasnt made a bazillion years ago
edit: remembered google is very much a thing
if by hitboxes you mean colliderect there's this one https://pygame-web.github.io/showroom/pygame-scripts/org.pygame.touchpong.html
You can also press Tab instead of Ctrl + [
Question In What website I could learn pygame commands?
pls better quality
😅 It is a good qulaity video.
:/
There are some options, but not a lot of them also teach Python from the ground up. Are you comfortable with Python?
Yes It's way more easier than Java
Alright then,
RealPython is a pretty good bet, https://realpython.com/pygame-a-primer/
Covers some basic utilities, important concepts and what not that shouldn't be hard to grasp if you are familiar with the language
How could I make a save for the player ?
serializing ?
would like to make some checkpoints in the game (auto), that saves the variables values, and if it's possible, make a jump in the code so the player could get back where the last checkpoint saved the data
Depends, is your game entirely local?
i have a question, so i have a .exe file made with pyinstaller and i want to change the icon for that exe file but i can't make the exe file again with using the --icon="icon location" command because when i do it will just give me a file called "noneexe"
Can anyone teach me 3D camera and 3D matrix implement in pygame?
can someone help me with sprite sheets
hi, i know im not typing in the right channel but couldnt find a better one. i am a beginner on python and i want to get better to make games using python, if anyone can give me free courses i would really appreciate it, thank you <3
can somebody help me?
import pygame
from sys import exit
#important Variables
pygame.init()
screen = pygame.display.set_mode((1000, 500))
pygame.display.set_caption("GAME")
#Variables
#Player
player = pygame.draw.rect(screen, "#93E9FF", [500, 250, 40, 40])
player_rect = player.get_rect(center = (500, 250)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
pygame.display.update()
line 12 it does not work
In this tutorial you will learn to create a runner game in Python with Pygame. The game itself isn't the goal of the video. Instead, I will use the game to go through every crucial aspect of Pygame that you need to know to get started. By the end of the video, you should know all the basics to start basically any 2D game, starting from Pong and ...
u understand the basics of python?
ok
like till OOPS
ok
so when u watched his tutorial
watch this from clear code
In this tutorial you will learn to create a runner game in Python with Pygame. The game itself isn't the goal of the video. Instead, I will use the game to go through every crucial aspect of Pygame that you need to know to get started. By the end of the video, you should know all the basics to start basically any 2D game, starting from Pong and ...
import pygame
from sys import exit
#important Variables
pygame.init()
screen = pygame.display.set_mode((1000, 500))
pygame.display.set_caption("GAME")
#Variables
#Player
player = pygame.draw.rect(screen, "#93E9FF", [500, 250, 40, 40])
player_rect = player.get_rect(center = (500, 250)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
pygame.display.update()
line 12 isn't working
can somebody help me?
@smoky stump You're missing a ) at the end of that line, look closely
it does not not work either
AttributeError: 'pygame.Rect' object has no attribute 'get_rect'
its giving me this error
get_rect is used to return a rectangle object from an image.
You didnt use any image. You just created a rectangle
get_rect is used when working with images
pygame.rect.move_ip
thats it?
i am confused rght now
There are two methods
var = pygame.rect.move(arg1,arg2)
//Here arg1 and arg2 are integers
coordinates?
2-
pygame.rect.move_in(arg1,arg2)
//It takes the var object itself too
ya
move_ip if you are making classes
and move if you are not doing oop
also syntax for your code will be
player = pygame.Rect.move(player,100,100)
(1st arg is the rect object and others are its coords)
@untold sphinx thnks
np
wait
i ran the code
but
topleft corner was in the at those coorditanes
i want the center of the rectangle to be in those coorditanes
what is the best library?
Pygame
OK THANKS
No problem
Does anyone get this problem when trying to freeze numba on linux? Is there a solution? https://stackoverflow.com/questions/73494658/building-the-setup-py-file-in-cx-freeze-gets-me-this-error-no-such-file-or-dir
Is pycharm a good platform or else anything good other than that?
I assume since you are in the game development channel you are asking whether it is good for game development specifically?
well, whatever editor you are used to for Python is a good choice for game development
Some really good game devs like dafluffypotato used to use IDLE at some point, and made great looking games nevertheless
Pycharm is nice, yeah
its debugger specifically can help break the project down into steps and see whats going on
Hello, can someone help: This is my current code:
import math
import pygame
class Player(pygame.sprite.Sprite):
BLACK = (0,0,0)
def __init__(self,screen):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("./sprites/sprite.png").convert()
self.image.set_colorkey(self.BLACK)
self.image = pygame.transform.scale(self.image, (64, 64))
self.rect = self.image.get_rect()
self.rect.center = (1024 / 2 , 768 / 2)
pygame.draw.line(screen, (0, 0, 0), (0, 0), (100, 100))
pygame.display.flip()
self.image_clean = self.image.copy()
self.rot = 90
def update(self):
self.image = pygame.transform.rotate(self.image_clean, self.rot)
def main():
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((1024, 768))
pygame.display.set_caption("Raycaster")
clock = pygame.time.Clock()
white = (255,255,255)
player = Player(screen)
player_rot = 0
all_sprites = pygame.sprite.Group()
all_sprites.add(player)
running = True
while running:
screen.fill(white)
all_sprites.update()
all_sprites.draw(screen)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
mouse_x = pygame.mouse.get_rel()[0]
if mouse_x < 0:
player_rot = 3
if mouse_x > 0:
player_rot = -3
if mouse_x == 0:
player_rot = 0
print(mouse_x)
player.rot += player_rot
keys = pygame.key.get_pressed()
if keys[pygame.K_w]:
player_cos = 2*math.cos(player.rot)
player_sin = 2*math.sin(player.rot)
player.rect.x = player.rect.x + player_cos
player.rect.y = player.rect.y + player_sin
clock.tick(60)
pygame.display.update()
pygame.quit()
quit()
if __name__ == '__main__':
main()
The problem is that when moving the mouse cursor, the sprite turns which is OK. But it does not move in the direction which is looking. It goes in a random direction.
Does any one spot a problem in my code?
Thank you.
I just posted my question on stackoverflow because its too big for discord, :-https://stackoverflow.com/q/73677993/16004995
Im sorry if its against the rules
probably would have better matched https://gamedev.stackexchange.com
I followed a tutorial, and customized the code a bit by myself. I decided i wanted to learn Python so I started like 2 or 3 days ago. I made this pong game:
import turtle
wn = turtle.Screen()
wn.title("Optimized - Pong")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)
paddle_a = turtle.Turtle()
paddle_a.speed(0)
paddle_a.shape("square")
paddle_a.color("white")
paddle_a.shapesize(stretch_wid=5, stretch_len=1)
paddle_a.penup()
paddle_a.goto(-350, 0)
paddle_b = turtle.Turtle()
paddle_b.speed(0)
paddle_b.shape("square")
paddle_b.color("white")
paddle_b.shapesize(stretch_wid=5, stretch_len=1)
paddle_b.penup()
paddle_b.goto(350, 0)
ball = turtle.Turtle()
ball.speed(0)
ball.shape("square")
ball.color("green")
ball.penup()
ball.goto(0, 0)
ball.dx = 0.2
ball.dy = 0.2
def paddle_a_up():
y = paddle_a.ycor()
y += 20
paddle_a.sety(y)
def paddle_a_down():
y = paddle_a.ycor()
y += -20
paddle_a.sety(y)
def paddle_b_up():
y = paddle_b.ycor()
y += 20
paddle_b.sety(y)
def paddle_b_down():
y = paddle_b.ycor()
y += -20
paddle_b.sety(y)
wn.listen()
wn.onkeypress(paddle_a_up, "w")
wn.onkeypress(paddle_a_down, "s")
wn.onkeypress(paddle_b_up, "Up")
wn.onkeypress(paddle_b_down, "Down")
while True:
wn.update()
ball.setx(ball.xcor() + ball.dx)
ball.sety(ball.ycor() + ball.dy)
if ball.ycor() > 290:
ball.sety(290)
ball.dy *= -1
if ball.ycor() < -290:
ball.sety(-290)
ball.dy *= -1
if ball.xcor() > 390:
ball.goto(0, 0)
ball.dx *= -1
if ball.xcor() < -390:
ball.goto(0, 0)
ball.dx *= -1
if ball.xcor() < -330 and ball.ycor() < paddle_a.ycor() + 50 and ball.ycor() > paddle_a.ycor() - 50:
ball.dx *= -1
elif ball.xcor() > 330 and ball.ycor() < paddle_b.ycor() + 50 and ball.ycor() > paddle_b.ycor() - 50:
ball.dx *= -1
I still need to add the scores, and fix a few ball glitches
But the problem is:
I dont know how to make the paddless smoother
they keep adding by 20 pixels
but I want to make them smoother
I dont know if it could work, but i could try to increase the speed of the paddles, and decrease the pixel increase amount
These are the functions I made:
please suggest changes 🙂
def paddle_a_up():
y = paddle_a.ycor()
y += 20
paddle_a.sety(y)
def paddle_a_down():
y = paddle_a.ycor()
y += -20
paddle_a.sety(y)
def paddle_b_up():
y = paddle_b.ycor()
y += 20
paddle_b.sety(y)
def paddle_b_down():
y = paddle_b.ycor()
y += -20
paddle_b.sety(y)
wn.listen()
wn.onkeypress(paddle_a_up, "w")
wn.onkeypress(paddle_a_down, "s")
wn.onkeypress(paddle_b_up, "Up")
wn.onkeypress(paddle_b_down, "Down")
damn soviet union knows python 💀
just?
Hello, if I want to make a 3d game what module should I use? I'm seeing pygame, ursina, and panda3d but idk which ones best
i think pygame is only 2d
you can draw wireframe with pygame if the gpu has no GL support
Ursina if you want something high level. Panda3d if Ursina isn't giving you enough control
def __init__(self, data = [1.0, 2.0, 3.0]):
self.data = data
items = [item(), item(), item()]
for i in range(10):
for n_item in items:
item_changed = item()
item_changed = n_item
item_changed.data[0] = n_item.data[0] + 3.0
print("item_changed is ", item_changed.data[0])
print("item is ", n_item.data[0]) ```
May someone explain why the n_item is also being modified?
just do ```py
class item:
def init(self, data = None):
if data is None:
data = [1.0, 2.0, 3.0]
self.data = data
in init data is assigned the same mutable
hello, i have a question, i made this program that tells you the apps that are running in you pc:
cmd = 'powershell "gps | where {$_.MainWindowTitle } | select Description,Id,Path'
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
for line in proc.stdout:
if not line.decode()[0].isspace():
print(line.decode().rstrip())
but when use the output, so line.decode().rstrip(), it will put all the information in one line, how can i fix that
what do you guys think of my first game https://gist.github.com/CoolGuyBraydan/16258d999e2929f9f3888b0f40d06564
Hey @past bone!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
https://paste.pythondiscord.com/unepewuzec thoughts? my first pygame, took me 2 days to complete but i still got there (Was looking at a tutorial for part of the code)
hard to tell without assets, codewise i'd say use only one update loop and make menu / game state function
and it looks a lot like this one https://github.com/shorouq-alzaydi/Space-Shooter-Game-
does anyone know how to make this code return a list:
cmd = 'powershell "gps | where {$_.MainWindowTitle } | select Description'
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
for line in proc.stdout:
names=line.decode().rstrip()
maybe look at how https://pypi.org/project/psutil does
ok ty
yea that’s actually the guy i watched the tutorial off of. i don’t really code in pygame but i decided to try it out tho
Hi Guys
i need someone who want to be in a beginner group who also use Godot
@harsh oyster i'm in
dm me
anyone know how I can make shift toggle between two actions in ursina, or an ursina discord server?
def input(key):
if key == "shift":
camera.x=.5
i want it to be so shift can set camera.x to .5 and 0, toggling between eachother
you can use an if statement:
def input(key):
if key == "shift":
if camera.x == 0:
camera.x = .5
else:
camera.x = 0
tysm
now you can try it online, i changed the code a bit regarding what i said earlier just look at the html source https://pygame-web.github.io/showroom/pygame-scripts/org.space.shooter.html
working on a game and wanting suggestions of what ||weapons|| to add, already have ||pistol|| rasing base damage to 20, and R.B.G.9000, rasing base damage to 75 (max) any suggestions?
Probably add melee weapons, like swords
@dawn quiver Cool, that sound like a good idea, thanks
What kinda game?
@fallow glade no real theme, it can be anything
Molotov cocktail which leaves a fire hazard for a duration on the object/location that damages it and nearby stuff
slingshot would be fun
okay, cool idea
I need some ores to make into armor, currently have iron ore, raises defense to 5, extreme ore, raises defense to 10 (max), Any suggestions?
yeah
no graphic interface
all in the command box
Is there any efficient way to slow down animations in arcade? As far as I know, the best way is to just have more individual frames and just skip through each one by increments to make it seem as if the animation is slowing down or something. E.g play frame 2, then frame 6 , then 10 etc.. to add that slowed effect or something
Actually found a somewhat solution by passing a custom delta_time to the update_animation() for that specific sprite, but if anyone has any better ideas do lemme know
If you're making a game then should you have a game loop for the main menu, and then when you start a game, it calls a function with its own separate loop? Or is that bad code and there should only be one loop?
The most most simplest way I don't know how I only just discovered, was to just bootleg what the docs had with how they handle their animations. Just index an array, but to slow down the animation instead of increment +=1, increment +=0.5 or something, then when accessing the array just use round(increment). So way the same frame will be used twice as both 0.5 and 1 rounds to 1
Now for an expresso
Good question, I spent ages trying to figure this out but never understood it. At least in arcade, as long as I never used any type of sleep() or severely blocking calls I could run as much threads and processes as I wanted to in the background in a continuously loop without any obstructions
It will all be one thread. It will be like: the main menu function calls the game function and waits for it to finish.
And both have their own loops
whats up fatasses
As hsp suggested, <@&831776746206265384>
#game-development message
!warn 1007746855179923498 "whats up fatasses" is a totally inappropriate way to speak on our server.
:incoming_envelope: :ok_hand: applied warning to @rotund quail.
made this game today its pretty flawless especially in terms of graphics 🙂
That's really good
probably maybe look at https://github.com/DaFluffyPotato/pygame-shadows
more VR in Python for you folks :
https://www.youtube.com/watch?v=4Q2f0dKh8vE
Air to air combat sandbox, created in Python 3 using the HARFANG 3D framework.
The sandbox features :
- Ocean / terrain shader
- Skydome shader
- Clouds
- Autopilot (Take-off, landing, fight)
- Network mode
👉 Direct link to the repository: https://github.com/harfang3d/dogfight-sandbox-hg2
📍 Join us !
Install Harfang3d: https:/...
I have idea of pen fight game
Pygame noob, current status on my project, I'm trying to figure out how to do multiple levels and think I'll need to rebuild the full thing to get that system working
Thanks for watching today's Unity University video! Today we're talking about how to rotate the player's arm to your mouse. We also fix the issue of the arm being upside down! Leave a like if you liked it!
-- Source Code --
https://pastebin.com/4HFMGBJ9
how can i make this in pygame
i couldnt find anything from google
hey, i have a question, so i made a game with pygame and than made it exe with pyinstaller, but when i run it in other devices than mine it will think its a virus and it will not let it run, can anyone help me with that
Do you understand what each line of the C# code is doing and the math being used?
im just a beginner who is looking for examples
i mean i cant write that code by myself
i need someone to explain
I recommend learning some mathematics for game developers as it will let you write code for these kinds of things without having to constantly look up tutorials for specific things.
And translate from other code.
i can help you
import math
def fixangle(angle):
while angle < 0:
angle += 360
while angle > 360:
angle -= 360
return angle
def rotateIMG(img,angle):
return pygame.transform.rotate(img,abs(360-angle))
def fromAngle(x,y,tx,ty):
r = math.atan2(ty - y, tx - x)
angle = float(math.degrees(r)+90)
angle = fixangle(angle)
x_vel = math.cos(r)
y_vel = math.sin(r)
return {
"x_vel": x_vel,
"y_vel": y_vel,
"angle": angle,
}
this is the code i used! its prettty simple
plug in the x,y of the player and mouse like this:-
angle = fromAngle(playerX+playerWidth,playerY+playerHeight,MouseX,MouseY)["angle"]
and then rotate the img of the player hand using the rotate img function
i legit did tht to get this above code; it was originally in java so i converted it to python
works great for 2d fps bullets and gun based games
m
I made this over the last 2 days, still working on it
Commandline version of paper's please 😄
You can check out the source code or play it yourself here
Would love any reviews, or any comments about the code! I'd love to improve as much as possible
Hello, does anyone know any good templates for games?
Are there any game engines that use python?
a lot, but fewer are built for python like pygame, arcade, Panda3D or Harfang3D
Don't use --onefile and if that does not work, contact the anti-virus providers, or sign your executable (if on Windows).
I get what you mean by not alot of game engines are for python but those are libraries im looking more for a game engine like unity or the unreal engine running python (if it exists)
probably blender game engine then
is there anyways to make it a onefile after so the problem will be fix and its in onefile, because i don't know how but other programs don't have this problem, its only with python
Vector object not callable? how do i split. extract values from this? Im pretty sure it spits out a 3vector.
only python or other language
Looks like you made it in Unreal Engine 5. Insane work
Very interesting
1 coder & 2 3D artists
(plus a couple of assets found on cgtrader)
🙂
if anyone is free i have a question in #help-ramen
wait so you are in it too?
I’m the guy wearing the VR headset, yes
And the coder who implemented the dogfight is a coworker 🙂
wow
pygame noob here, im curious if its possible to make snake on a xyz plane (aka 3d) instead of on a xy (2d) plane with relative ease
if player.y > map_level:
chaser_y += 1
if player.x > chaser_x:
chaser_x += 1
if player.x < chaser_x:
chaser_x -= 1
if player.y < map_level:
chaser_y -= 1
looking at this is triggering me, there must be a way to write it in one or two lines
No
def compare(pos, other):
return (1, -1)(pos > other, pos < other)
charser_x += compare(player.x, charser_x)
charser_y += compare(player.y, map_level)
This is what I think of, you may or may not find it neater
interesting
not necessarily neater to me, but thanks
can somone one knwo a good free tutorial video fighting game when you do hit box and IA ennemie please?
could you elaborate on why that may be difficult?
Pygame isn't made for 3d games. It involves more math than you may be assuming. Even drawing a rotating cube is a lot of work with pygame, we have some examples you could look at, though.
https://github.com/Matiiss/pygame_examples/tree/main/pgex/examples/3d_cube
Pygame is pretty barebones, it doesn't support loading OBJ files.
You'd have an easier time using pygame with moderngl/opengl for anything 3d related.
There are specific libraries for 3d games you could take a look at.
https://www.ursinaengine.org/
https://www.harfang3d.com/en_US/
https://www.panda3d.org/
What is a "more math than im assuming", is this linear algebra type math?
does that math get easier with using ursinaengine to name an example
looks pretty good
What's the best approach in splitting online functionality for a battleship game?
The approach i can come up with is that there's a game class and theres a function that listens for messages in another thread. that class controls who's turn is active and such
thanks!
you could send moves like b4
whenever someone sends a move
the other person now takes their turn
so whoever sends a move dictates whos turn it is
This is just a guess
I figured less things to send over the network the better
well in battle ship isn't the state static after setup?
so you could send each others boards and merge them together
then everything is pretty much client side
lol its weird
like playing a game with youself
Hello if someone are good with pygame if he can help me with a weird problem im in #help-corn thanks
can i make 3d and realistic game with this app @round obsidian @viscid venture @idle yacht @dense hare
Realism isn't a matter of any one app but the amount of development time and effort put into it. High end, realistic 3D games are not made by any one person, but teams of dozens or hundreds of people.
if anyone is free I need some help in #help-coconut
does anyone want to test my first project its a rock paper scissors game but all made by myself and not in cmd its in its own window with buttons if you want to test it then dm me
hey
what's the best 3d game library for python ofc
my guy i noticed this channel only now
does python get used for 3d games?
ive never heard of it or seen it
Yes.
There's not a best but Ursina, Panda3d, and Harfang3d are great libraries to look into
oh ok thanks
Guys where can I learn Game development?
Hey
Guys help
What part of game development?
i think there were some books about gamedev in there https://pythonbooks.revolunet.com/
I dont know anything about game dev. I want to start
I looked at CS50's Introduction to Game Development but that certificate will not get me a job.
I suggest you start out with a Lua-Based Platform and make something then move bigger out of that platform (also you have 90% of the tools needed to make a game on those platforms)
Hello.
I need help.
import tkinter as tk
from tkinter import ttk
from tkinter import *
import time
lollipops = 0
count = 0
def clicked():
global count
global lollipops
count = count + 1
label1.configure(text=f'You now have {count} candy!!!')
if count > 19:
count = count +1
if count > 49:
count = count +2
if count > 99:
custom_button1= ttk.Button(windows, text="Trade in 10 candies for 1 lollipop!", command=lollipop)
custom_button1.grid(column=1, row=1)
def lollipop():
global lollipops
global count
label1.configure(text=f'You now have {lollipops} lollipops!!!')
count = count - 10
lollipops = lollipops + 1
windows = tk.Tk()
windows.title("Candy Clicker Alpha")
label = tk.Label(windows)
label.grid(column=0, row=2)
label1 = tk.Label(windows)
label1.grid(column=0, row=1)
custom_button = ttk.Button(windows, text="Click on me to get free candy!", command=clicked)
custom_button.grid(column=1, row=0)
windows.mainloop()
This is currently the code I have.
Gotta pre-fix that with ```py for a formatted code block
But when you buy a lollipop, the game just breaks.
Like the code just does not make sense.
Thanks
Anyone know where I can find some big, decent quality tilesets for a top down game?
Can someone help me at help-kiwi?
subreddits like r/gamedev often have links to free asset releases or promotions
Hi, is there anyone who wants or can try my python game and mabye tell me if i did something wrong?? 🙂
Nice
Any good guides or tutorials about large, scalable pygame projects?
Is there any alternatives to Pygame
This comes from experience, we are working on a guide rn but its incomplete
https://pygame-guide-for-sneks.github.io/
lots
ahhh
really awesome
go and learn then
can somebody help me?
i want to code a 2D player movent system but if i test it the figure is cloning itsself
in pygame
you should fill the screen to clear it
so the structure should be something like this:
screen.fill(clear_color)
screen.blit(...)
pygame.display.update()
in the while loop
Thanks
👉 In this tutorial, we will see how to display a VR scene in Python:
-VR matrices
-VR setup
👉 Part 2 in few days
👉 Harfang core, to download shaders:
https://github.com/harfang3d/harfang-core-package
👉 Tutorial resources:
https://github.com/harfang3d/video-tutorials-resources/tree/main/display_a_scene_vr
👉About usage of assetc:
https://youtu...
When building a scalable PyGame project
I'm trying to think my way towards some best practice
It looks as though the usual strategy is to use a massive finite state machine to determine which "domain" of the game is currently visible (the game proper, or the save game screen, or an item screen, and so on)
This solution isn't tremendously scalable though. Nesting finite state machines is a little better. You can have a main "game" object which stores its display state, toggling between "pregame menu", "main game", "pause menus", and so on. Each of these "domains" of gameplay are themselves an object with their own render() methods and their own FSMs to control what is and isn't visible
Does this all sound logical?
Nested scenes makes sense yes. I'd actually make it a stack of scenes though, so you could do something like push a new scene on top, then when that's closed return to whatever is previously shown.
Maybe also add a flag on each scene class which determines if the next scene also needs to render (game scene rendering behind the menu).
import pygame
from sys import exit
#important Variables
pygame.init()
screen = pygame.display.set_mode((1000, 500))
pygame.display.set_caption("GAME")
clock = pygame.time.Clock()
player_x = 500
player_y = 250
#Variables
#Player
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
player = pygame.draw.rect(screen, "#93E9FF", [player_x, player_y, 40, 40])
player_rect = pygame.Rect.move(player, 500, 250)
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
player_y -= 5
pygame.display.update()
clock.tick(60)
if i run this code the rectangle is cloning itself up when i click the up button
i want a player movement
Can smbody help me?
i fixed it
!!!
how did you fix it im having the same issue
See my answer further up
Before u drawing the rect u need to fill the the screen with any Color
oh ok
thanks
would anyone be interested in collaborating on the creation of a game?
What kind of game?
Any kind of game
anyone working with Psyhopy to build experiment?
you mean Psychopy?
ah yeah, I was typo..
is ther a game engine for python? something like unity
You could use godot with python bindings
maybe blender game engine too
Hello, I'm sure this question may have been asked before, but is Pygame suitable for moderately large projects? For example, would it be possible to achieve something like Mother 3 in Pygame without large performance drops?
I wanna make a trading card game in python with visual aspects in the vain of magic the gathering and hearthstone, where would I begin? I know like, the basics of normal python but nothing when it comes to game development in python or visual aspects
Hey @sudden oak!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Try making some terminal games such as tic-tac-toe, battleship, and a text-adventure. Then try learning pygame and some basic mathematics for game developers. Make some 2D games such as Pong, Breakout, Tetris, Zelda-like (this can become as complex as you want it to). You then should have enough skills to be able to make a simple 2D card game simulator. Then if you want to get into 3D make sure you have a more solid understanding of game mathematics (linear algebra mostly), and then try something like Ursina / Panda3D. You will also need to learn shader programming at some point for visual effects (GPU programming), but you can leave the visuals for later.
*You also need to learn how to make some game AI to play against, this will involve learning how to make things like a tic-tac-toe AI, battleship AI, chess AI, etc.
The math is nothing too crazy and there are many resources on it: https://www.youtube.com/watch?v=DPfxjQ6sqrc
This video outlines what I believe are some of the core principles you need to understand to make dynamic computer games, covering vectors, angles and motion. I've tried to present it in such a way that highlights the relationships between these principles, so you can identify when to use one or the other, or combinations of them. It is by no me...
Welcome to my four part lecture on essential math for game developers 💖 I hope you'll find this useful in your game dev journey!
This course will have assignments throughout, if you want to maximize your learning, I recommend doing them!
If you are enjoying this series, please consider supporting me on Patreon!
🧡 https://www.patreon.com/acegik...
I don't really mind about the visual or audio sides, ill probably just do copy and pasted visual aspects, this is actually probably more a proof of concept for a physical card game tbh
I would print the cards and test the idea that way.
Yes but if you really worried about performance Arcade would probably be better
anyone have a valid link to the pygame discord?
ping me if you do
there's an invite at the bottom of https://pmp-p.github.io/pygame-wasm
thanks
Hey gamedev people! I'm building a topdown adventure game as my software development group project
I'm doing lots of reading of course, but I'd love some tet-a-tet with some experienced game devs so I might get a fuller picture of what's in store
I guess my most important question is: what are the questions I need to be asking? What do I not know that is key?
Beyond this, what are the core components of a topdown game? What sort of organizational structure should I use? In what sequence should we be implementing it?
Hey im new to this Python coding thing And im trying to make a game And i want to make like a ability to make IT snap on to a player so if anyone could help me please do
Hey yall, curious about how you would model an item class for game items that all do different things
I want to make an item class, but items are such complex objects. Things like price, rarity, durability, function, name, whether or not they can stack, etc.
Does anyone have an example
Yea
Hey @dawn quiver!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
I'm reading about Composition vs. Inheritance, and it looks like composition would be the best way to do this. I would love an example though
Both are bad and add unnecessary complexity. You can just use a dict or a class instead
I don't think you understand the question
Each item would have different funcitonality
They would all have names, prices, durability, etc.
But how would I expand the item class to also include functionality for different items? For example, I could subclass and make a RestoreHealth class and make it so items that restore health are in that class, but then what about items that do very specific things?
A dictionary wouldn't really be helpful for complex functionality for different items
Do all items share some common functionality?
Make a class to hold the common data. Then implement 3 items manually, externally (just plain old functions). After that you can try to design some kind of generic system.
If you are unsure how to design something just do it the most direct, non-generic way. Then after you have a few samples, you can try to find commonalities and design around that. Guessing the design up front is error-prone (and a waste of time (unless it's some giant project with a big team which requires forward planning for coordination) (or you already made something similar before in which case you can predict what the design will be like with high enough accuracy (this is how generic game engines are born))).
I see
In game dev this is often summarized as "make the game instead of making systems," but I find that lacks the important detail that you can build systems out of the samples gained by implementing some of the parts (generalization).
It is similar to how in mathematics one plays with specific cases before generalizing later as your intuition / idea of how it should be built will be more informed at that point.
I've made that kind of inventory system before. I just assigned a function called on_use to the items to customize what should happen. I just used a dict for each item, containing name, description, value, effect, etc.
@tranquil girder, how did you store the effect? did you store python code in a dictionary?
You can refer to a function in a dict, or use a lambda, or a string that get used by exec, or some custom solution
When I made a complex spell system for a different game, I used a Spell as a base class just to set defaults and made every spell inherit from that one class. If you're going to use inherence, you better keep it simple and avoid multiple levels deep inheritance and definitely avoid multiple inheritance. Keep it simple. My spells were kind of like complex items which had state like cooldown, damage over time, side effects and combinations. So using classes can work too
So for your spell system, you had subclasses for specific spells, and you would have class functions that would do whatever the spell did?
Polymorphism via subtyping.
An example would be a bunch of spells each having a cast method. That would be their common interface.
If you find yourself having an if-else chain where each if checks the type of spell, you probably want polymorphism.
Got it, I'll look into that
The more specific term for what is happening when you call cast on a spell is dynamic dispatch.
Can't make an executable(.exe) from a Pygame Code!
Install Command: ```py
pyinstaller --noconfirm --onefile --windowed --icon "G:/Python Projects/Pygame/Assets/spaceship.ico" --name "Space Escaper.exe" --version-file "G:/Python Projects/Pygame/Spce Escaper Version File v1.txt" --add-data "G:/Python Projects/Pygame/Assets;Assets/" --hidden-import "pygame" "G:/Python Projects/Pygame/main.py"
**Problem:** The Issue is when the `.exe` created and I try to run it, shows this Error! \**Attachment\**
Someone help me!
I used pygame to make the game
Hello
Was it written in a ve?
yeah! pip install pygame!
You need to install it in the venv directory
How?
why not design roblox game
I think you choose to install pip.exe in the venv directory.
Hello Everyone, I am facing difficulty to automate calculating the sub-surface damage on glass surfaces. I have to find the inner and outer diameters as shown in the figure. I have a problem finding the inner diameter (green), it has to be the area with minimum/no scratches from the center.
How can I install it?
Btw, there are no venv directory in my pronect directory
object oriented programming
You need to activate your venv in your command prompt or your terminal then type pip install pygame on the command prompt or the terminal that you have activated your venv
okay so i've got this code
def draw_oscilator(height, width):
for x in range(1000):
y = float(height * math.sin(x * 0.1) + width)
pygame.draw.circle(screen, (255, 255, 255), (x, y), 1, 5)
running = True
height_flag = False
width_flag = False
height = 10
width = 10
# set fps to 10
pygame.time.Clock().tick(1)
while running:
pygame.Surface.fill(screen, (0, 0, 0))
for events in pygame.event.get():
if events.type == pygame.QUIT:
running = False
pygame.quit()
if events.type == pygame.KEYDOWN:
print("\033c", end="")
if pygame.K_d:
draw_oscilator(height=height, width=width)
if pygame.K_h:
height_flag, width_flag = True, False
print(f"width: {width_flag} height:{height_flag}")
if pygame.K_w:
height_flag, width_flag = False, True
print(f"width: {width_flag} height:{height_flag}")
if pygame.K_UP:
if height_flag:
height += 1.0
if width_flag:
width += 1.0
print(f"width: {width} height:{height}")
if pygame.K_DOWN:
if height_flag:
height -= 1.0
if width_flag:
width -= 1.0
print(f"width: {width} height:{height}")
# if pygame.K_c:
# print("\033c", end="")
pygame.display.flip()
``` and the issue with this is, my global variables arent being updated. I wrote height_flag and width_flag as globally false, but for some reason, within the events loop, they're all being called for some reason
also, what i draw ends up disappearing, idk where to put the refresh black
Ik but If I installed in my PC it'll work in my pc
not yours if you don't install pygame
Is that what you want?
You could use setuptools to do it or create an msi
I want to make an executeable that wonk all computers
without even having Python
Like Other Applications
How?
@warped elk
msi is an installation program like a zip file with options, it extracts the files for your program only works on windows
setuptools you publish your game on pypi in order to install pip but you have alot to learn
Can you send me how can I use msi?
you are flipping only when an event occurs, drawing and pygame.display.flip() should happen in while running not the for loop
oh wait mb yeah i fixed that
import turtle
wn = turtle.Screen()
wn.title("Pong Emil")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)
#Paddle A
paddle_a = turtle.Turtle()
paddle_a.speed(0)
paddle_a.shape("square")
paddle_a.color("white")
paddle_a.shapesize(stretch_wid=5, stretch_len=1)
paddle_a.penup()
paddle_a.goto(-350, 0)
#Paddle B
paddle_b =turtle.Turtle()
paddle_b.speed(0)
paddle_b.shape("square")
paddle_b.color("white")
paddle_b.shapesize(stretch_wid=5, stretch_len=1)
paddle_b.penup
paddle_b.goto(350, 0)
#Ball
#main game loop
while True:
wn.update()
why there is a line?
Hi, it’s possible to make a surface (in pygame window) who content many objects on pygame please ?
parentheses is missing in paddle b code for penup
In pygame, how can you just change the textures?
Exponential snake, with reverse gear

Exponential because every time you eat an apple, you get 50% longer
I'm mildly 🅱️ad at snake
#help-pancakes with pygame collisions
What do ya think of this Milk Carton Sprite I am incorporating into my game
why are the controls so fast?
wdym?
the snake speed?
well, it's more spicy this way
Can someone help me in #help-pancakes
Looks good 👍
Thanks
So I was gonna make a retro guitar melody then opened piano and one thing led to another and I made this song for the menu screen
Opinions?
How does one handle multiple game screens in a PyGame game, and, how does one handle routing input events to the right actions
Is it something like...
class Controller():
def __init__(self) -> None:
self.currently_focused = player_object
def get_events():
for event in pygame.event.get():
if event.type == pygame.KEYDOWN and event.key == pygame.K_UP:
self.currently_focused.on_up(event)
if event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
self.currently_focused.on_down(event)
if event.type == pygame.KEYDOWN and event.key == pygame.K_LEFT:
self.currently_focused.on_left(event)
if event.type == pygame.KEYDOWN and event.key == pygame.K_RIGHT:
self.currently_focused.on_right(event)
class Game():
def __init__(self) -> None:
self.state = 'main-game'
def run(self):
while True:
if self.state = 'main-game':
self.render_main_game()
else if self.state == 'main-menu':
self.render_main_menu()
else if self.state == 'save-menu':
self.render_save_menu()
else if self.state == 'load-menu':
self.render_load_menu()
...
Hi, just a simple question anyone know if it’s possible to run a client websocket at the same time than a pygame window? I can’t make that because I have a “await” who wait to receive the information. That stop the pygame loop. Thank you for your help.
Whats the best tutorial for learning pygame
#help-cheese with pygame scores
In this tutorial you will learn to create a runner game in Python with Pygame. The game itself isn't the goal of the video. Instead, I will use the game to go through every crucial aspect of Pygame that you need to know to get started. By the end of the video, you should know all the basics to start basically any 2D game, starting from Pong and ...
i was drawing and i remeber a python lol i hope it make you cheers guys.....
Not really you can just use a game engine like Godot, Unity or Unreal.
Hey I have a question for Pygame. Where should I be keeping my Event Handlers?
#Event Handler
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
print('Key Pressed')
OHHH
im dumb
nvm
I had 2 event Handlers that's why
event.get() exhausts the pygame events that are waiting to get handled. In my limited experience I use gameobject (unity style) classes with their own update() and render() methods which can have their own event handlers, reading the events from a centralized list of events in a single Gamestate instance that is updated with event.get() once per tick. Then you can categorize your objects into Scenes, and have a single infinite loop in your program entry point that update()s every object in your active scene
oh thanks
you can even categorize your "subsystems" this way, e.g. in a jrpg style game the overworld scene could have a PartyController gameobject with an event handler that handles party movement, the battle scene could have a similar BattleController with an event handler for selecting spells and attacks etc. This has the bonus side effect that makes your game modularized instead of hardcoded (handling game systems as if they were regular gameobjects like your player character, I mean)
anyone got tips for improving player retention 
Do playtesting to figure out why they quit
Can someone help me with this Event handle?
Put up forums for "Ways to make the game better"

discord bot game, everyone i give the game to test just says its really good
and half of them are just random people i dont know, pretty frustrating
Was following this tutorial, it's great but something odd is happening in the drawing with rectangles section, because he said that setting a border width extends beyond the rectangle, but in my case it's not doing so (used different color to demonstrate)
Same lines of code as in video
pygame.draw.rect(screen, 'Pink', score_rect)
pygame.draw.rect(screen, 'Gold', score_rect, 10)
Not really game breaking, but it is weird as even the docs say the border edges will grow
Hey I have a question
Why when i put this command it fills the screen white for a second and stops the music completely
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
Game_Started = True
print('Game Has Started')
if Game_Started == True:
WINDOW.fill(WHITE)
pygame.display.update()
pygame.mixer.music.stop()
But then it still runs this code
def draw_window():
WINDOW.fill(WHITE)
WINDOW.blit(Bg_Image, (0, 0))
Quick_Sprite.draw(WINDOW)
Quick_Sprite.update()
WINDOW.blit(Title_Image, (0, 0))
pygame.display.update()
How do I terminate the second code so that when "Game Starts" the Sprites get off the screen completely instead of for a quick second.
I'm really new to programming my day job is a model maker and machinist but I'm trying to learn Python on my free time. One of my interests is games. I'm stuck here at the beginning and I'm not sure why I keep getting an error ModuleNotFoundError No module named 'settings'. The Traceback is calling to the main file but I want it to call up the settings file which has the map into the main .
it probably cannot find the settings.py file which should be sitting next to your main.py
I'm new to VS code and I think it's how I'm building my files as text and then converting them over to python files.
@vagrant saddle thanks i'll keep digging
Anyone have a decent explanation of the ECS pattern? I watched the video by The Cherno but I don't think I get it
Can someone help me in #help-lemon \
@vagrant saddle it was not seeing the right file format and I had a couple other little errors fixed them and now I have it working!
pls tell me how to make karel clean up everything
In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.
GDC talks cover a range of developmental topics including game design, programming, audio, visual arts, business management, production, online games, and much more. We post a...
Thanks, I'll check it out
OOP bundles functions and data into one things, ECS goes the complete opposite direction, keeping them separate.
The idea is to take objects that would traditionally be big and break them down into micro components of which you then have many. And systems select tuples of components to operate on.
The hope for this is to allow creating all kinds of objects via extreme compositions (many small components).
(And therefor extreme reuse)
The effect is that ECS games can feel very sandbox-y and allow a separate team of game designers that are not programmers to experiment with ideas.
However, in practice ECS's tend to not be pure ECS's, they are often hybrid systems due to the nature of games requirements.
I guess one question I have is -- how do you attach dynamic/polymorphic behaviour in this way of storing just data in components?
For example, I'm making a game with mechanics similar to Factorio, where you're building
So I have "belt" entities that carry items, "inserter" items that insert things into factories, and "factories" (like smelters, assemblers, chemical plants etc.) that turn one kind of item in another. As I understand it, this is how I might structure the entities:
Belt (Slow):
- conveyor
- item_source
- item_sink
- render
ItemInserter:
- render
- electricity_sink
- ???
SteamTurbine:
- electicity_source
- fluid_sink
- render
Cutter:
- electricity_sink
- item_sink
- item_source
- render
The Overwatch video covers some of that though.
...so I have different kinds of item_sinks, for example. Some factories accept only things that are smeltable, other slots accept only fuel, others are even more dynamic.
Would it be incorrect to place some kind of strategies or other polymorphic objects as component values?
Components have multiple things in them and that could include booleans/enums/flags (further typing).
But they could all be separate components.
For example:
SinkValue = Callable[[Item], bool]
def heater_sink(item: Item) -> bool:
return item.id in FUEL_IDS
sink_componentzs[1234] = heater_sink
furthermore, in some factories the behaviour depends on the internal state of the machine (i.e. what crafting recipe is selected)
maybe I should watch the video first though 🙂
So I guess I'm just struggling to find a way to encode all of that as a single piece of "data"
Polymorphism can be used inside components as they can technically have anything except logic in them (which would make them OOP style objects).
Since ECS's are usually implemented in more low level languages the polymorphism would come in the form of a bit field (including booleans) / tagged union.
tagged union sounds reasonable
well, I don't really need it to be blazingly fast... I'm using Python of all things
Yeah so it would just be a class with no methods.
(dataclasses can be used)
I find enums really annoying (and limited) to use in Python, so IDK.
Python wants OOP, while ECS is moving towards DOD (setting up for it).
So I guess I would have something like ```py
@dataclass(frozen=True)
class ItemBlacklist:
forbidden: Collection[ItemId]
@dataclass(frozen=True)
class ItemWhitelist:
allowed: Collection[ItemId]
@dataclass
class ItemSinkComponent:
item: ItemBlacklist | ItemWhitelist
Since it's going to be dynamic and slow (not fixed size stuff), you could just use inheritance anyhow.
Got isinstance.
for example if a chest runs out of free slots, it's changed to ItemWhitelist([]), and when a free slot is available it changes to ItemBlackList([])
Yeah you mutate the components that the system queried. However, I recommend double buffering game state.
So instead you create a new component from the old one that has the changed applied.
Then after all the frame processing is done, the buffers swap.
I actually already have a system of reactive variables which are double-buffered, that might be useful
although that might be overengineering it
Double buffering state sets you up for networking too, because you can add more buffers, then stuff like rewind is easy to implement.
As avoids the updating based on some old state and some new state.
(Order of entity updates)
so the purpose of double buffering is to always show a consistent state, right?
Have you implemented Conway's game of life before?
yep
if you don't have a double buffer, the state will change from under you and the computation will be just wrong
You update based on the previous state and write into a new buffer, because it's suppose to happen all at once.
And there is no "correct" order.
Ordering system updates is much more manageable.
In low level implementations you don't, it just marks it as unused.
So when another entity is spawned it can use it.
(allocating and freeing all the time is slow (and memory bugs))
well, how do you know when to mark it as unused?
I guess in C++/Rust you can make a proper destructor
but using __del__ is kinda iffy
and also unpredictable
When you call "kill" on an entity, the entity has a list of components associated with it.
No destructors.
Destructors are an OOP thing.
You make a giant list of components, once.
not necessarily OOP I suppose, Rust has drop
but yeah that requires polymorphism
although maybe that is what OOP is
Zero memory management required (also known as region based memory management).
OOP ties the lifetime to each individual thing.
While in DOD we work with groups of things.
Since computers always work with groups of things.
this all sounds kinda similar to relational/logical programming
an entity is related to multiple components and such
OOP makes no assumptions about an object's use which is why it must clean up and all that and encapsulate.
DOD realizes that objects don't tend to exist alone in the aether, but in a context and in a group.
With some pre-conditions.
ECS is very database-like.
(There are ECS databases)
And some are using it beyond video games now.
SQLite game engine when
Yeah that is already a thing and is used to implement some of them.
IDR the examples though.
Did not bookmark them.
that's interesting
I guess SQLite is faster than it sounds, especially when in RAM
just a BTree thing
It's probably better to not use SQLite for speed, but it's def. a quick solution that allows a lot of flexibility / hackability and saving game state, etc.
It's associated arrays / tables all the way down.
anyway, thanks for clearing some things up. I'll go watch the overwatch talk
(And ECS systems also have the same indexing CS problems as databases and such depending on how you design it)
(Btw the allocating a big array once / region based memory management is why C programmers don't feel the need for garbage collectors and such (if they are doing memory management well rather than malloc and free everywhere (one can make memory management a non-issue)))
(Still the other issues with C though)
Silly idea, but ECS using Pandas...
IDR if the talk mentions it at all, but the thing that is really going on here is making "objects" pure by simply not having functions at all, and rather than each object updating itself like in OOP, systems view entire groups of objects at once resolving cross-cutting concerns.
yeah that is clear to me
they're not really objects anymore, more like data structures
I suppose this is one way to approach the "expression problem" where you have multiple types and multiple behaviours
These benefits can be achieved without a full blow ECS system, but an ECS is very generic like a database making it good for large teams and engines like Unity where there are no assumptions about the games and simulations being made with it that can be used to to simplify.
So I ran into a bit of an issue with ECS: some of my entities are located on a square grid. As I understand, they should have a component like location: (x, y). But what if I want to find all entities located at a particular point? Would it make sense to keep a hash map mapping points to entities
I could of course scan all the location components, but that's going to be O(N) for every search
when I try to run this code it shows me a attribute error: 'level' object has no attribute 'create_map' while it does?
is there a way to fix this
methods should be on the same level as __init__
yours are indented 1 level too far
oh
so do i have to change what line is on?
@crimson hound
fixed it that helped
thx
!e
FYI: this is perfectly valid code, but it doesn't do what you meant. you can indeed create functions inside of other functions:
def make_adder(n):
def add(m):
return n + m
return add
add5 = make_adder(5)
add7 = make_adder(7)
print(add5(100))
print(add7(1000))
@crimson hound :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 105
002 | 1007
👍
Does anyone have experience with licensing art assets under a different license than the source code ? I have my code under AGPLv3 and my assets under CC BY-NC-SA 4.0, with notice of which license applies where in the README. The AGPL license text file is in the project root and the CC license file is in the art assets directory, I'm pretty sure that should be enough but just to be sure...
That abbreviation is.. questionable.
yeah, you'd think it's some new Apple gadget...
but I think it's pretty standard at this point
What I'm working on currently
@crimson hound
same problem again but with a different attribute
they are all lined up with the __init
nvm
fixed it
👍
Hey, I'm sort of new to Python myself and interested in gaming. I've made 2 games using YouTube tutorials and pushed them to GitHub. I'm hoping to learn and develop my coding skills with everyone here. 🙂
you should not need await for reading a client socket, they can be made non-blocking.
You would have a 2D array where each cell has a list (or set) of entity IDs (only allowing entities with the grid component). Systems can query for all entities in a cell via that grid in O(1). When a system moves an entity with a grid component (from one cell to another) it must make sure to update that grid and the entity (some function somewhere that moves between two cells that each system can reuse). The grid is a way to do faster queries (effectively an indexing method like in a database but in this case spatial) and you will probably have several such indexing methods for various systems to use (probably trees or hashtables). These indexing objects can be passed to systems on creation.
You can also do what Overwatch did with the singletons.
well, in my case the map is quite sparse and very large, so maybe an array is not the best choice
Yea then it would be a sparse matrix if it's 2D, but same idea for 3D.
I guess there are special sparse arrays
So yeah, row, col, value tuples.
(COO)
In numerical analysis and scientific computing, a sparse matrix or sparse array is a matrix in which most of the elements are zero. There is no strict definition regarding the proportion of zero-value elements for a matrix to qualify as sparse but a common criterion is that the number of non-zero elements is roughly equal to the number of rows o...
There are many ways to do sparse matrices though, depends on what kind you think you will have. I would go with COO generically when unsure.
Oh, nvm, they have a different term, DOK.
(Hashtable version)
COO sounds bad for insertion/deletion
and I doubt I'll get significant caching advantages in Python
Yeah I meant DOK (hashtable).
In general, just not storing empty cells (zeros) and instead tuples of row, col, value, but in the case of DOK the lookup/storage is done via hashtable (so really it's just a hashtable of row,col -> value, no need for a new data type).
COO in my experience has referred to either at times ((row, col, value) of non-zeros in general without more specific types like block or band matrices and such).
it depends on what operations you do, e.g. if you do mat@vec then it's optimal to use, IIRC, CSR.
Yeah it depends on if you want fast in-order iteration, or fast insertion / deletion.
Fast in-order iteration is key for matrix multiplication.
CSR/CSC is really good when one builds it once, and multiplies many times.
But for specific kinds of sparse matrices there are better.
How much dependencies does pygame has?
Many like 10 to 15
Anyone online
yes
Do you mean additional python libraries that are not in the standard one?
?
Hey, pygame is built on top of SDL and most of its implementations are in C. It doesn't have any Python dependencies other than numpy which you don't need in order to install it, you only require it when trying to use pygame.surfarray https://www.pygame.org/docs/ref/surfarray.html
Looking for someone who could teach me some trigonometry implementing in pygame
go to khan academy and find the trig courses there. It is free and you watch short videos that can help you learn.
I have to do a mini game for a uni work, it have to use: loops, functions and lists. Any idea will be appreciate, in advance thanks you <3
you can make something simple such as flappy bird, or does it have to be an original game ?
i made a quiz game….kind of
Not have to be an original game
Flappy bird, will required an UI? Isn’t it?
you can make it with pygame
But, it have objects or classes? Cause I don’t see it yet :(
i made a Pokémon quiz,its mostly if, else and input statements but its pretty good for me being brand new at python
Ooh it’s a great idea!!! <3
there is a guy on youtube who explains how to make it step by step, its not that hard
dont know how to loop it though so that it restarts
i can send you the link in messages if you wanna see the code
i think i can help you fix that
Nice! Thanks you both <3
you might need to check the file out in order to do so
Yes :D
thats fine, did u upload it somewhere
github
sadly i cant post it here due to the self promotion rule but i can message both of you the link
ok you can message me
As a senior python/c++/c# developer with 8 years of experience, I have rich experience with image processing such as
LPR, inpainting, segmentation and tracking and deep learning models such as MaskRCNN, fastRCNN, yolo, hyperLPR and so
on.
You could make snake with turtle
Hey can you message me the link please
hello, If I want to make a simple game like tetris and make a multiplayer mode, available on android/ ios/ browsers.
Should I go for flutter, unity or javascript to achieve this?
sure
Answering to MasterMole from #python-discussion,
It depends on your needs, what are some things you are looking for in a game library?
idk really. ive made a few simple python stuff before(calculating the mean of numbers using inputs, password guesser, other simple stuff like that) but they werent that fun in making so i decided i wanted to make a game. and i wanted to stick with python because i have no knowledge of any other languages.
Pygame is barebones and gives you full control and flexibility over the loop, after a few concepts you generally don't need to look into the documentation for anything, nor does it enforce a particular paradigm, you don't need to be super heavily familiar with OO to use it
Has an active community dedicated to it as well, if that interests you
It has 0 Python dependencies other than numpy which isn't really a dependency, you only need it installed when trying to use the pygame.surfarray module. It's built on top of C
Arcade provides more utilities by default, but you may end up having to reach the docs more often. It's also pretty easy for beginners, which is its main point . Has quite a Python tech stack, pymunk and pyglet to name a few (but you may end up using pymunk in pygame anyways, so having it nicely integrated with the library can be nice)
I can relate, those used to be something I found only moderately fun
So you wanted to make something that is entertaining to make?
And also presumably presentable, then games are a pretty nice option yeah
yes thats why i wanted to make a game
https://youtu.be/AY9MnQ4x3zk
If you are going with pygame, this is considered to be the best introduction by many
There's this for arcade, https://realpython.com/arcade-python-game-framework/
i was just having second thoughts whether i should be going to making a game as i havent made anything like a game. even for very simple games , the code looks very complex
Hmm, you know game dev isn't always the only way to have fun with Python
what else could i do
you can try pygame-web to have cross platform multiplayer
So many things, it's amazing
Honestly, for me personally only 50% of the entertainment factor is what I do, just being able to share it and present it is the other 50%
Discussing things is great
For example here is the website I'm working on, https://starreviews.herokuapp.com/
So what I'd recommend is doing something you could show off, how about making a little Christmas tree printer, with colours and all that! Will be doable with what you know, and most importantly it won't require you to keep dedicating time just to learn a concept in order to use it, since these are things you know
Short answer: try making something, upload it to a site (like github), and then share it, even if it's small it is super entertaining when people give feedback (for me at least)
Or, maybe join in and do some weekly challenges, it's fun to compete with others who are also trying (on discord), and you can learn from their solutions too
I found making this fun, heh
ok i’m trying to implement a dice roll and then if the dice rolls a certain number i want it to determine the object picked up relative to the number and the game keeps repeating an action relative to if the user picks up the item when they decide not to pick up an item
ok so i had to adjust some things but i think it’s an improvement and no errors so far
that if statement is leftovers from a more bloated and complicated code
You wrote player.lives == 3 instead of player.lives = 3 maybe that's why
is a 3d python game without using prefabs and premade assets doable?
