#game-development
1 messages · Page 97 of 1
Does anyone have recommendations for intros to node based pathfinding in a 2D space? Specifically utilizing known good X,Y coordinates as valid paths
For context: I have a 2D Space of 0,0 to 100,100 and have a list of known good locations within that space, (1,1) (1,2) (2,.2) (2,3) (2,4) 2,5) (3,5) (3,6) (4,6) as well as (1,2) (1,3) (1,4), (1,5) (2,5) (2,6) (3,6) (4,6) - I'd like to try to path find to (4,6) from (0,0) but I'm not really sure where to start.
"Known good" being what?
And what cells are connected - a cell to 4 neighbours, or 8?
Good old A* sufficient? https://en.wikipedia.org/wiki/A*_search_algorithm
A cell connected to 8 neighbors. Known good should maybe be referred to as preferred paths? , I would like to use these as the locations that are available to travel, rather than the entire open space.
I could start with A* and work from there if I need more performance; I've just never tried to implement this before and wasn't sure where to start 🙂
Oh, so just pathfinding on a limited set of nodes rather than on a grid. Yeah, use any graph pathfinding algorithm like A*
start with dijkstra, it's a limited version of A*
(it's equivalent to A* with a constant h-function)
Thank you, I'll start there and see what I can come up with. Appreciate it!
here's them compared
left is A*, right is dijkstra
the difference is that A* "knows" what direction it should generally be searching in, and so explores less nodes while still being guaranteed optimal
On the other hand, you can also see on this pic why many games use a non optimal algorithm instead - because even A* explores a ton of nodes it could have not explored if it was fine with a "close enough to optimal" solution
Yeah, I can see that - I think with my limited dataset, A* should be fine. I just need to figure out the actual implementation for my purposes and the best way to store and load the navigation grid
You can change the weights of a graph in realtime
For a* check redblob games
They have code even you can use in py
for Python, the common way to store graphs is as, say, a dictionary mapping a node's index to a list of all nodes it's connected to.
e.g a 1-2-3 undirected graph would be
graph = {
1: [2],
2: [1,3],
3: [2]
}
Thanks, I'm trying to wrap my brain around this. It seems like, on bigger projects, mapping each node to tell the system how it connects would be slow and a very manual process
Surely you don't map out each option in a 100,100 grid by hand
I do it with py
And I use object faces in blender
Upbge has a sprite node for eevee
Also check this out
You can have a pathfinding graph that is each "tile" and it's connection to other tiles
Then when you pathfind them you use it to build a graph from "stubs" of just those tiles
And pathfind it
It's a bit like a octree
oooh, yeah, that's what I was thinking of when I was thinking of pathfinding
Basically when you add the dictionary together for the tiles
You strip out any links to tiles not in the set
I ended up storing nodes as
(tile_index, face)
To make it easier
Then we use a table to convert to ints
Like
Table[(tile, face)]
Will spit out the node* index
And it's position in space
Awesome, thank you
Anybody who uses pygame
You all have any idea why the transparent background of my image after I converted it and set the color key is still black?
Hello i want to make a popup with input you cant click away from does anyone know how to do that?
module 'arcade' has no attribute 'AnimatedTimeSprite'
when i run my code i get this
how to fix
imports are
import arcade
import random
arcade.AnimatedTimeBasedSprite - looks like a typo on your part?
Maybe because your background screen colour is black?
In games like warcraft 3, certain parts of a units texture would change color based on the assigned value (not the whole texture, just a part of it)
How was this accomplished, did the textures have a specific "blank" value that would be replaced with the set value ?
drivers mixing stuff @cloud parcel
like you can use a mask + object color in upbge
and show the object color only where the mask is painted
you can accomplish this in games by passing uniforms per object
like a single float 0-1 can make a rainbow of colors
In pygame my rect is bigger than the img. I used same scale for both. Any suggestions how to make img size same as rectangle size?
I am trying to create a game using pygame but for some reason the screen doesnt show the image/sprite i want it to render this is my code:
import pygame, sys
clock = pygame.time.Clock()
from pygame.locals import *
pygame.init()
pygame.display.set_caption('Platformer_Toturial')
WINDOW_SIZE = (400, 400)
screen = pygame.display.set_mode(WINDOW_SIZE,0,32)
Crosshair_Position = [50, 50]
Crosshair = pygame.image.load('player.png')
while True:
screen.blit(Crosshair,Crosshair_Position)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update
clock.tick(60)
which framework should i start with ?
how to make my player jump and disable the running animation
u can create a game for seas
like picking up the waste products from the seas not a complex one just a simple one after picking the waste u can add a reward system
u can make it using pygame
Does someone know why this is not working?
I think update should be update()
So it actually gets called
pygame.display.update()
oh yeah how didnt i see that
like hide some object in pygame
Usually by not drawing it
You need to some state deciding when it should be drawn or not
If you share a little more info it's easier to help
ok
The focus should be on the first problem. How you decide if something should be drawn or not, and for what reason.
Does any1 use blender?
I'm wondering how to make something first person vire
Viee
View
I wanna make a 3d platformer with a jumping first person character
@tranquil girder has a semi-simple 3D engine that can be used to make that kind of game.
https://github.com/pokepetter/ursina
And no, I do not know much about Blender scripting, but there are definitely many people here that know how to do that.
i dunno man i just wanna use blender i have no idea how any other 3d graphics or game engines or any of that stuff
I'm not rly good with any 3d things either
probably pygame
there is also pyglet, ren'py, cocos2d, panda3d (for 3d), and some others
pygame be good
Or u could be like me and make console (meaning cmd prompt) based games
yes
i mean those r cool
but i wanna try 3d graphics
theres a pretty cool cheap game on pc i seen people play it b4 where u r a king and u make decisions and ur 4 bars go up or down and some decisions lead to others
like that?
oh i remember the game name
reigns
Why don't you install ursina and play around with some of the examples?
Swipe right to reform the church and divide the population. Swipe left to give the Pope a hug
~Watch more videos like this: https://www.youtube.com/watch?v=rTYYO_803Zg&list=PLliBvQE3gg9cX0xZGSZp_qwzfYcZntjC4
~Twitch Channel: http://www.twitch.tv/rtgame
~Merch Shop: https://freshmerch.fm/collections/rtgame
~Twitter: https://twitter.com/RTGameCro...
whats ursina
thanks
how hard is it
how do i get it once i clicked on the link never used github
pip install ursina
https://www.ursinaengine.org/#Getting Started covered here and in docs
^^
thanks
im linux user btw
chromebook
oof
I have experience with chromebooks
hmm not sure if that runs on chromebook. You can always try to install it
Yeah, but depends on hardware.
Theres a linux virtual machine that is meant for developers
I've never tried ursina on chromebook tho
do i just slap pip install ursina into the shell
i use idle python
Try to eventually get a windows or a non-chromeOs linux computer. It will make the development process much easier and faster.
I would 4 gb raspberry pi if u want to continue on linux, or u can buy a better laptop, or build a PC
I think on chromebook u have to use virtual environments
to use pip
does ur pip work without?
theres a linux vm
ik
what do i do now
try running:
pip install ursina
It will probably say that u don't have pip
just says invalid syntax in the shell
I mean run it in terminal
oh terminal
pip command not found
ye
so
virtual environments
venv
u need a venv
please explain im a noob at linux
I don't remember how to do venvs
is the command right
no
But that gave me another idea
u could just download from github. and put that in ur linux directory
and unzip it using like:
unzip master.zip
then u could import from the master folder
you should do python3 -m pip install ursina
I'm on mobile so Im very lazy with typing
oh the creator is here
wassup
do what he said
wait what linux directory
with pip cmds it doesn't matter
says theres no modual called pip
you should install it first then
thanks
actually on chromebook u would do pip3
i forgot that
progress 5% im just downloading it
does ursina work for large multiple people projects or just small projects
i dont intend to make very large projects but itd be nice to know
technically multiple people could make any type of code together
the first step is a 2d among us platformer
how can..
nvm
i ment 3d
lol
aight running the ursina install command that poke told me to use
Yes, it doesn't get slower with project size lie Unity does for example, since you can only the file you want. Of course if you import everything else in the game it will slow down.
I terms of multiple people, it's the same as every other code projects. But since everything's in code files, it's easier to merge than a scene file for instance
like a +
running setup.py bdist.wheel for numpy
I want to play with Ursina again sometime... Also Mr. Petter, your Life is Currency game is confusing
stuck on this
is this supposed to happen as in being stuck on this line
Well, it was for a 48 hour game jam :P
Thanks ^^
stuck where?
on a line in the linux terminal nothing is happening
yeah, but what does it say?
running setup.py bdist_wheel for numpy . . . || -
Ursina is very large since it is based off of Disney's massive 3d engine: Panda3d
that explains more
might be compiling or something
You don't actually need numpy though
its probably useful
whatever it takes to make amongus themed games and send them to my friends
: )
installing be de ez part...
im aware
i understand python 3 pretty well but my only graphics experience is tkinter which is some 2003 shit
I gtg, busy with school
cya
class App:
def __init__(self):
pyxel.init(128, 128, caption='SeaJam Python', fps='60', scale=8)
pyxel.load('assets/resources.pyxres')
pyxel.run(self.update, self.draw)
self.move_speed = 5
def draw(self):
print(self.move_speed)
AttributeError: 'App' object has no attribute 'move_speed'
why does it do this
You go here: https://www.ursinaengine.org/documentation.html and read the Introduction tutorial, Entity Basics, Coordinate System, Collision, and maybe look at some if the example projects
thanks but im having issues even doing the first bit lmao once of downloaded it
`from ursina import *
app = Ursina()
player = Entity(model='cube', color=color.orange, scale_y=2)
def update():
player.x += held_keys['d'] * .1
player.x -= held_keys['a'] * .1
app.run()`
is in the code and it should be all right but aparently the modual doesnt exist
if you're on linux, use python3
im using python 3 right now
it just means the python you tried to run is not the same you installed the ursina module to
ok, but which python did pip install to?
I think you can add the version number too, if you want to be specific
like python3.7.3 -m pip install ursina
and
python3.7.3 main.py```
You probably have something like App.move_speed
You need to create an instance
and I think you have to add --user to the pip install command or something on linux, or use sudo before
not found
i cba
il try -- user before the command sudo didnt work
actually aids linux downlaod
never works
what does pip3 list say? also, pip --version and python3 --version
asn1crypto 0.24.0 chardet 3.0.4 cryptography 2.6.1 entrypoints 0.3 keyring 17.1.1 keyrings.alt 3.1.1 numpy 1.21.4 panda3d 1.10.10 panda3d-gltf 0.13 panda3d-simplepbr 0.9 pip 18.1 pycrypto 2.6.1 PyGObject 3.30.4 pyperclip 1.8.2 python-apt 1.8.4.3 python-debian 0.1.35 pyxdg 0.25 screeninfo 0.7 SecretStorage 2.3.1 setuptools 40.8.0 six 1.12.0 wheel 0.32.3
is the resut of pip3 list
doesn't look like you installed it
i typed in what u told me
should i type it again or somethin
if i cant download this in the next hour im moving to blender again
Maybe use a flag.
ah imma try it when i get back thanks
I want to make the code stop running when I lose or win, what is just the code to make it stop again?
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-asazpcis/pillow/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-sy48hm9e/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-asazpcis/pillow/
is the error i get when i try download ursina
i dont know why this happens but it prevents me from accessing the modual in python
looks like installing pillow fails and the installation never finished
maybe try with: sudo python3 -m pip install --upgrade Pillow
ok
its the same error as last time
@tranquil girder is this a normal error for 3.7.3 python or chromebook linux
has to be something strange
ngl
no, it's not normal
any thoughts on pymunk?
have u seen any other person in my circumstances have this error
pillow is just dead
nope, it's probably because of the chromebook or the OS
so how am i supposed to fix it
i dunno why it shouldnt work on chromebook its still linux
welcome to linux hell
it's a really common module though, surely someone's had the same issue
if all else fails, you could always build from source
i dont understand how to do that im not well versed in linux hell
i came from idle python games and gimmicks like translators in windows
you could try installing ursina this way:
and skip pillow
since you only need it if you want to edit textures anyway
git clone https://github.com/pokepetter/ursina.git --depth 1
python3 setup.py develop
il type that in
well it worked i think
loning into 'ursina'... remote: Enumerating objects: 302, done. remote: Counting objects: 100% (302/302), done. remote: Compressing objects: 100% (267/267), done. remote: Total 302 (delta 38), reused 132 (delta 27), pack-reused 0 Receiving objects: 100% (302/302), 7.36 MiB | 2.21 MiB/s, done. Resolving deltas: 100% (38/38), done.
was the result
so is it working?
so now i slap `from ursina import *
app = Ursina()
player = Entity(model='cube', color=color.orange, scale_y=2)
def update():
player.x += held_keys['d'] * .1
player.x -= held_keys['a'] * .1
app.run()` into the code and run it?
yes
will do
Traceback (most recent call last):
File "/home/octane22/python/ursina_game.py", line 1, in <module>
from ursina import *
ModuleNotFoundError: No module named 'ursina'
theres no way man
this is some strange stuff
i typed it in correctly
you should check if pip3 --version and python3 --version are the same
how do i do that
you paste those commands into the terminal
for example, I get
pip --version
pip 20.2.4 from c:\python39\lib\site-packages\pip (python 3.9)
python --version
Python 3.9.2
octane22@penguin:~$ python3 --version
Python 3.7.3
octane22@penguin:~$ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
is my result
try which python
or ```whereis python3.7
on linux systems there's often a python used by the operating system, and a python for the user
also, try python3 -m pip list too
to see if it's the same as pip3 list
Cool
I also want to make game...can we use python for that??
That's why we have a #game-development channel on this server, yes.
from pygame import *
from math import *
init()
screen = display.set_mode((800,600))
icon = image.load("/home/ceyhun/code/maybegame/space-travel.png")
display.set_icon(icon)
display.set_caption("First Game")
playerImg = image.load("/home/ceyhun/code/maybegame/spaceship.png")
#creating char
class player():
def __init__(self,sprite):
self.playerx = 350
self.playery = 400
self.sprite = transform.scale(sprite,(100,100))
self.rectangle = self.sprite.get_rect()
def main(self):
self.collide = self.rectangle.colliderect(obstacle)
color = (255, 0, 0) if self.collide else (255, 255, 255)
screen.blit(oyuncu.sprite,self.rectangle)
draw.rect(screen,color,obstacle,3)
#karakterler ve cisimler
cisim = Rect(300,300,80,80)
oyuncu = player(playerImg)
obstacle = Rect(200,200,40,40)
#oyuncu speed
vel = 1
#game loop
running = True
while running :
for Event in event.get():
if Event.type == QUIT:
running=False
inputt = key.get_pressed()
if inputt[K_LEFT]:
oyuncu.rectangle.x -= vel
if inputt[K_RIGHT]:
oyuncu.rectangle.x += vel
if inputt[K_UP]:
oyuncu.rectangle.y -= vel
if inputt[K_DOWN] :
oyuncu.rectangle.y += vel
screen.fill((0,255,0))
vel = 1
oyuncu.main()
display.update()
hi
problem is I created a rect named "cisim"
tried to add collision but cant figure it out
I want to "cisim" be like a wall, my char "oyuncu" shouldnt walk through it
Hi ! Can you know good version of street of rage or metal slug in python? I dont want full game just first stage
btuh
mmmm yummy
Cool!
Did u make it with blender python or blender python ursinq
Ursina
I made a 2 day stick man game requiring collision
I compared coords and added a small 1 pixel pushback
Which can prevent glitches in more advanced 3d games
Nice
Do you share your code in github etc?
nah
its relatively easy and used in alot of borders in games imo
hi so i tried to make a platformer but when i jump the colision with the platform is disabled
how r you doing the collision
like with coords bumping eachother?
@dusky holly You might want to add some spacing to that code. When it's this compact it can be much harder to read. Not a 100% must. Just a general suggestion.
what is spacing?
add some newlines separating parts of the code where it makes sense
oooh ok
For example : https://paste.pythondiscord.com/uwekalaqej.properties
That's a small start
yeah that's much better
Maybe also group the variables you declare on the top into smaller blocks
Small things like that make your life so much easier. When you look back at your code in a couple of weeks/months it's much easier to understand. Also easier for others to look at quickly
if player.colliderect(platform):
if abs(player.bottom - platform.top) < colision_tolerance :
isgrounded = True
player.bottom = platform.top
if abs(player.top - platform.bottom) < colision_tolerance :
isgrounded = True
player.top = platform.bottom
is the bit we focus on
i personally used tkinter for my first platform projecr
it had 4 points on the rectangle labled as "collision corner" 1, 2, 3, 4 respectively
just compared coords with other object corners
ok thx for the advice
Yes pls
Because this solution didn't work
I don't know if its a solution but i have decreased the jumpforce and now
The characters does'nt go throw thé platform
aight give me 15min
def drawbounce(self): self.canvas.move(self.id, self.x, self.y) pos = self.canvas.coords(self.id) if pos[1] <= 0: self.y = 1 if pos[3] >= self.canvas_height: self.y = -1
this is a bit of a code i used for a tennis kind of game
i use tkinter (canvas is basicly size of ur window and self.id is the object which ive made beforehand and its corners (inside the tkinter object making thingy)
so like im comparing pos[3] which is the final position of the object i made before hand
and u basicly do that with an object coords instead of the canvas height
the self.canvas_height is a veriable for window height and i dont want the ball to go out the screen
i could have named pos[] something else like characterpos[] and make another position set for another object like a platform called platformpos[]
@dusky holly theres prolly more ways to do it but this is the way i did it and its probably overly complex as i dunno how pygame works and it probably has something better then this
im having a problem with ursina models
`from ursina import *
application.development_mode = False
window.fullscreen = True
window.borderless = False
app = Ursina()
maze = Entity(model = 'mazeBeta', color = color.rgb(200,100,133), texture = 'brick', position=(0,0,0), rotation = (0,0,0), scale = (2,2,2))
EditorCamera()
app.run()` is my code
mazebeta is a maze structure which i made a stored to the correct place for use in ursina
its made with blender
for some reason it wont work, it stays on a small black loading screen but when i put a file name which 100% doesnt exist it opens a full grey screen with nothing on it
i doubled checked that i saved it correctly and the code looks correct so i dont know what it is
what does the terminal say?
using py to set data from the evaluated mesh back to the original mesh - using geonodes as a game engine 😄
Screenshot of the new engine im working on
You're building an engine? Hows it work?
Well what part are you asking about
Are you writing the drawing/rendering algorithms from scratch?
Or is it a UI around another engine? In either case, super cool!
I'm working on a graphics engine myself
Basically a remote-controller for a webbrowser which controls the DOM using a pythonic clone of it
def meteorrain():
meteorss = pygame.image.load(os.path.join("Assets", "meteor.png"))
meteorssresize = pygame.transform.scale(meteorss,(50, 50))
meteorssrotate = pygame.transform.rotate(meteorssresize,-40)
random_at_y = random.randint(0, 660)
Window.blit(meteorssrotate, (495, random_at_y))
pygame.display.update()
def main():
#Size and position
yellow = pygame.Rect(100, 300, 10, 10)
clock = pygame.time.Clock()
running = True
while running:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
key_pressed = pygame.key.get_pressed()
playermovements(key_pressed, yellow)
draw_window(yellow)
meteorrain()
can someone help me how to slow down the spaawning time like this
FPS = 60
heyy someone at #help-pear please
I wanna make game like PUBG
everytime i try to import the pygame module it gives me a circular import error 😔
A circular import is exactly what it sounds like
You probably are importing a module which also imports from the file you are working on
ah okay thanks :D
Pygame
Is this rotate code is correct, u der roatate function, if yes then there is a problem that my image got ripped off when rotated more and more in loop
I am learning pygame thorugh a tutorial of flappy brid
And my bird on continuous rotation looks like that
Traceback (most recent call last): File "/home/octane22/python/ursina_game.py", line 9, in <module> maze = Entity(model = 'mazeBeta', color = color.rgb(200,100,133), texture = 'brick', position=(0,0,0), rotation = (0,0,0), scale = (2,2,2)) File "/home/octane22/ursina/ursina/entity.py", line 105, in __init__ setattr(self, key, kwargs[key]) File "/home/octane22/ursina/ursina/entity.py", line 201, in __setattr__ m = load_model(value, application.asset_folder) File "/home/octane22/ursina/ursina/mesh_importer.py", line 66, in load_model if compress_models(path=path, name=name): File "/home/octane22/ursina/ursina/mesh_importer.py", line 192, in compress_models blender = get_blender(blend_file) File "/home/octane22/ursina/ursina/mesh_importer.py", line 163, in get_blender raise Exception('error: trying to load .blend file, but no blender installation was found. blender_paths:', application.blender_paths) Exception: ('error: trying to load .blend file, but no blender installation was found. blender_paths:', {})
is the result i get from terminal
@tranquil girder
which is strange cuz i made the file
and saved it into the game folder
It finds the file, just not Blender, which is needed to convert the file. It should use the which blender command to find it automatically.
It's possible to give that path manually with application.blender_paths['default] = Path('path_to_blender_executable')
Or you can export manually from blender, as .obj or .glb.
so i gotta type that
application.blender_paths['default] = Path('path_to_blender_executable')
right
U making blender addon?
Yes, but write the path to blender. Idk where you installed it
Program files
He's on linux lol
Blendee foundation
i mean the linux command
Oops
which blender maybe? But then I don't know ursina wouldn't find it
doesnt even bring anything
up
lmao
il try find blender
no such file or directory bruh
i dont know the full name of my blender file
how am i supposed to find it
open blender and look at the terminal. it probably will give you a hint
python terminal for blender yeah ok
wont copy and paste for some reason
blender-2.93.5-linux-x64/
i think this is the name
when i try open it through linux thats what i see
doesn't look like the full path to me
i dont know how to find it
or any idea of how 2
'error: trying to load .blend file, but no blender installation was found. blender_paths:', {})
how can it not see my blender
u can get blender on a chromebook???
yeah
download tar file from the website for linux
locate file
do tar -xf (name of blender file and location)
oof
i literally cannot find a solution to the error
or find the path
@tranquil girder what would u do to find the path
I'd google how to find the location of programs on gentoo linux
i googled that but i tried the 3 options i found and they dont work
search path
file names to search
dont work
and the other one is bs
i havent found the path but i found out that my file is in the correct location for ursina to run
File "/home/octane22/python/ursina_game.py", line 9, in <module> maze = Entity(model = 'mazeone', color = color.rgb(200,100,133), texture = 'brick', position=(0,0,0), rotation = (0,0,0), scale = (2,2,2)) File "/home/octane22/ursina/ursina/entity.py", line 105, in __init__ setattr(self, key, kwargs[key]) File "/home/octane22/ursina/ursina/entity.py", line 201, in __setattr__ m = load_model(value, application.asset_folder) File "/home/octane22/ursina/ursina/mesh_importer.py", line 66, in load_model if compress_models(path=path, name=name): File "/home/octane22/ursina/ursina/mesh_importer.py", line 192, in compress_models blender = get_blender(blend_file) File "/home/octane22/ursina/ursina/mesh_importer.py", line 163, in get_blender raise Exception('error: trying to load .blend file, but no blender installation was found. blender_paths:', application.blender_paths) Exception: ('error: trying to load .blend file, but no blender installation was found. blender_paths:', {})
took a look at the error message and i dont find anything
whereis blender just brings up blender
find doesnt work
i have no idea how to do this ive been googling
how do you open it then?
so its inside cd blender-2.93.5-linux-x64
now i somehow make sure ursina can see that
how tf am i supposed to do that
it would be something like "/home/Desktop/blender-2.93.5-linux-x64/blender"
if you're not sure what file paths are, I suggest you learn about that first
damn so i gotta put that into the code or something
i will cuz it will probably help with linux
and im a noob at using linux
and file management and shit
yes, read my first answer
if you don't want to set it up you can export to obj manually instead
but that not fun if you have to do it often
what bout exporting obj
do i just convert the file format and slap it on the end of "mazeBeta"
you export it from blender
holy shit i did it im so happy
turns out i was ticking the wrong options when saving lol
and python can finally read the files
im so happy
change the folder name or move the file with mv
Its solved
De
Hi I am looking for help. I have created a snake game but for some reason the body parts are not showing except the tail. It did work previously and all the files are in the same folders.
All the other functions of the game work it’s just this final issue.
Any help would be great thanks
Hi I was wondering if it was possible to have multiple eg. "self.rect = self.image.get_rect(midbottom = (self.x, self.y))" for my sprites based on key conditions?
in pygame ^
'
thats true
@steel lintel wdym
Like a different shape every different key?
Or different parameters
okay so basically I have a sprite
which ive put into a class
but i cant seem to be able to move it to the left and right
so i was wondering that if i used a conditional of key presses which would change its getrect position it would move
but it doesnt seem to working
and now im stuck on what to do
wdym?
keys = pygame.key.get_pressed()
if keys[pygame.K_a]:
self.rect = self.image.get_rect(bottomright = (150, 700))
elif keys[pygame.K_d]:
self.rect = self.image.get_rect(bottomright = (450, 700))
else:
self.rect = self.image.get_rect(midbottom = (self.x, self.y))
this is how im trying to change it currently in my class
i dont know how to use pygame but if i understand what u are trying to do it seems correct
so with the a and d keys ur changing the position of the rectangle
maybe do more then just bottomright
and add like top left, top right, bottom left.
worked for me when i made a game where u moved a rectangle
hi
sadly i want to but my pc dont support
i'm using blender game engine as my game dev software do you think it's a good idea?
it supports python
upbge? I'm sure at least someone here approves ;)
If it works, it works 😉
I'm not that familiar with it, but I assume it has advantages and disadvantages like any other game library or engine.
hello
im trying to develop something and dispoay overlay text but struggling to do this easilly and re-usable
tried this simply and stupidly :
import tkinter as tk
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
def text(n):
ttk.Label(frm, text=str(n)).grid(column=0, row=0)
text("starting in 5sec")
text("other text")
I found this example on the web which jsut puts random letters & colors, but im struggling to refactor it into a re-usable function throughout my big script
:
import tkinter as tk
from random import seed, choice
from string import ascii_letters
seed(42)
colors = ('red', 'yellow', 'green', 'cyan', 'blue', 'magenta')
def do_stuff():
s = ''.join([choice(ascii_letters) for i in range(10)])
color = choice(colors)
l.config(text=s, fg=color)
root.after(100, do_stuff)
root = tk.Tk()
root.wm_overrideredirect(True)
root.wm_attributes("-transparentcolor","white")
root.geometry("+512+312".format(root.winfo_screenwidth(), root.winfo_screenheight()))
root.bind("<Button-1>", lambda evt: root.destroy())
l = tk.Label(text='', font=("Arial", 30))
l.pack(expand=True)
do_stuff()
root.mainloop()
I made 2d minecraft lol
Procedurally generated terrain?!
That's pretty cool
ahh I see
But, yes, kind of procedurally generated
I took the long way
Cause i didnt get expected results
mhm
yes
Hey, pretty new to all of this. Anyways what do yall use for making games? I want to make a 2D mobile game and I've heard good things about kivy and kivent, so that's what I am learning rn. I'd like to know though if there are alternatives/better options? Thx in advance.
cool
U can make some pretty sick creations with blender
Also question: if I want a ui stylised for a medieval RPG game what would u guys recommend
Pygame perhaps? Idk how to use anything but ones that dont work so preferably not 2 hard to learn
Why is this game dev channel so creepy. Sometimes when I work on pygame projects, I see pygame stuff here. And just now, I'm working on a tkinter project, and what do I see: Tkinter projects!
wait what
how
there is a game engine for blender it was scrapped
but there is a remake addon
called UPBGE
which what i'm using
you can even turn it to photoshop
with tricks.
it's even for 2D animations. and more
it's a one man army software
3d game with python?
yeah sure
sounds impossible
gotta try it fr
here is a example, this is a test for a game i'm making
made the quality low res so i can send it without discord telling me i need a nitro boost or something
- it's open source!
damm I really need to try that, I was gonna start learning C# just so I could make games with unity, but now that I can make them with python its perfect
yeah this software is cool
you can program also with c++
theres animation and python integration and integration with engines
yeah u can make cool 3d games with python believe it or not
Death Stick is a game in which you bring your Hero to fight for the survival of your world. Become imbued with power from your Aspects and equip yourself with your Factions' legendary gear in this next-gen, action-packed, third-person game.
My game
MY question is not very much into game development but i am using pygame module and it does not play mp3 files is there any fix to it?
PyOrge 🙂
@voy Try Arcade: https://arcade.academy for 2D games.
#help-rice someone pls help, its prob a simple solution to my problem, but idk what it is since im kinda new xD
does anyone know how to make a gun shoot animation or can insert
you can go tho the pygame discord server
can u send me an invite ?
dm?
yes please
running=True
while running:
for event in pygame.event.get():
if event.type==KEYDOWN:
if event.key==K_ESCAPE:
running=False
if event.key== K_UP:
block_y-=10
draw_block()
if event.key==K_DOWN:
block_y+=10
draw_block()
if event.key==K_LEFT:
block_x-=10
draw_block()
if event.key==K_RIGHT:
block_x+=10
draw_block()
elif event.type==QUIT:
running=False```
why is the block not moving
Maybe a little more context? Dumb questions aside (like, “Are you pressing the keys?”) are your enums correct? What’s in draw_block()?
this blows my mind i have no idea how you made this whats the game about anyway
sry managed to do it
Hello everyone, i'm completely new to python, i want to try to make some Simple games on my mobile (i mean use qpython on mobile to make games on my android) first question - is there any tut that gives me def. of all commands other than built-in qpython help()?
It's pain on mobile to learn from scratch
Another helpful built-in function is dir() which returns a list of the attributes the object you pass it has
And, obviously, print() which prints text on the screen (if you pass any object that's not a string it will try to call its __repr__() method, or __str__() if the former is not available)
Other than that, learn the basics somehow and learn kivy which I know is included with QPython
Howdy to all! Please help me with virtual environment on python. I can create venv and use this without python on other PC on windows? (Sorry if the chat doesn't work with)
OwO i'm stupid cat, i guess. python.exe in folder scripts. I don't need any more help
And no, for some reason it didn't work out for me, damn it
Another PC all the same, somehow trying to get python from my folder
agreed lol
furry aswell
You think that people should be allowed into this community who, instead of helping, point to a smiley?
Does communication style matter at all?
if only you knew what others think bout furries/people who act like them lmao
anyway not the right channel for this pce
I'm from a non-English speaking country at all
I don't think I said something wrong. Tell me, which channel can be suitable for this question?
just dont say OwO please its so cancerous
why it's cancerous?
how can i make my py file into a exe file
please opinion on my game https://github.com/adammaly004/Gravity_run
pyinstaller
Look here: https://www.pyinstaller.org/
But in short:
pip install pyinstaller
pyinstaller "py_file_directory"
You can also put a flag, for show console:
pyinstaller --console "py_file_directory"
You can find the finished file with secondary along the path: "C:\Users\%user_name%\dist"
thanks
Anyone know how to collect words in pygame and at the end the screen will show the words collected?
do you mean a game over screen at the end
how to add a switch for my weapon animation
I might be asking for too much here, but is there a game dev package / framework (of any language) that:
1. Lets the user define an exposed event loop, letting the user handle everything, that follows the syntax of while True: for event in pollEvent()
2. Does NOT come from SDL2
SFML
You can define your own main loop in pyglet if needed
while window_open:
clear screen
pull events (triggers window and input callbacks)
draw stuff
swap buffers
That's also possible in arcade
BUT.. you of course need to be in charge of framerate pacing and a few other things.
@royal hawk Motion seconded on Arcade/Pyglet
does the "pull events" section allow for even more customization?
and is it also the same in arcade?
What kind of customization? You can define callback functions for each event type
This is standard across most windowing libraries
If not all
Arcade is using pyglet so the approach should be the same for both I think
@royal hawk
you can bind custom functions to each event type? Can you show a small snippet of how that works?
You can just assign callable to each event type as long as the signature is correct
window.event(on_key_press_func)
window.event(on_key_release_func)
As long as the func passed is a callable accepting the right parameters it will be fine
Oof, thanks a ton lot!
@royal hawk ```py
while blah:
window.dispatch_events() # triggers inout and event callbacks
<draw stuff here>
window.flip()
You can look at my pyglet wrapper in moderngl-window as a reference : https://github.com/moderngl/moderngl-window/blob/master/moderngl_window/context/pyglet/window.py#L64
Just be aware that you might get 3000 fps unless you force enable vsync or add some throttling using perf_timer
There might also be things like joystick/gamepad input that would need special handling with custom loop
@royal hawk What's the reason for needing custom loop just so I understand you better. I do use both depending on the situation.
You might be looking at something close to this. Not saying you need to use it, but it shows the simplicity of just using custom main loop and assigning functions to various callbacks : https://github.com/moderngl/moderngl-window/blob/master/examples/custom_config_functions.py
In pyglet, even if you do have the default callbacks in a window subclass you can use push_handlers(..) to move the callbacks to other modules/classes temporarily
It's a fairly flexible system
You could also use plain glfw, but that assumes you are doing all the low level rendering yourself. Pyglet have A LOT of things built in making your life a lot easier. Batches, shapes, sprites, media player, resource loading etc etc
Hi,
I was unsure if this is post was better suited for this gamedev channel or rather for the data science but here we are... as science visualization & robotics are using more and more gamedev technologies nowadays...
Anyway, I'm glad to share this project here, as our team is working on improving the rendering quality of digital twins, especially for Python developers.
Our first attemps was on the Poppy Ergo Jr, with a simple POC that shows how easy it is to both
- control a poppy from Python

- render a 3D twin of the physical robot and make it look as realistic as possible to match nowadays users expectations in terms of 3D HMI 🙂

The result can be found here :
https://github.com/harfang3d/python-digital-twin
Next items on our list :
- activate the compliance mode, so that manipulating the actual robot is reflected by the digital twin
- implement the next level of 3D digital twin, using our python VR API, this time on a far more elaborate robot, the "Reachy" 🦾
Ask me if you're not familiar with robotics notions, I'll try to explain as much as I can 🙂
(works on Windows & Linux)
nice
so im interested in trying to make a tactical rpg, something sort of xcom-like. im kind of looking between pygame, kivy and arcade right now. it would be a top-down 2d sprite sort of thing, laid out on a grid. which one would you all say is best for that sort of thing?
how can i hide my object if a press a key
hi, i was programming a game when i hurt a problem. For info i'm using ursina. The problem is the perfomance, ursina is not able to make big cumputation(i think). So anybody as idea to solve that or a another librarie for 3D game developpement.
how did you diagnosed this computation issue?
is the framerate below 30 frames per second, for example ?
probably pygame?
no the frame rate is normal but i can't do big thing
Hey @safe spade!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
how to make 2 animations in one object if the are the same object but other file? or can i make it so if i press a button that the visible of that object is false
I use python scripts in my game using UPBGE, it can run them three different ways.
😎 +
Can anyone suggest a good tutorial on c++ with unreal engine
which game engine do you use
is there any game jam for python rn
that now is running
yes, you should look at the PyWeek gamejam 🙂
I'm not sure a Python discord server is the best place to get this kind of information 🙂
Sorry, I can not help 🙂
UPBGEv0.2.5b-b2.79Windows64 used 2.4 to make but updated, 2.5b is really good so far, there is UPBGE-0.31-Alpha-Windows-x86_64 if you are looking for new features. it's on Linux64 and MacOS as well.
Thx
how can i make my bullet if a shoot that it not only go forward but where my gun aim on
Hey @cinder steppe!
It looks like you tried to attach file type(s) that we do not allow (.blend). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
does anyone know how can i print words in between the pipes and will show the words at the top left corner after the orange ball collided with the words?
@waxen elbow hi
sup fluff
nice program. any way to make a simple walking square in python?
hi
walking square does it have legs
OMG
So Cool
Bro
You So Pro
How You can make?
does anyone know how to implement the board game Go (similiar to checkers) in Python and can help me out a bit? I have a question about the scoring
Hello everyone, I am planning to create a 3d game, but I don't want to spend time on learning blender and animations. Is there any place we can find free models with animations included?
is unreal engine python included? im trying to make a game similar to phasmophobia
Hello! I am trying to make a 3d game using python, but stuck on which engine to use. I did some research and deemed Ursina and Panda3d to be the best one out there currently.
So, I was wondering which would be a better choice? It would help a lot if you gave some comparisons too! If you know something better, then that'd be great too!
or raylib
Eventually you'll need to hire someone to do it, even when buying models.
i dont understand how a game like pubg was made using python!
Why do you think that PUBG uses Python?
I think they are confusing UPBGE and PUBG
@@inland schooner what function does the javascript serve in conjunction with the python code for your game? i'd love to make use of such techniques myself
Hi, I want to start making a game that uses midi as an input. so does anyone know of a good python library for midi inputs?
Can someone help i have been using python for while now , and i was following a tutorial about making the pong game, and when i was coding the ball movement i used this code:
# Move the ball
ball.sety(ball.ycor() + ball.dy)
ball.setx(ball.ycor() + ball.dx)
And when i run the game it give me an error
btw the error is:
ball.sety(ball.ycor() + ball.dy)
AttributeError: 'Turtle' object has no attribute 'dy'
Press any key to continue . . .
Can someone help me?
something like this? https://www.pygame.org/docs/ref/midi.html
where's the rest of the code? we need to see what objects Turtle has
I will send you the whole code
in a pm
I tried to use pygame's midi but it doesn't seem to work for me
darn i should've figured you already thought of that 😭
have you had any luck with anyone from pygame support? i don't know of any other besides pygame unfortunately
wdym pygame support?
discord. not sure if there was another method i used to contact other users there before
I only tried to get help in this server a while back with no success, but I think I'll just keep trying to find a different library. thanks for the help
how can i add a other model as my ground without that i glitch in
Mido/python-midi
I'll check it out, thank you
so I've got some questions about good... I wouldn't call this "game design" exactly, but... I am approaching a system within the game's architecture and pondering the best options for how to pull it off with code logic...
AHEM.
So, I am currently converting an ancient MUD based on ye olde CircleMUD 3.5 to modern Python.
And, in studying it, I realized it has some interesting features and ways of handling them.
For instance, most game entities - such as NPCs/player characters, rooms, items, etc, have "flags" that alter their behavior. And in the case of items, items have an "item type" which is effectively an enum (is it a container? a weapon? clothing? a drink container? something edible?)...
Under the hood these are just tracked as things like a set() of numbers for the flags. the NAMES of those flags are stored elsewhere in the C code as simply an array of strings that it can refer to if it wants to display it...
I'm wondering how I might improve upon this design. What other approaches there are for breaking down the things that define game content's traits. The properties of items or NPCs and so on.
are there any good resources on this subject?
You could use enum.Flag in Python as a way to have a bunch of named properties that can be combined and stored as an int.
not sure what would be the best way to move away from such an approach entirely
well
I can't actually change the ARCHITECTURE for this conversion at this point.
But I'm wondering about the best ways to handle the relational aspects - to create something which represents the flag, and then be able to serialize/deserialize etc
*examines enum.Flag
If you're not worried about efficiency too much, you could outright have each property be a boolean attribute - then (de)serialization can be done with JSON.
eww IntEnum not so hot...
I'm probably gonna have to do something like....
@dataclass_json
@dataclass
class Flag:
num: int
name: str
And then create a container of these things. load them from a JSON file...
Hey, I implemented a game state using a tutorial, I get the general gist of it but honestly I have no idea how to start implementing my working sorting visualizer in it..
https://github.com/ChristianD37/YoutubeTutorials/blob/master/Game States/game.py
this is what I was using
I got pretty much the same main code(game.py) and this:
But im not sure how to proceed here..
https://pastebin.com/jtrb9LsL
here is my visualizer, works by itself
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
not a game but using game.py
Im lost..
window thingy made for a future project (map editor and sprite sheet maker)
:)
currently i can handle text elements, scrollable elements, drawing elements(this is just a surface) (all inherit from a base element) and a moveable window
I've just found out about the ursina engine and it seems dope are there any downsides
Hey so i put some text on the screen, and i'd like to delete it when a certain condition is met. I've looked online and they all say to wipe the whole screen/surface, but i have other stuff on the screen that i want to keep and just want to remove this particular text, how can i do it?
does somebody have the code for pacman using pygame for AI
pls help me
i found the code for pacman in github
but i want the one that is used in ai projects
You have several ways:
- old method: save your background behind the text before you draw it so that you can clear the text and restore what’s behind
- immediate method: clear all then redraw what’s needed, all the time
Are you looking for a 2D or a 3D engine ?
oki, thank you.
dm me if u can make a game
Is there a way to tell the difference between a numpad key pressed and the arrow keys, if numlock is off? Like for differenciating inputs
Hello everyone I am thinking of developing a game using python.
Please suggest me some ideas,it will be my minor project.
Angry birds

@glossy tusk I suggest checking out upbge
we can create - rig - animate - and use python to do all of it in blender
we can use geometrynodes now to animate sprites too
Menu system using Geometry Nodes !
we can call up the blender bpy / bmesh api in game / mathutils is like a treasure trove
Further application of bmesh bisect in game :D
hello
I have a glitch that when I change keypress my character goes both ways
dont know how to describe it
Hey @late spindle!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
when I am for example pressing s and d and I let go of d it goes wobbily downwards
tag me if you answer pls
and some water foam so we can see the shoreline properly :D https://t.co/UhWQxKPn7r
so i am doing code combat game development 2 i do not know what is wrong with this code
Destroy at least 50 defeated ogres.
This spawns and configures an archer.
def spawnArcher(x, y):
archer = game.spawnXY("archer", x, y)
archer.behavior = "Defends"
archer.attackDamage = 20
This spawns and configures an ogre.
def spawnMunchkin(x, y):
ogre = game.spawnXY("munchkin", x, y)
ogre.behavior = "AttacksNearest"
Spawns some archers in a row.
def spawnArcherWall():
spawnArcher(30, 12)
spawnArcher(30, 23)
spawnArcher(30, 34)
spawnArcher(30, 45)
spawnArcher(30, 56)
Spawns an ogre wave with a random offset for variety.
def spawnOgreWave():
offset = game.randomInteger(-6, 6)
spawnMunchkin(80, 16 + offset)
spawnMunchkin(80, 22 + offset)
spawnMunchkin(80, 28 + offset)
spawnMunchkin(80, 34 + offset)
spawnMunchkin(80, 40 + offset)
spawnMunchkin(80, 46 + offset)
spawnMunchkin(80, 52 + offset)
def onDefeat(event):
unit = event.target
# Increase the game.defeated counter by 1.
game.defeted+=1
# Use unit.destroy() to destroy it.
unit.destroy()
Set "munchkin"s "defeat" event handlers to onDefeat.
game.setActionFor("munchkin", "spawn", onDefeat)
game.defeated = 0
game.spawnTime = 0
Add a manual goal.
goal = game.addManualGoal("Defeat 77 ogres.")
ui.track(game, "defeated")
def checkSpawnTimer():
if game.time > game.spawnTime:
spawnOgreWave()
game.spawnTime += 1
def checkGoal():
# If the game.defeated counter is greater than 77:
game.defeated > 77:
# Set the goal as successfully completed.
game.setGoalState(goal, True)
pass
spawnArcherWall()
while True:
checkSpawnTimer()
checkGoal()
you forgot the if, @trim meadow
hi , i am cherylyne but you can call me cherry. i just started learning python.
@cold storm thanks blue it really is a great idea
Is there any stable gui automation library?
what's a good 3d game engine for python?
cause someone said it to me Ursina engine is both 2d an 3d
pyautogui?
It seems pyautogui can't find and target a specific window
you should look into platform specific stuff then, I know windows is really good for that stuff (good builtins)
linux not so sure, your wm might be able to help you out, otherwise there's always X
👍
Is there a specific use case you have in mind?
curious what you're trying to automate
I 'm working on a "cloud desktop" project. Some bugs will cause no video input in the client side after about 20mins operations.
So I don't want to operate for such long a time. Need some automations
Huh interesting
Strange that you get bugs after 20 minutes
Is it that the screen saver is kicking in or something haha
no idea what would cause that
I haven't found the reasons 😦
I have worked on it for one week but without any progress. If I didn't solve it this week, my boss would get angry I guess.🤣
Yes. I will go back to work. Thanks for answering:)
@late spindle do you mean the combined motion that makes it go once sideways once down or up ?
in a slope
not a glitch, you coded it lmaooo
thanks for laughing at me
but that actually made it better because it used to do the glitch in both dimensions
with that I could move diagonally without wiggling around
@sinful slate
you should get the input direction as a vector2
normalize it, so it's inside a circle and not a square, so you don't move faster diagonally
and then you add that to the velocity
will that also fix the wiggling issue
yes
i’ll try it when I get home
but how would I even do that
this is one of my first times using pygame
right now I did this py self.acc.x = pygame.math.Vector2(1, 0).normalize() I'm assuming this is wrong usage because it crashes when I try to use it must be a real, number not pygame.math.Vector2
pygame.math.Vector2(1, 0).normalize() is a vector, so what do you expect to happen when assigning it to a component of a vector?
to change the values of the vector lol
well, assign to acc then (the entire vector), not to acc.x (a single component)
oh ok
pygame is actually being really good here by throwing an error immediately, rather than allowing you to do this and throwing an error later when you try to do operations with that corrupted vector
Ok thanks
Do you know how to help me fix this glitch tho
1 sec
and I cant move vertically lol
What you want to do is to take a zero vector, and for every direction the player presses, add/subtract one to the correct axis of that vector.
then normalize the vector and assign to the player's acc.
(This is in fact a very common pattern in simple games like this)
isn't that what I already have though
No. Your acc always ends up a vector in one of the cardinal directions (the direction among the pressed ones that you check last).
while using that pattern, you can end up with a diagonal vector, too.
Oh you think the character shouldnt be able to go sideways
yeah maybe thats a good idea
huh?
I don't get it
What you are currently doing can never result in diagonal motion.
the way I'm proposing can
you can use the variables left_axis, up_axis and so inside the vector2
for x it would be right_axis - left_axis
and do the same for the second value in the vector2, but with up and down
these are those values though left_axis = pressed_keys[K_LEFT] or pressed_keys[K_a] or pressed_keys[K_q] or pressed_keys[CONTROLLER_BUTTON_DPAD_LEFT]
convert it to a float or int then
this is just when a key is pressed
yes, exactly
here's an example from my 3d game
different engine, but you get the point hopefully
oh ok
I'll try that
ok so I did this ```py
self.acc = vec(int(right_axis) - int(left_axis), int(down_axis) - int(up_axis)).normalize()
It works :)
yay :)
im new to pygame and im trying to make a button that when clicked it takes the user to a new screen. I have the screen ready but i cant make it so when the button is clicked it takes them there
self.state = 'theme'```
theme is the screen
any suggestions?
nvm
@warped dove upbge
yeah as a game engine
EEVEE is in full rewrite and it's going to be amazing for games
Vulkan port is also ongoing
hmm., do you have any vids/toturials learning this though xdd, I cant seem to find a good vid on youtube
do you have vid toturials about this upbge though xd, pls xdd
if you do pls do send it to me in dms
if you dont, just say xd
hello i need help in pygame, I'm working on a mobile game, how can I make my app landscape automatically?
@warped dove search for bge, most old tutorials are still good except for mesh editing and materials, to edit mesh in game we use bpy / bmesh modules,
To learn about materials check eevee tutorials
ok ok thx
geonodes are brand new, but they work also
learned classes, so decided to make a snake game in terminal with "pure" python (without external libs)
If you are looking at making 2D games, don't forget to check out Arcade: https://api.arcade.academy/en/latest/
@frozen knoll @frozen knoll @frozen knoll
@feral atlas Please do not ping people randomly
guys what the difference between pygame.sprite.Sprite and pygame.sprite.Group?
https://www.pygame.org/docs/tut/SpriteIntro.html (explains it better than I can)
Criteria:
The animation should show a clearly visible square at the start and the movements have to be smooth and clear
Does this video achieve the criteria?
for pygame do i really need to know a ton of advanced mathematics like the quadratic formula or stuff like that
More math allows for games that require more math
If you're making a card game, you likely aren't calculating trajectories and dealing with AI pathing
alright, thanks for the basic rundown, much appreciated.
matrix math is handy for parenting type relationships
in 2d and 3d
modulo is handy all over the place
so is sine() and dot()
cross() is useful, but less useful then most of the other math
Hey, so I've been working on a global latency measurement platform specifically designed for use in multiplayer games.
If you're interested, I threw together a Youtube channel and posted a video explaining the project: https://youtu.be/NHscuLa1IRI
If you've spent any time on online games then you know Lag is the most annoying issue, and could actually be killing your game. Let's do something about that!
Developing Games is hard enough, but it doesn't matter how good your netcode is if the hosting providers you work with are not the best choices for your players. To fix this we need real-...
Don't worry, I'm not going to spam this channel, I just thought it might be interesting to a handful of folks here. I tend to prototype in Python, and consider Python to be my primary language - which is why there's even a python library for it coming to pypi soon!
Hi. Not sure if this is the right question to ask this in, but here it is. If this isn't the right channel, please direct me to the right one.
I'm trying to make a Christmas-related command for the Sir Lancebot project here on PyDis (sir-lancebot#937). I'm trying to read the docs for Pillow, and I understand a lot of it. What I'm trying to do right now, mainly, is mess around with Pillow and see how I can play around with it. Even though I understand most of the Pillow docs, I can't seem to fully understand how to actually make something cool out of this program. Here is my code: https://paste.pythondiscord.com/wofilokama.py
These are the docs I read: https://pillow.readthedocs.io/en/stable/reference/Image.html#examples
I would appreciate some help with this. Thanks so much!
anyone know why this is not printing?
if events.type == pygame.KEYDOWN:
if events.key == pygame.K_SPACE:
for i, o in enumerate(self.t.Objects):
print('loop')
hey
I try to make pong game with turtle from freecodecamp.org
but I geeting some error
https://paste.pythondiscord.com/pukeqikewu.apache
Here the code
I didn't understand the last two lines of code and also error in there
ATTENTION ALL STARTING PROGRAMMERS
I am starting pygame zero and want a group to study and make friends with soooo
yeah
show_words = font.render(words, True, red)
screen.blit(show_words, (text_box.x + 4, text_box.y + 6))
else:
show_words = font.render(showed_words, True, white)
screen.blit(show_words, (text_box.x + 4, text_box.y + 6))
can anyone tell why isnt the words changing into red?
hello can someone recommend me a platform that contains non copyrighted art? i'm not really good at art and i need some resources in my game
@foggy portal - if words in idioms
you don't need the is True bit
as long as idioms is a list
Hey @normal berry!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
print("Hello world")
Destroy at least 50 defeated ogres.
This spawns and configures an archer.
def spawnArcher(x, y):
archer = game.spawnXY("archer", x, y)
archer.behavior = "Defends"
archer.attackDamage = 20
This spawns and configures an ogre.
def spawnMunchkin(x, y):
ogre = game.spawnXY("munchkin", x, y)
ogre.behavior = "AttacksNearest"
Spawns some archers in a row.
def spawnArcherWall():
spawnArcher(30, 12)
spawnArcher(30, 23)
spawnArcher(30, 34)
spawnArcher(30, 45)
spawnArcher(30, 56)
Spawns an ogre wave with a random offset for variety.
def spawnOgreWave():
offset = game.randomInteger(-6, 6)
spawnMunchkin(80, 16 + offset)
spawnMunchkin(80, 22 + offset)
spawnMunchkin(80, 28 + offset)
spawnMunchkin(80, 34 + offset)
spawnMunchkin(80, 40 + offset)
spawnMunchkin(80, 46 + offset)
spawnMunchkin(80, 52 + offset)
def onDefeat(event):
unit = event.target
# Increase the game.defeated counter by 1.
game.defeted+=1
# Use unit.destroy() to destroy it.
unit.destroy()
Set "munchkin"s "defeat" event handlers to onDefeat.
game.setActionFor("munchkin", "spawn", onDefeat)
game.defeated = 0
game.spawnTime = 0
Add a manual goal.
goal = game.addManualGoal("Defeat 77 ogres.")
ui.track(game, "defeated")
def checkSpawnTimer():
if game.time > game.spawnTime:
spawnOgreWave()
game.spawnTime += 1
def checkGoal():
# If the game.defeated counter is greater than 77:
game.defeated > 77:
# Set the goal as successfully completed.
game.setGoalState(goal, True)
pass
for bullet in bullets:
if bullet.y - bullet.radius < enemy.hitbox[1] + enemy.hitbox[3] and bullet.y + bullet.radius > enemy.hitbox[1]:
if bullet.x + bullet.radius > enemy.hitbox[0] and bullet.x - bullet.radius < enemy.hitbox[0] + enemy.hitbox[2]:
if score >= 5:
EBlock.health = 20
else:
EBlock.health = 10
if EBlock.health > 0:
EBlock.health -= 10
if EBlock.health == 0:
enemy.x = random.randint(0, 300)
score += 1
bullets.pop(bullets.index(bullet))``` anyone know why the health wont go up and the bullet just goes through?
Bump
how can a square touch a color when colors don't have shape
how should i store class objects? like what file type?
If I’m storing my users as class objects, how would I go about storing them?
oh no no... It is just a hobby project. I don't want to hire or buy anything. But I expected there should be some open source/free models
Space Invaders: https://github.com/pvcraven/space_invaders
80s look via a CRT OpenGL filter.
my main player flickers and i dont like it
is their any fix
it flickers when it moves because it has to redraw the background
and it has to go thru a list with 7000 - 15000 rect objects in it
(not draw every single one ofc just the ones on screen)
but idk how to fix t
oof game dev is hard
hi everyone, are there any python libraries to design playing cards (like board games ones)? i imagine applying some schema and rules of cards design, sourcing images and automatically scaling it to fit the paper. thanks.
@dusty crypt This might help: https://api.arcade.academy/en/latest/tutorials/card_game/index.html
Not specific to cards, but more a generic 2d library.
Guys I'm trying to make a Pygame project, but when I run it, the image doesn't show up, and when I close it, it appears for a small amount of time, how do I fix this?
thank you!
Brainstroke += 100000000
Share your code: https://paste.pythondiscord.com/
Hi, i have to create game (Tic tac toe) with minmax alg. I am thinking what should be a structure of classes. Right now i think the minimum is State, Move, Player, Game. I am considering add a Board class too. Is it a good idea to choose pygame for it? Or maybe tkinter will be easier?
Either should work. I just had someone share that same project with me written in Arcade just recently. You could even do it with a text interface.
!rule 6
does anyone have a programming / code for Tic Tac Toe? i want the code for tic tac toe
hi, im being dumb and i need help :)
im making a score counter when you click on a rectangle
but whenever i click it goes up by one but overlaps and doesnt update
so uh heres the code for the text:
Green=(0,255,0)
font=pygame.font.Font("C:\Windows\Fonts\Arial.ttf",25)
text=font.render(f"{SCORE}",True,Green)
win.blit(text, (22, 0))```
Are you creating a new one every time?
nvm, this is pygame
y- yes..
usually you clear the screen manually
overlaps with the rect?
you can move the font=pygame.font.Font("C:\Windows\Fonts\Arial.ttf",25) out of the game loop if you havent, this does not need to be called each frame
whats the color of the button
honestly just use unity why use pygame? I mean performance and unity's more productive. you could even use unreal
honestly, why use unity and not just use ursina
You do realize this is a python programming server, right?
What are some good game engines for python besides pygame? (Or is that the only good one?)