#game-development
1 messages · Page 58 of 1
If you need to do it in your code, you can simply use pygame.transform.scale to your root display object and then create a new display object. But it may require to close the current window for a sec
I haven't tried that before, I'll check it out
@umbral fulcrum yes, that's what I've been pondering about
Do I have to create a new window copy every time the window is rescaled?
There's this, but I don't quite get it:
3 votes and 6 comments so far on Reddit
I didn't even know that we can create a resible window in pygame
pygame.display.set_mode((width, hegiht), pygame.RESIZABLE)
You can, but it won't keep the aspect ratio
And every time you resize the window, you get an pygame.VIDEORESIZE event
Yes, I'm coming to you problem
Sure
What I don't understand is: why do I specifically have to put a window within another window? That's a bit clumsy
@umbral fulcrum sure
Hey, I am a little confused with this LOVE2D function, just started learning the basics. How do you implement or use the function love.graphics.setDefaultFilter()?? Because whenever i try i seem to get the arguements in the function wrong??
@umbral fulcrum still there?
Hi, When i want to develop a game when should i consider Tkinter over Pygame? is that even makes sense ?
Tkinter is a GUI library. If you want libraries/frameworks that are developed for creating games, you can try Pygame. There are also many other libraries like Pygame
Arcade, for example
develop a game?
pygame and frameworks are better used for small prototypes
a full, released game will be harder to do
Python is not the true language for game development, but yeah, you can have fun
imo, it's much better than starting with Unity or any other game engines
It forces you to understand how the actual game engines work
but for getting started with Unity I have to learn C++ or C# am i right?
Yes, C#
Imagine if you can use Unity with python
use ue4
like I wanna build a game where you can have fights and these stuff there's no need to be 3d game...but Im a bit afraid of have some problems that I cant do with pygame
it does support it but not everything is possible
@random frigate start with simple stuff, see what you can do, that might expand you imagination for the game you want to create
If ue4 engine supports python at some fields, you should be able to use any library you want
Describes how to use Python in the Unreal Editor to script content production tasks.
@umbral fulcrum yup I will try to spend some more time with it and see what I can do with it, also I just started with pygame, thanks for the advice.
You're welcome, good luck
u 2 (:
Here's a pixel scene I did yesterday for my game c:
https://twitter.com/pancakebunn/status/1269433763764809735?s=21
Dude, that looks terrific
I love pixel graphic based games, and basicly pixel art
The 'PX' at the end of my name actually abbreviation for pixel :))
@umbral fulcrum I tried to copy the window to a new variable and then do a transform operation
But I think I'm missing something, because the graphics are not showing
I got that
elif event.type == pygame.VIDEORESIZE:
if event.w < 600:
event.w = 600
if event.h < 480:
event.h = 480
console.scaled_screen = console.screen.copy()
console.screen = pygame.transform.scale(console.scaled_screen, (event.w, event.h))
pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE | pygame.HWSURFACE | pygame.DOUBLEBUF, 8)
console.refresh()
pygame.display.flip()
Somehow i cannot open pastebin site, unfortunetly i gotta paste the code here
import pygame
from copy import deepcopy
pygame.init()
current_width = default_width = 350
current_height = default_heigth = 250
root = pygame.display.set_mode((default_width, default_heigth), pygame.RESIZABLE)
main_surface = pygame.Surface((default_width,default_heigth))
main = True
while main:
main_surface = pygame.transform.scale(main_surface, (default_width, default_heigth))
main_surface.fill((255,255,255))
pygame.draw.circle(main_surface, (0,255,0), (100, 100), 50, 12)
for event in pygame.event.get():
if event.type == pygame.QUIT:
main = False
elif event.type == pygame.VIDEORESIZE:
root = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE)
current_width, current_height = event.w, event.h
main_surface = pygame.transform.scale(main_surface, (current_width, current_height))
root.blit(main_surface, (0, 0))
pygame.display.update()
Basicly: at the beginning you're choosing your default window size. If we resize the window, the current size will change. But we want to draw things according to our normal size, than scale them to the current size
the first line in the while loop scales the surface to our orriginal size
After that, you can do everything you want
At the end, it scales the surface to current size
and somehow, i couln't use the original 'root' surface that we define at the beginning
So i decided to create another surface, use it as a core surface and blit it to my 'root' surface's (0, 0) coordinates
I hope you understand
Sorta
Here is what I tried to do
Whenever there is a resize event, just copy the contents of the original screen to a copy screen, then make the original screen take a transformed copy, then update
Would that also work?
It does the scaling part every frame
Oh, no
I'm working on a console-type application
so, there are no complex animations
@umbral fulcrum my code is not working at all though
I just get a blank screen
Can you help me understand what am I doing wrong?
How’s does game development work in python because I’m not sure really about the graphics and stuff like what type of games are we talking about here
The graphics you do with game engines and graphics modules, like every other language...
And you can make any type of game you want
But how
I have never seen a python game with graphics that use stuff like vulka
Vulkan*
@dawn quiver You use libraries, which is a way you can "borrow" code from somebody else.
Do you know any?
One example is the library we are discussing right now, Pygame
Which is actually an SDL library wrapper
@dawn quiver it's a library for drawing into the screen
And also for accessing a computer's sound system
But is there anyway to make it use graphics
Like a game that has some nice looking OpenGL graphics
Sure
It depends on the library you are using
You have functions to say "load this image at window X, position X, Y"
But if I get it right python isn’t for complex games like counter strike because they use a lot of graphics rendering and requires a lot of attention building and either way doesn’t run as smooth and that is why every good game (almost) uses cpp
@dawn quiver https://www.pygame.org/tags/all you can check this page to see what people have done with pygame before
'good game' expression is very subjective, but yeah, c++ runs pretty much faster than python
It's because python is not developed for that purpose
@dawn quiver there's no such thing as what you say. Python can be compiled with tools such as PyPy or Cython
you can also use inline assembly
By the way
This is a pure Python Gameboy emulator
it uses Cython, I believe
What is Cython?
Python translated to C
I'm not really sure about what I'll say, but i guess python compile itself right before it runs, also it uses dynamic variables, these some things that make python slow
And then compiled
Yes, there is PyPy for the first one
@umbral fulcrum not necessarily
I mean, Python doesn't necessarily compile itself before it runs
BUT you can make it do it
Every language needs to be compiled before it runs
Not necessarily. I mean, not directly
I'm writing something that doesn't directly need to be compiled
It's based on Applesoft BASIC
My knowledge about this topic was pretty wrong
But i also couldn't understand what exactly happens when you run a python script
I just read this
def hey(x):
print(undefined_variable)
Even though there is an undefined variable, when you run this, it won't give you any error
But I'm a little bit confused about what that proves
python is compiled interpreted
Python is a “COMPILED INTERPRETED” language. Means when Python program is run, First Python checks for program syntax. Compiles and converts it to bytecode and directly bytecode is loaded in system memory.
@umbral fulcrum can you help me understand something?
Just start somewhere. Arcade is easy to start with at least. What you do with arcade will translate to other libraries anyway
This is assuming you are mainly doing 2D stuff
Sometimes
Do you understand how keeping aspect ratio works?
I'm trying to use Pygame.transform.scale, and the best I can get is this:
This is supposed to be a cursor
@potent ice What am I doing wrong?
I'm trying to obtain height and width from the VIDEORESIZE event, but apparently, if you try to obtain current height from event.w, this causes a loop
No idea, but maybe this is relevant? : https://stackoverflow.com/questions/34910086/pygame-how-do-i-resize-a-surface-and-keep-all-objects-within-proportionate-to-t
I know the new dev10 release have a new scaled mode that is supposed to be faster
I just tried it
but it's buggy
It introduces a few bugs in my code, e.g, the cursor stops blinking, and there's no repeated typing while pressing down
hmm. No idea. I normally use pygame in combination with opengl so all scaling is done in opengl
How?
@burnt stump so you want your stuff to scale upon VIDEORESIZE while maintaining the same aspect ratio of your images? This means you'll be showing different amounts of content depending on the aspect ratio of the window. It becomes more of a math thing than a Pygame thing. You may want to bind certain elements of your project to certain sides of the screen (using math). For the rest, just pick an axis and stretch the surface you're rendering onto to fit the axis you chose. For the other axis, you'll have to add content (depends on what you're doing) as it expands. As a side note, if you're resizing images you're rending, you'll need to keep in mind that Pygame doesn't blur with resizes, so things will look weird if you aren't careful.
On an unrelated note:
@foggy python that’s exactly what I want
There are no images, just text
The problem is that trying to modify or access event.w and event.h is triggering a loop
Pygame 2.0-dev 6 has the behavior I want, but it’s very buggy
what do you mean by triggering a loop?
@foggy python I mean the event resize loop gets called several times
In some cases, “eternally”
I don’t have that issue and I’m on 2.dev6
which is odd
you might be doing something wrong
@umbral fulcrum
I was able to develop downloadable Blackjack game and then I realized so many functionalities are easier with PyGame..
So i kinda felt like I
... waste my time with the Tkinter lol
There aren't any UI elements in Pygame, that's why it was easier to me to create that game in Tkinter. It took me a couple of hours back then, shouldn't be hard.
Is that GIF from one of your games @foggy python ?
@foggy python Tested dev10?
@umbral fulcrum yes
@potent ice dev6 has been pretty stable and I’ve heard of a ton of issues on the newer releases, so I’m sticking with 6 for now.
Hi?
@foggy python I can't really understand how pygame.transform.scale works
I can figure out it rescales something to a target resolution
but for some reason, I can't use it properly
For example
elif event.type == pygame.VIDEORESIZE:
if event.w < 600:
event.w = 600
if event.h < 480:
event.h = 480
console.scaled_screen = console.screen.copy()
console.width = event.w
console.height = event.h
pygame.transform.scale(console.screen, (console.width, console.height))
console.screen.blit(console.scaled_screen, (0,0))
'''console.refresh()'''
pygame.display.update()
This doesn't work
(it has no effect)
Are you trying to resize your main rendering surface?
Just redefine it with new dimensions.
@foggy python I'm trying to scale it
elif event.type == pygame.VIDEORESIZE:
if event.w <600:
event.w = 600
if event.h <480:
event.h = 480
console.scaled_screen = console.screen.copy ()
console.width = event.w
console.height = event.h
pygame.transform.scale (console.screen, (console.width, console.height))
console.screen.blit (console.scaled_screen, (0,0))
'' 'console.refresh ()' ''
pygame.display.update ()
I do not understand
c to do what?
Sorry, what?
I did a video on window resizing. I’m busy atm tho so I can’t link it.
You can google for it tho
What should I Google for?
@foggy python I managed to scale the screen. The command prompt is upscaled, but when drawing the cursor, it still draws to the old size.
because It's a separate event.
So your issue is that you’re only scaling some of your stuff?
@foggy python I think so. Trying to draw to a main window and then upscaling fixed some of them, but not all.
Instead, I have this now:
That looks like you aren’t clearing your screen every frame and you scaled the display once
in games, you have to clear every frame otherwise everything will be drawn on top of each other
You also need to scale what you’re rendering
Normally I render onto an intermediary surface and scale that before blitting to the main surface
I just tried to do that
But the prompt is not upscaling
Do you mind if I show you the source code?
Ooooh... no wonder it wasn't working
Apparently, Pygame scale images and fonts differently
just for future info: most engines or libs for game dev will scale images and fonts differently
It would be much easier if Pygame scaled this automatically from the beginning.
I know version 2.0 has a SCALED argument, but it breaks a lot of stuff in my code
and it doesn't seem to work properly for some reason
(e.g, only works sometimes)
whats up guys, if any of you make 2d game chracater can you tell me what programs you used for that,because Im looking for a simple one for a beginner (me) ?
a game engine?
@formal seal Im using pygame
you guys are so smart. lol. i have no idea whats happening.
@random frigate if your doing a pixel art game, aseprite is amazing, its 20 dollars.
Does pygame have a quick way to convert a font to an image?
@forest pebble thanks I will check it out,also do you know any free other programs?
@burnt stump Arcade includes scaling and rotation. You can also set a viewport to scale the whole window. Works at the hardware level so it is pretty fast.
@random frigate Gimp, GraphicsGale, Piskel, Lospec, Krita, and Paint.net are all free
@forest pebble thanks I downloaded GraphicsGale hope it will be good
why don't people created games where you can earn money in the actual game?
maybe like for every other player you defeat you get $0.0001
Or will the developer be giving away a lot of money
Why don't you pay someone else for defeating monsters in a game? You could start it. Just need a pile of money and some legal stuff.
@frozen knoll Arcade?
it's a lib
Oooooh
for programming 2d graphics for python I think
Dude, I was reading some Applesoft documentation, written in the 80s
It's so ridiculously clear it makes me cry
that sucks
I just keep comparing it to today's documentation, and I keep thinking
"What happened?"
I don't know, there's good documentation out there
eh, I've seen better than Microsoft's docs
but I can't argue since I have to focus on programming right now
@formal seal the point though is that it's very well-written
I am not deniying that it's just that you can't compare that with documentation because it's a guide
I don't even see many guides like that today
How many guides do you have that teach Pygame in a clearer way?
I don't use pygame so I don't have any guides for it
This is Applesoft's BASIC reference manual, btw
That's what it calls itself, at least
This is a quick reference guide:
see the difference?
But even here, it's still veeeery clear
yes it is
makes sense
@burnt stump Arcade: https://arcade.academy
And that Applesoft manual was one of the books that taught me programming. What a trip back.
hello
is there any way in pygame to rotate a sprite image around a specific point?
How would you do AHK's version of PixelGetColor (https://www.autohotkey.com/docs/commands/PixelGetColor.htm) in python?
hello
Is python actually a good language for game dev
how would i smoothen the edges?
while raytracing
i read that one can apply anti-aliasing and some post-processing after the raytracing is done
but how exactly?
Anti-aliasing seems like the way to go here
I don't exactly remember how that work, but basically you do some additional samples between pixels, and use the median value for your actual pixel
Although, you should also increase your render size or sampling
@exotic fern do you have a slightly higher res version of that?
something around 640x480
Hey everyone, for a school exam i need a python bot for a simple game can be anything and analyze it does anyone have a game bot in python that he/she can give me (can be any game, browser or etc etc)
this is a 3x3 blur kernel on the edges of the img, using 35% alpha blend
side by side:
right now the edges get quite a bit darker because your background is just black.
if you make it transparent, it will look better
and it will also look a lot better if you use a slightly higher render resolution, because there is only so much you can get out of a 320x200 image 😉
so first we find the edges, and then we blur them to get this
thats our mask for blurring the main image
but because just blurring the image in those areas looks very blurry, we combine the blurred areas with the non blurry image by alpha blending them
that way you can control how visibly blurry the edges are
and by changing the kernel size you can decide how broad the blur should be
def anti_alias(img, kernel_size=(3, 3), alpha_blend=0.35):
"""
perform post processing anti-aliasing on the given image
:param img: input image
:param kernel_size: size of blur kernel
:param alpha_blend: [0-1] alpha weight of blurred image
:return: anti-aliased image
"""
beta = 1.0 - alpha_blend
# find the edges and blur the image
# 100 and 200 are threshold values.
# Feel free to play with them if you aren't happy with the edge detection. (widen for more edges, narrow for less)
edges = cv2.GaussianBlur(cv2.Canny(img, 100, 200), kernel_size, cv2.BORDER_DEFAULT)
blurred_main_image = cv2.GaussianBlur(img, kernel_size, cv2.BORDER_DEFAULT)
# if you want to take a look at the detected edges
# cv2.imwrite("edges.png", edges)
# weight the images based on alpha
blurred_main_image[np.where(edges != 0)] = (
blurred_main_image[np.where(edges != 0)] * alpha_blend
)
img[np.where(edges != 0)] = img[np.where(edges != 0)] * beta
# combine them
img[np.where(edges != 0)] += blurred_main_image[np.where(edges != 0)]
return img
im trying to write a class where a function takes input from the init function as an argument
can someone help me with that?
@torpid pewter you can use a little bit of math
Rotate the image, then rotate the position of your image due to the other point's position
Wrong ping, sorry
Welcome to the @fierce wraith CG classes, sit tight and listen carefully haha
hehe
its really a super simple algo using tools already out there
i think fxaa does some other fancy stuff, but this is just what i could come up with real quick
Hey so even though I'm still rather new to Python, would it be a good idea to pick up a game dev library while I'm still learning?
arcade is pretty cool! and friendly for beginners
What are you using for raytracing?
I can't install pygame 😭
I don't know if this is technically considered game development but Im making a simple turtle hangman game in shell and I am encountering some small issues. If someone could help that would be great
!ask
Asking good questions will yield a much higher chance of a quick response:
• Don't ask to ask your question, just go ahead and tell us your problem.
• Don't ask if anyone is knowledgeable in some area, filtering serves no purpose.
• Try to solve the problem on your own first, we're not going to write code for you.
• Show us the code you've tried and any errors or unexpected results it's giving.
• Be patient while we're helping you.
You can find a much more detailed explanation on our website.
@merry echo i didnt do the actual raytracing, that was @exotic fern i just had some fun with post processing Anti-Aliasing
This loop seems to bug out the turtle graphics, whenever I type any letter it bugs out even if it a correct choice. This is for a simple hangman program
@proud holly this is just a guess, but it might be because the if statements should be changed to else if. That may be causing confusion for the computer. (First section is if with elif, and number of guesses is a seperate if/elif section)
Is python actually a good language for game dev
@jagged plume Depends
The general answer is no
It's not
The general answer is no
@dawn quiver
Maybe C#, since Python is for beginners? I'm just guessing here
There is no such thing as "for beginners" unless you are talking about scratch level programming
Python is relatively "beginner friendly" that doesn't mean it's for beginners
Python is just not integrated into some of the bigger game engines
Ah I see, but is C# still the go-to option in most cases?
C# is what unity uses
Unreal use C++ I believe
Unreal also supports a bunch of other stuff like Javascript and python
Interesting
C# is what unity uses
@dawn quiver
I might stick to both python and unity
After all, I've only learnt python for like 2 days
@pliant dust it turns out it was because I put it in a weird section that was making it be called every refresh tic in the while loop. It made like 30 or 40 bodies in a second and it was too much for my crappy computer. I just moved it so it was under the else statement and it seemed to work
this is a 3x3 blur kernel on the edges of the img, using 35% alpha blend
@fierce wraith wow thanks for this.
is there anything i can do to improve the quality during rendering?
and how do you make the background transparent?
right now what i do is if the ray does not hit any object just colour it black
also do you know how we can model a material like glass?
Just set the alpha channel to be Transparent
Instead of black
Glass is modeled with refraction
Check the refraction section on that article
It explains the math pretty well
If you need any help figuring out ping me
Yeah during rendering you can just sample more @exotic fern
You can do msaa ssaa and many others
pYeah during rendering you can just sample more
@fierce wraith what is meant by sampling?
Ah more rays
Just set the alpha channel to be Transparent
@fierce wraith and what do you mean by alpha channel?
More is better!
So pictures are RGB but they can also be RGBA
With the last channel being alpha
How transparent something is
Ah more rays
@fierce wraith i have a question, like how do i make more rays? right now i am projecting one ray so i project multiple rays?
So pictures are RGB but they can also be RGBA
@fierce wraith ah okay got it
so it means that my image will ahve 4 channels?
You mean you you are projecting one ray per pixel?
how does projecting multiple rays help?
You mean you you are projecting one ray per pixel?
@fierce wraith yes
Yeah, 4channels
So either you initially set the image size to 4x what you want, project one ray per pixel and then scale the image back down
Or you just send 4 rays per pixel with offsets from the center of the pixel and average them
The second option has a bunch of different options for where in the pixels the rays are
Like random, just spaced evenly, blue noise, white noise, random offsets from certain points, different patterns of fix points
Or you just send 4 rays per pixel with offsets from the center of the pixel and average them
@fierce wraith so i would average the 'color' got from the 4 pixels is that right?
So either you initially set the image size to 4x what you want, project one ray per pixel and then scale the image back down
@fierce wraith does this method have a name?
Or you can go as far as to try adaptive superpersampling where you decide how many rays per pixel based on some criteria
thanks!
So one ray per pixel and sacling down later vs multiple rays per pixel and averaging is exactly the same thing
Just some slight mem savings on the second one I guess
Is called multisampling or supersampling
They are all very similar
I'd just give them a quick google
All of this raytracing talk is making me want to get back into it!
its really interesting!!
i might look into some machine learnign approaches for ray tracing as well
it seems like a good place to apply that
Now you're just making me jealous ;)
😄
Usually you go up to like 128+ samples per pixel to get nice and smooth results...
Raytracing on the CPU is pretty slow
hi does somebody know of an alternative way to open an .png file in pygame, i have tried pygame.image.load() but it prints out an err.?
pygame.error: Couldn't open maze.png```
That would normally happen when your image is not in the same directory as your python file.
Or you are hiding file extensions and your image is really maze.png.png
it is in the same file an i just checked the extension and it looks good
i tried to import os and giving it a directory to run but with no success
and its wierd because it worked just fine yasterday
@visual bobcat you might try explicitly stating the path of the image from the root. I don’t know if that would work, but it’s worth a try.
hey im getting into this and using a pygame tutorial, im on the first page and its already acting up
i put a basic red surface on the screen and it doesnt show up except when i drag the window so part of it is out of my monitor
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
ok
init()
screen=display.set_mode((500,500))
background = Surface((500,500))
background.fill((255,0,0))
background=background.convert()
screen.blit(background,(0,250))```
just what was on the tutorial i was looking at
Is that your entire code?
And, are you getting any error?
First of all, using * importing isn't healty at so many cases, use import pygame instead
ill try that
Then you gotta replace most of the classes/variables with pygame. at the beginning
So your new code will be like this:
import pygame
pygame.init()
screen = pygame.display.set_mode((500,500))
background = pygame.Surface((500,500))
background.fill((255,0,0))
background = background.convert()
screen.blit(background,(0,250))
i still have the same problem
And i didn't quite understand why are you converting the background
because it said so in the tutorial i looked at
and when i got rid of that it still happened
Yes, you're creating your window so far, but because there is no other action, the window will close right after it opens
I think you should keep watching/reading that tutorial
This is just the beginning
i just get a blank window and when i drag the window so it is off the monitor then the section that was off the monitor renders correctly
It's not off the monitor, the window is closed
I'm running the same code you pasted, this is what i see:
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
[Finished in 1.4s]
Let me give you a basic example
import pygame
pygame.init()
root = pygame.display.set_mode((500,500))
clock = pygame.time.Clock()
main = True
while main:
for event in pygame.event.get():
if event.type == pygame.QUIT:
main = False
root.fill((128,0,0))
pygame.display.update()
clock.tick(120)
pygame.quit()
The very basic structure of pygame looks like this
You need a mainloop first. Then pygame.time.Clock object to prevent your script run million times a second, pygame.display.update() is for update everything you have and changed, and also, there must be a way out of our mainloop, otherwise your program will crash without any action. So collect all the events and look if we decided to close our window, if we did so, then set main to false - which will break the loop - and quit
As i said, you should learn everything step by step, you can continue the tutorial you started
Also, pygame's documentation is very user friendly, you can check that too
thanks, that fixed it
You're welcome
How can I add music to my pygame?
it should support ogg also
and whatever SDL mixer supports
I think it only supports WAV files, so keep that in mind.
@mint zenith You could export it to some DAW and then export it back as a WAV
How can I add music to my pygame?
@fierce trench pygame.mixer.music
guys I wanna create a game but im actually afraid of drawing things(even though the game is 2d and kinda pixel art) but I don't know much about drawing and stuff like these can you give me any advices for how I can learn it faster or be good at it?
How to release tkinter application after development
I have developed a tkinter application in pycharm
How to convert it to exe file
trace stuff @random frigate
As in existing things
Or u could buy them
if tracing stuff just add a few extra things to avoid copyright
@dawn quiver you mean by trace like draw stuff?
@tardy marsh use pyinstaller
@exotic fern did you get glass working?
@exotic fern did you get glass working?
@fierce wraith not yet, i was busy with some other stuff, i will tag you if i get around to completing it!
need pygame help on #help-dumpling
i want to make a game in pygame thats like doom 1993 what would get me started?
@fierce wraith btw that thing about RGBA channels
i am encoding my image in a PPM format right now
does it support RGBA?
i dont think so
Can someone help me make a snake console game ```
import time
import keyboard as kb
import random as rand
gameOver = False
score = 0
direction = 0
xpos = 0
ypos = 0
fypos = 0
fxpos = 0
if gameOver:
print("You died.")
print("Your score was:", score)
time.sleep(20)
quit()
def framerate(fps=1):
while not gameOver:
time.sleep(fps)
map()
snake()
def map(wide=20, tall=20):
for t in range(tall):
for w in range(wide):
if (t==0 or t==(tall-1) or (w==0 or w==(wide-1))):
print(end="#")
else:
print(end=" ")
print()
key = input("Enter Key: ")
def snake(head="@", body="=", mass=0, dead=False, y_pos=0, x_pos=0, dir=0):
snake_size = head + (body * mass)
while not dead:
print(snake_size) #dir 0 = UP, dir 1 = LEFT, dir 2 = DOWN, dir 3 = RIGHT
if y_pos == 20:
dead = True
elif x_pos == 20:
dead = True
score = mass
if dead:
gameOver = True
def food(style="*", efood=False):
x = rand.randrange(1, 18)
y = rand.randrange(1, 18)
if efood == True:
x = rand.randrange(1, 18)
y = rand.randrange(1, 18)
print(style)
efood = False
if (xpos == fxpos and ypos == fypos):
efood = True
#Game starts here:
framerate()
Can someone help me make a snake console game ```
import time
import keyboard as kb
import random as rand
gameOver = False
score = 0
direction = 0
xpos = 0
ypos = 0
fypos = 0
fxpos = 0
if gameOver:
print("You died.")
print("Your score was:", score)
time.sleep(20)
quit()
def framerate(fps=1):
while not gameOver:
time.sleep(fps)
map()
snake()
def map(wide=20, tall=20):
for t in range(tall):
for w in range(wide):
if (t==0 or t==(tall-1) or (w==0 or w==(wide-1))):
print(end="#")
else:
print(end=" ")
print()
key = input("Enter Key: ")
def snake(head="@", body="=", mass=0, dead=False, y_pos=0, x_pos=0, dir=0):
snake_size = head + (body * mass)
while not dead:
print(snake_size) #dir 0 = UP, dir 1 = LEFT, dir 2 = DOWN, dir 3 = RIGHT
if y_pos == 20:
dead = True
elif x_pos == 20:
dead = True
score = mass
if dead:
gameOver = True
def food(style="*", efood=False):
x = rand.randrange(1, 18)
y = rand.randrange(1, 18)
if efood == True:
x = rand.randrange(1, 18)
y = rand.randrange(1, 18)
print(style)
efood = False
if (xpos == fxpos and ypos == fypos):
efood = True
#Game starts here:
framerate()
@dawn quiver just a tip but start to use Object Oriented Programming aka oop
@exotic fern im not sure, but i suggest you use the imageio lib, it handles a bunch of formats, but is super lightweight
it has two functions, imwrite and imread (self explanatory)
you can pass a numpy array to imwrite
probably even a python list, not sure about that though
no, needs to be a np array, but thats not to hard to get 😉
here is the list of formats imageio supports: https://imageio.readthedocs.io/en/stable/formats.html
i used to use either ppm or something like pillow to read/write images, but it really doesnt get any simpler/lightweight than imageio
Is there any tools that will enable me to make maps for pygame?
(In game terrain/map)
Guys how to make player stand in a block so like when the player jump if he fall at a block he stand at it and don't fall all the way down?
with pygame do I have to add some kind of a hitbox if this make any sense?
@oak python Check out the "tiled map editor"
how would you guys get a movement system in a terminal rpg?
@random frigate as in put a paper that's thin over an existing image and trace over it if u want and then add some changes to it free style
or just use stickmen idk
Hey guys, does anyone know if when I'm going to create a game to sell at Discord (I mean by paying for the dev licence and having store channels in my server) I have to first create an app and create based on that, or I can just link the game with the application later? If so, how?
how to make 3d game in python
You mainly don't haha, but if you are really motivated (and like boilerplate code) you can take a look at pandas3d
Hi, I'm having a little bit of an issue with Pygame. Whenever I try and run my program, I get a TypeError, stating that I can't pickle font objects. When I comment out all of my text related code, it then says that it can't pickle Surface objects.
Is pygame known to have issues with pickling in certain scenarios? My code doesn't use pickling, and the only major changes I've made since last time I ran the code were organisational.
I get as far as rendering a scene, and then I click on play, call another set of rendering methods and it all crashes.
are you using multiprocessing somehow?
No, just the one thread
hm. weird
I'm gonna start placing breakpoints to see exactly where it all falls apart but I really don't know what the root issue could be.
Ok, it seems to all break on this line.
Are there any alternatives to copying an instance like this?
well do you actually need a deepcopy?
I don't remember the distinctions between the different types of copies
I wrote this a while ago 😅
I'll look it up quickly
Actually, wait, I don't need a copy at all
I've reworked this part of the code.
No longer having a pickling issue. Thanks for pointing it out! lol
I guess pygame objects dont like being copied at all, makes sense.
@knotty slate with what program are you coding it ?
I'm using Pygame and Python
Python as a coding language or the program ?
Python as the language. I'm using VSC to write it.
Misunderstood the question, sorry
No problem thanks.
I am going to be working on my chess engine. if anyone would like to join a voice call and discuss it with me let me know
anybody have tips for me a beginning coder? (im learning as of this minute)
codecademy
also many tutorials on youtube
socratica is a great channel
also sentdex
Tech with Tim
@dawn quiver
@dawn quiver Good luck on your trip btw
@dawn quiver also there's a channel called kidscancode I heard a good stuff about it,there's pygame tutroial there
@dawn quiver Check out https://learn.arcade.academy
lol so many pings but tysm
np, guys do I need to use ML with making enimes attack the player?
You can create a simple ai, you don't have to use machine learning for a simple 'find and shoot' enemy. But of course, I don't know what are you dealing with
@umbral fulcrum I want to create a game where a bot can fight a player ,but I want to make it hard to defeat it. Do it need ML is this situation?
It depends on what the game is. For example if it's a shooting-like game you could just program the bot yourself and give it very high stats like accuracy and agility
@buoyant swallow most of the fights in game will meele wepons and some body movments its about naruto anime if you know it
@frozen knoll It's available on ubuntu i hope? sorry for the ping
If you expect to provide multiple frontends to a game (curses, a graphical GUI), would it be bad form to make a single repo host multiple python packages?
For example, assume the curses frontend is the built-in default, but there's also a non-curses one. Would it be acceptable to have a a git structure as below?
git_root
game_module
game_graphical_frontend
the pypi packages would then all have the same homepage
There might be other front-ends for other graphical systems as well eventually
how would you scale the whole window according to hidpi settings in arcade?
im not sure that it exposes that functionality directly at the moment
i may have asked about it in the arcade server though
I hope its the right section for this, and my question is bearable but What are the pros and cons of kivy and Pygame?
Kivy is very good if you want to run on mobile, but it has some strange issues on OS X that likely aren't going to be resolved any time soon
pygame is an old framework that seems to be fairly stable and unlikely to change
you can use it with GL wrappers, but that may not be the best idea right now as opengl might be getting deprecated sometime soon on mac
If you're a beginner, imo arcade is a much better library
you lose some fine grained control with it, but it's very easy to get your project going
I think all of the libraries may have some issues on OS X actually
but 90% of users won't run into them
@split aspen what do you want to build, and how much experience do you have?
With python i have less than 3 Months experience of coding
do you want playable results fast?
I'm just trying to learn an Additional language
Kivy is very powerful but it can be very confusing, and requires you to effectively learn 1 and a half new languages that aren't useful anywhere else
Arcade will let you get a game up fast, but it doesn't yet have a good UI framework built in
also i don't think arcade has ways of building for mobile right now
Hmm interesting, Thank you. @grand imp
Going the other direction from arcade, Kivy can be argued to be a UI framework
but also a framework for doing other things
It also has a builtin framework for settings panels, but it is extremely mobile oriented
i don't recommend that for beginners
Why do you want to try a new language now?
3 months isn't really that much time as far as getting to know python and programming in general, especially if it's your first language.
It's not my first
I'm just trying to add a secondary language since It seems pretty effective (Less typing, More results)
Oh i was using c#
lol
The amounts of ";" ive missed are bigger than human sins combined
what IDE are you using?
VS
hm, i though it would help with that
its perfect
may i ask, what's the arcade support server's link?
wait
this is the one?
i joined and it's animal crossing...
https://discord.gg/f9tgMj this one
ah thanks
...
You could also ask any questions here
how would you scale the whole window according to hidpi settings in arcade?
arcade does not seem to have a builtin support for that
pygame has it in the latest beta/alpha versions iirc
Right now im reading the pygame docs and it's looking kinda THICC and with that I mean old so it doesn't make a nice documentation like discord.py 😦
Do they have a readthedocs page?
Unfortunately the official pygame docs is like that
Though there are other resources
@dawn quiver if you want a tutorial there's a good one https://www.youtube.com/playlist?list=PLzMcBGfZo4-lp3jAExUCewBfMx3UZFkh5
I got a question
What are the best colleges in the US for game development or just to major in computer science in general?
first=int(input('Who Is The Coolest?'))
print(first)
help?
@dawn quiver im new but i think you forgot the " inwho is coolest cause now its not a string
no you can use ' ' but thanks
ok
@dawn quiver so where's the error?
ive fixed it
Oh ok nice
lol i suck
Guys btw rotating an image is not working in pygame
I have a variable player which is :
player = {
"x": 10,
"y": 10,
"img": pygame.image.load("player.png")
}
oke so, i got this question as i don't seem to find anything related to in on youtube. I want to make a 3d character respond by with animation to this type of code. My question is what should i be doing in order to have it move?
Rotation works in Pygame, it just isn't super-easy. Nor is it hardware accelerated. (It is pretty easy in Arcade though. cough cough)
And when I try to do :
for event in pygame.event.get():
if event.type == MOUSMOTION:
player["img"] = pygame.transform.rotate(player["img"],int(angle))
It doesn't rotate
It just gets bigger when my mouse gets near it
And if you are curious , my angle variable is :
angle = (180 / math.pi) * -math.atan2(rel_y, rel_x)
And rel_y is mouse positon y - player y and rel_x is mouse position x - player x
I just wanted to make a top down shooter
If you aren't set on pygame, rotation is easy in Arcade. Just set the angle of the sprite. https://arcade.academy/examples/sprite_bullets_enemy_aims.html#sprite-bullets-enemy-aims
@dawn quiver np these things happen too much at the beginning its ok, also its nice from you to try to help (:
ty
np.
Guys how I can make the hitbox move with the pic
like if the resolution of the screen changed how I can deal with it?
like if a pic like this and I want to make an object over the things that are under the waterful if the resolution of the screen changed how I can change the place of the object also?
what if you just lock it to one resolution :c
just increase res and increase the size of the ibjects by the percent you changed the rez too
@random frigate
i think
How do you put that in code@dawn quiver
I'm asking as well, Tryna have the same vision as yours
Oh, I know that some video games depend more on the Aspect ratio (4:3 16:9 16:10 and Put 21:9 with 16:9)
I mean you have the object has certain WidthxHeight in every ratio rather than every resolution
@split aspen hmm so like what I can do?
because if the screen get bigger or it just be lesser then how the program can know where's the x,y for the things I want?
The screen gets bigger when the player Chooses the Change the resolution right?
yup
So just put each resolutions into categories (According to the aspect ratio) And Set Which one loads for each category
oh but like this I need to hardcode a lot of things
I was thinking of if there's any specific algorithm for this
its not going to work like this because if the player wanted to play in a full screen mode and of course(most of the time his screen resolution will be different of mine)
attempting to scale from 40x40 to 30x30 for an example would ruin the looks
If you really want the multiple resolutions you can just make one aspect ratio?
720p +
Oh actually what I meant when I said the resolution of the screen is its width and height
yup thanks mate I will check this out
im new to coding, and have no idea how to. Where can i get started?
arcade is super fun!
like when I give the things I want to make an object for something and lets say the person who's playing has a screen that is bigger or lesser than mine then how im going to deal with these objects?
and beginner friendly
im new to coding, and have no idea how to. Where can i get started?
@haughty shoal How new?
@split aspen 0 coding experience
well actually a little because i had a class
but the teacher was jus an old geezer who hated us
Start by the python course in Freecodecamp, they don't use any ads
Then decide what you really want to build
then just select a specific framework and just learn it
if you're really interested in actually bringing results fast
I would also recommend a book called automate the boring stuff with python it cover the basics in a very good way
The best thing is to know what you want to do, It's easy to get stuck in a learning hole in those fields honestly
i actually became more motivated when i knew i wanted to make video games, at least from the coding side
what about drawing side xd
Well, I'll try to get into it when i actually master the ability to break down problems into small pieces xD
I'm really focused in the problem solving side
oh like leetcode and these stuff?
No, its just like C# way
where most of the stuff into methods
and just call them in the main()
ohh
But in my head xD
lol
I actually wanted to jump into ML and robots but when I was learning it I was saying like "WHAT THE HELL IS GOING ON" so I asked some people and they told me that it needs a lot of math and Im still in highschool so I didn't learn these things ,after that I stopped programming for a month maybe(doing just little things) and I came back for it now because I really want to keep up with it
Yeah, you'll need to know statistics maths most of the time
xD
oh its getting out of game dev
I mean its still related a bit
you can make an AI that plays a certain game
Eh most of all its all about data xD
Eh, Until you have lots of NULLs in your data
I don't think an artificial intelligence can replace any field except security_maybe
oh robots now actually replacing a lot of things you know amazon robots?
It's just the basic stuff
lol
I heard that its going to replace 60 millons jobs but at the same time there will be 120millons new jobs
Yeah, since the past we're just switching the kind of stresses we have
Oh its really getting out of game dev
lets stop here
yup
hello
i was wondering what type of programing would we need
for something like developing an app
App that serves what?
"Tracking" is a really difficult thing
Like just the country?
Or the exact location
Probably you'll need swift prog language
Exact location will need government permissions xD
Even City is difficult thing
oof
You can use the trick truecaller used which is when you download the app and use your phone number
You're automatically giving out the identities of all your contacts
But, The problem is you still can't really track someone's location
hmm another idea
what about an app that for example compares the prices of airline flights, so you could buy the one that saves u the most money?
Actually, i remembered that phones keep your coordinates in the photos data where it was taken
You can usually extract it from photos taken by phones
And it's really related to #cybersecurity
my second idea was a safety like app
where people and go on and alert other neighbors if like theirs a criminal around or dangeroutside
what about an app that for example compares the prices of airline flights, so you could buy the one that saves u the most money?
@dawn quiver Sure, You can tell the app the Grab the data from a set of airline flights websites (Api) and just put it from best to worst according to the Numerical price :p
The problem about your idea is how do you actually grab the data
You'll need a direct contact to each security agency
i mean the safety app
ye
true that
im not gonna use that prob
might stick with the airlines idea and
maybe an app that when you subscribe to stuff or have bills, it alerts u as the payment date arrives
Or, You can spread raspberry PI all across the world that captures the analogue signals and knows which one is for 911 and It just displays data on that range
That sounds a bit complex for a beginner like me 😛
for the safety?
its usually most of the apps xD
I mean facebook app grabs its data from facebook server
for an example
right?
Just use this way of thinking to most of your apps
ideas
maybe you'll be creative
oh its still out of game_dev
I'm not sure what you're asking
Yeah, You can use any IDE that supports your language
k


Is there anyway to easily resize the map size with pygame
I have no background image or anything like that I just want to be able to zoom out
Just define a size variable
and like set it to 0.5 . then multiply all of your variables related to like size and stuff by that
Hey guys how can i manage to play a vaw file in my python.exe file
Guys should I move to godot from Pygame/Cocos2d ?
@gritty crescent wav?
@tall pewter most likely yes if you're interested in developing more complex games
a more fully-fledged game engine will make it much easier
Oh I see
hello can somebody help me with my assignement
I was down with fever and didnt attend lessons for 1 whole week
and now there is a python game i gotta make by tomorrow
it only requires the use of if and elif
please let me know if you can help!
I could probably help @rich sinew
@tall pewter or you could use GameMaker or Unity :)
@maiden shale thanks so much!
cus it has 35% weightage for my programming essential module
0.o
i will dm you
hey could someone solve why my game can't work as an .exe file pls
If you explain the problem somebody should at least be able to take a look.
i was waiting for someone to respond
Btw guys are there any good engines in Python (Except Godot)
I mean I liked Cocos2d and PyGame
But PyGame is kinda too beginner
Arcade https://arcade.academy
there aren't too many python game engines
if you're interested in learning python then those which are available are a good idea
but there are others and it can be useful to learn a new language in the framework of a game engine
I mean
I know C++
But I can't install libraries
Since I'm a windows user it's a pain in the a$$
And I don't like Unity
I hate it*
@tall pewter if you're looking for 3D, there's Panda3D.
I mean , yeah but I don't like to make 3D games for now
I guess Cocos2D/Arcade is the way?
Yeah, I'd probably look into Arcade for 2D.
I'm kinda biased, but I think arcade is great for 2d games. Once shader support is released, it will be even more powerful.
what do you want to create
A game for a game jam
upcoming?
what platform do you want it in
if its in Python then you only have to choose between Arcade, pygame, cocos2d and pyglet if you want lower level access
ik but which is the best?
though Arcade and cocos2d uses pyglet anyway as a dependency
I'd go with Arcade, you could learn the others later on if you wanted to anyway
if you're comfortable with what you're using, i don't know why you would switch esp. for a jam
there really isn't a single 'way' per se
I switched from PyGame to arcade cause the rotation has problems
So much problems*
Like I wanted to make a top down shooter and it didn't work
But PyGame is kinda too beginner
@tall pewter I certainly disagree, you cannot expect from a python library to help you with all cases. I'm not even sure if pygame is called a 'game engine'. But arcade is also seem like a great library. Plus, you can easily contact with the creater of arcade in here : )
@tall pewter There's a list of Python game engines at https://pyweek.readthedocs.io/en/latest/libraries.html including many more
ik but which is the best?
@tall pewter The one you like
hello can somebody help me with my assignement
I was down with fever and didnt attend lessons for 1 whole week
and now there is a python game i gotta make by tomorrow
it only requires the use of if and elif
please let me know if you can help!
@rich sinew You can ask your question in this channel, I'll try to help
Wow I see Pyglet > Arcade
Arcade is built on top of pyglet though
Kind of. Arcade has a completely different drawing and sprite implementation, only using pyglet for opengl bindings in those cases. The window/event management is pretty much pyglet.
Yeah I see
I'm just using pygame for now
There are a couple of days left on this Humble Bundle of game assets: https://www.humblebundle.com/software/art-assets-music-and-sound-effects-software?hmb_source=humble_home&hmb_medium=product_tile&hmb_campaign=mosaic_section_2_layout_index_3_layout_type_threes_tile_index_1_c_artassetsmusicandsoundeffects_softwarebundle
...but the license terms are not compatible with PyWeek: https://pyweek.readthedocs.io/en/latest/rules.html#existing-artwork-music-and-sound-effects-may-be-used
hey, plz can someone help me to create my proper pac-man on pygame contact me on dm
anybody know what is wrong with this
its just
import pygame
pygame.init()
that is the first few lines
nvm, copy of the same file
can somebody help me make a game
I've been trying to get a custom cursor to work on Pygame that doesn't rely on the set_cursor command built into Pygame already, because I don't want to have a black-and-white bitmap cursor. Every time I try to do it, however, it leaves a trail of cursors instead of simply following wherever my cursor goes. The cursor needs to overlap other surfaces at times, so using fill() won't help. Any ideas? Should I pose this question to one of the help chats?
@wintry dirge What game are you trying to make?
I need a better library for the game I'm making, so I guess I can use my limited, acquired-today knowledge of Pygame to help someone. 😦
What type of game is it supposed to be? A platformer, an RPG, or something else?
Something else
Can you explain the basic mechanics of the game?
Do you know the game stick fight?
It’s kinda like that but with different weapons and maps
So lots of rag doll movement
Lots of particle crap
And a lot of bullets
So
I have never made a game before
I know about that game, yeah.
Well... you could get started with Pygame, but I'm warning you, Pygame can be really primitive at times.
I think carving your code with a rock and a hammer is less primitive than Pygame, so living in a hole is perfectly acceptable.
Actually I can put them in now
I gotta make more still
These are a few
I just messed around in ms paint until I got some stuff that looks good
Alright, I need a library that's good for 2D game development and is more powerful than Pygame. Which should I choose? I've looked at Pyglet and Pandas3D and can't deduce whether either of them are suitable.
For reference, this isn't going to be some intense platformer or anything that requires lots of motion quickly; it's going to be a 2D word game.
But it's a pretty technical game and requires lots of sprites and overlays on the screen at once. Are there any libraries that are particularly good at doing that?
This is probably a super-generic question, but any help at all would be greatly appreciated. Please PM me if you have any good suggestions, because I'm going to bed soon. Thanks, everyone.
@dawn quiver Pyglet is basically for directly rendering images to screen, I wouldn't recommend it to do a fully featured game if you don't want to loose your mind with boilerplate code, and Pandas3D is, well, for 3D, so it doesn't work at all for 2D, my best advice would be to use the arcade library 
Arcade, huh? I tried Arcade out. Are you sure it'd be the best decision? What about it sets it apart from those other two? @fervent rose
Thank you for your response, by the way.
Well, the other two aren't suited to build a 2D game honestly
They serve different purposes
Oh and BTW arcade uses Pyglet behind the scene, it more or less just provide a really lire abstract interface
My main problem with Pygame was that it had a lot of limitations. For instance, the way you need to manage surfaces and sprites is rather inefficient to me and has a lot of limitations .
For instance, if I wanted to create a sprite in Arcade using a pre-made picture or image, how would I go about doing that?
Yeah, I'd advise anyone to stay away from pygame as much as possible, it has a really bad API IMO
Hold on, I'll get you some examples :)
I learned that the hard way...
Here is an example of an animated sprite https://arcade.academy/examples/sprite_move_animation.html
They also have a really good arcade tutorial at https://arcade.academy, you should take a look at it 
I took a brief look at it, but figured that Pygame was okay since I knew more about it. Big mistake.
I'll be sure to recheck that Arcade documentation out tomorrow. Thanks again, Akarys!
Anytime!
@dawn quiver If you hate the API of Pygame, check out Pygame Zero: https://pygame-zero.readthedocs.io/en/stable/
hey, plz can someone help me to create my proper pac-man on pygame contact me on dm
from turtle import *
from random import randrangew
from freegames import square, vector
food = vector(0, 0)
snake = [vector(10, 0)]
aim = vector(0, -10)
def change(x, y):
"Change snake direction."
aim.x = x
aim.y = y
def inside(head):
"Return True if head inside boundaries."
return -200 < head.x < 190 and -200 < head.y < 190
def move():
"Move snake forward one segment."
head = snake[-1].copy()
head.move(aim)
if not inside(head) or head in snake:
square(head.x, head.y, 9, 'red')
update()
return
snake.append(head)
if head == food:
print('Snake:', len(snake))
food.x = randrange(-15, 15) * 10
food.y = randrange(-15, 15) * 10
else:
snake.pop(0)
clear()
for body in snake:
square(body.x, body.y, 9, 'black')
square(food.x, food.y, 9, 'green')
update()
ontimer(move, 100)
setup(420, 420, 370, 0)
hideturtle()
tracer(False)
listen()
onkey(lambda: change(10, 0), 'd')
onkey(lambda: change(-10, 0), 'a')
onkey(lambda: change(0, 10), 'w')
onkey(lambda: change(0, -10), 's')
move()
done()
so above is the code for a snake game that i made
So?
XD jk not trying to be mean
Nice job
But PyGame is a better library
Just saying
Creative use of the turtle library I like it a lot
I'm using pyscroll with pygame, and loading my map with pytmx. I want to know if there is a way to get the data for the current location the player is at. I have the players coordinates on the map (I'm pretty sure), but I want to know if there is something on the layer that all the walls are on
Hi guys. I am quite new to python and programming in general, and i just want to ask, is pygame really as bad as everyone makes it out to be?
not really
it's a great place to start
obv it's not great in it's functions or anything
but it's pretty good for basic and some advanced things
i like it
@compact ermine Pygame is really bare-bones, and to some, it's considered less a library and more a very basic game framework. What it lacks in power, it makes up for in simplicity that is virtually unmatched by any other game development library for Python, although the simplicity of a library is largely based on perspective and what YOU think is easy to grasp.
The only library I can think of whose simplicity matches that of Pygame is Arcade; if you're looking for a more powerful, but easier, alternative to Pygame, try out Arcade. They have an extremely thorough tutorial on the basics of the library, so picking it up shouldn't be extremely difficult after giving that a read.
Since you're new to Python and programming in general, I would recommend using Arcade's official documentation. It is specifically designed for those who are new to Python and are interested in game development. Basic concepts of Python programming, such as if/else statements, for and while loops, error checking and object-oriented programming are gone over in that documentation.
Of course, this is just my opinion and Pygame may be far more powerful than what I portray it as; I prefer Arcade, personally, but a lot of others on this Discord and elsewhere recommend Pygame instead.
Thanks! ill check out Arcade
Pygame Is best treated as SDL bindings
Also try out my new engine, Wasabi2D: https://wasabi2d.readthedocs.io/
😮
What's it for? 2D game design?
I might actually use this for the game I'm trying to remake!
Is it more of a physics engine, or is it for any 2D games?
It's not coupled to any particular physics engine
Oh, that's just a graphics demo with my own physics
Wow, this is really great! I might actually use this instead of arcade for what I'm working on.
Oh, I don't need a physics engine for what I'm designing; I was just wondering whether it was more designed for physics engines or if it can be used for any 2D games.
So that's another killer feature: https://wasabi2d.readthedocs.io/en/stable/coros.html
Can you briefly explain what coroutines are in the context of game design and how they're used to improve Wasabi2D?
I apologize for the programming lesson request, but I just want to make sure that, when I use Wasabi2D, I can use it to its greatest potential.
I can't believe I'd actually find a decent engine for the game I'm making in Discord out of all places. Thanks a million, @calm thistle! I'll give you an update on how my tests go.
You can join my Discord for W2D if you like: https://discord.gg/jBWaWHU
Coroutines allow one function to execute over many game frames
That's the simples way to describe it
Oh! That's cool. I think I may have accidentally created a subroutine or two while working with Pygame, but not in the same way it works with Wasabi2D, I'd presume.
If I had a custom cursor for my game and I made it so that the custom image of the cursor followed the position of the cursor on the pop-up window that my game is on, would that be considered a coroutine?
No, currently input is not integrated with the coroutine system
But in principle, yes, you could write
async def follow_cursor():
async for pos in mouse_moves():
cursor.pos = pos
async def = "Allow this function to suspend between frames"
async for = "Allow the thing I'm iterating over to suspend me"
hello can somebody help me with my assignement
I was down with fever and didnt attend lessons for 1 whole week
and now there is a python game i gotta make and its already overdue
It has 35% weightage on my overall grade so please I can pay whatever I have but pls help
it only requires the use of if and elif
please let me know if you can help!
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.
Guys for some reason pygame in not opening any image inside another dir
so here's my code I have been stucked with this problem for like an hour now python walkRight = ["adventurer-run-00.png","adventurer-run-01.png","adventurer-run-03.png","adventurer-run-04.png","adventurer-run-05.png"] walkLeft = [] full_path = "/naruto game/player_animation/Adventurer-1.5/Individual Sprites" for index,item in enumerate(walkRight): walkRight[index] = os.path.abspath(os.path.join(full_path, item))
pygame.image.load(self.walkRight[(str(self.walkCount // 2))]```
File "/home/mohammad/Desktop/The long journey of programing/python/pygame/naruto game/sprites.py", line 38, in draw
win.blit(pygame.image.load(str(self.walkRight[self.walkCount // 2])),(self.x,self.y))
pygame.error: Couldn't open /naruto game/player_animation/Adventurer-1.5/Individual Sprites/adventurer-run-00.png
this is the error msg
@random frigate Can you open any other PNGs within the list? If you can, it might be a problem with adventurer-run-00.png specifically. That tends to happen when the PNGs are missing or corrupted.
Also, in that for statement, are you checking for index, item or index.item? If you're looking for the latter, you may have a syntactical error with the comma that was added in that for statement.
Can you open any other PNGs within the list? If you can, it might be a problem with
adventurer-run-00.pngspecifically. That tends to happen when the PNGs are missing or corrupted.
@dawn quiver I just tried that out when you told me but it didn't work, also about the for loop isindex, item
Alright, so it's a tuple you're searching for over and over again, I'm presuming?
You might want to try using os.getcwd() and os.path.join() together to make sure you're pointing at the right files.
os.getcwd() returns the current directory of the .PY file you're running it from, so if you're trying to open a folder that is in the same directory as that .PY file, you can use os.path.join() with that current directory to get to the folder without having to directly specify every part of the directory.
oh so im running the python file from "/naruto game"
do I can delete more code?
ohhhhh
It worked when I used os.getcwd()
@dawn quiver thanks a lot mate
👍
Anyone know why getting .htaccess to ban certain IPs is not working with Apache / WSGI / Django?
If I wanted to make a multiplayer card game in python what would be the best solution?
@toxic sinew I'm guessing you'll be sticking to 2D then? If so, I would lean toward Arcade or Kivy.
Yeah, I have experience with several 3D game engines on the art side but for this I'm just messing around with some code so sticking to 2D. Thanks! Is youtube a good source for tutorials using Arcade and/or Kivy?
Awesome, thanks for the help 🙂
Now setting where keyframes are dumped :D [was going in last played]
recording gameplay to blender keyframes in blender 2.9
also armature actions are recorded in this to a new track - something the original bge could not do (stock)
guys is it better to create a class for each character or there's another solution?
Class can have many objects, right?
ya
So..uh..you can have different character objects for a single class
Wait im not sure with my answer because im not too good with classes I will check it out