#game-development
1 messages Β· Page 63 of 1
how do u make these kind of artstyle
for 3d model
this dude oskar stalberg is freaking cool
his works are so mesmerising
How would I go about making a double jump feature in pygame?
This is my code for jumping
sprites.py
def jump_cut(self):
if self.jumping and self.vel.y < 0:
self.vel.y *= 0.5
def jump(self):
# Check For Platforms
self.rect.y += 1
hits = pg.sprite.spritecollide(self, self.game.platforms, False)
hits_1 = pg.sprite.spritecollide(self, self.game.small_box, False)
hits_coin = pg.sprite.spritecollide(self, self.game.items, False)
self.rect.y -= 1
if hits and not self.jumping:
self.game.jump_sound.play()
self.jumping = True
self.vel.y = -PLAYER_JUMP
if hits_1 and not self.jumping:
self.game.jump_sound.play()
self.jumping = True
self.vel.y = -PLAYER_JUMP
def events(self):
# Game Loop - Events
# Game Loop - Update
for event in pg.event.get():
# Closing Window
if event.type == pg.QUIT:
if self.playing:
self.playing = False
self.running = False
if event.type == pg.KEYDOWN:
if event.key == pg.K_w:
self.player.jump()
if event.type == pg.KEYUP:
if event.key == pg.K_w:
self.player.jump_cut()
Any help would be good
I've tried a lot of things but they don't work
@vestal vessel like you'd do any kind of 3d modeling tbh, you start with some primitive, extrude into all the different tower, bevel all this sh*t, make the roofs with a mirror modifier because you're lazy, add the stairs and the other details (windows, thingys on the roofs, doorways...) and then texturing
Although thanks you, because this is going into my inspiration box 
Ahh sweet thnx for the info sounds easy lol. Hopefully its ez as u make it sound haha. N ur wc
Textering seems the harded :()
IMO it is the easiest here
With some very basic technique you can do some cool stuff
Wait have u told u it can be procedurally generated
Wait let me pop the link for u
For instance, I did this a lil while ago, it is entirely procedural using only two kind of nodes, voronoi noise and color ramps (and some base nodes)
freakk looks pretty neat n hot
Thanks 
u make it sound ez coz u know lot about it lol
I don't know that much about blender tbh
It took me an hour last time to make a freakin' stair because I had only 3 faces and I was struggling haha
Can you screenshot it, I'm on mobile please ?
haha well im just getting in 3d modeling
let me send u a video then
the most fascinating thing about it is
when u actually destroy the middle bit
it will implement the structure the whole structure based on that
but i wanna implement more of earlier artstyle on this. well thats not the issue atm haha
The video doesn't play smh
But I'm guessing based on what you place, it generates the rest of the structure?
Phone says the video is corrupted
It might be the wavefunction collapse algorithm
Hold on
It generates a larger image based on a small sample
This algorithm is crazily simple but awesome
There's a "Higher dimensions" section at the end
i misunderstood, its not what i meant
hmm
let me try another video
nvm freak the video
i wanna make something like the game townscaper is implementing ?? π
def gonna learn how to make the artstyle adapted with that game
this game arts really breath taking
Riiiight I see
Basically, for every square, you choose the asset you want to draw depending on the current type and the the neighborhood squares
You'd want each asset to be as modular as possible, so you can fit them together seamlessly
Sometimes you'd even have many modular meshes inside the same square
About the style of the game, it looks like low poly with some stylized drawing-like texture, if you want to Google that
sweet!!! thnx heaps m8 u really helped me alot π
im gonna dig all the info now thnx again
Any time 
akarys i found the book that implements it and it has also some other stuffs it might come to ur use. you can download it here https://gumroad.com/d/310249614f5ad89c148537bef1cbb96b
hey
Hey im starting game dev
Hey @dawn quiver!
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:
Hey everybody :
I want to put some noises on my game with pygame and I have this error :
pygame.error: Unable to open file '/home/pi/Musique/pain.wav'
My Python is Thonny Python IDE
I tried to put ogg and not wav and its not good !
Please help me
And I insttaled the last version of pygame
I have this error since 1 year !
And I never understand
https://stackoverflow.com/questions/14845896/pygame-cannot-open-sound-file
you might have to reduce the frequency(or sample rate?) of the audio
"Pygame (version 2.9 at least) doesn't support 32-bit float WAVs. Re-encode it to a signed 16-bit WAV (using Audacity for example)."
ok thank you
I see you know the numbers hexadecimal
Hello everybody, I don not know count in hexadecimal, can you explain me this board pls ?
@dawn quiver I am not the best at it
But I can understand a bit of it
So on the right side 0-9 decimal is represented by 0-9 hexadecimal only
While the letters A-F represent decimal 10-15
These are the 16 units
While as in binary system which consists of only 1 and 0
0 is written as 0000
1 as 0001
hum okay
2 as 0010
And so on till 9
A as 1010
Do you know how to convert decimal to binary?
@dawn quiver
Welcome man
HI... im ussing vscode and im getting "module pygame has not init member" Does someone know how to fix it?
Hey @grand patrol!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Basic CsGo Glow with Pymem:
Hey,
I need help with making curve line in pygame.
Im so cool i joined a python group and i only know lua π
You have done some programming then. Easier to learn a new language π
I like ur profile picture
@dawn quiver thanks man itβs my little friend
so im making a text rpg game
and i want to make it so that
whenever they type in "stats"
it shows their stats
is the only way to do this putting an if statement after every input
or is there a way to just set it so that its for any input
T'habites ds le coin ou quoi
whats the best ide for game development?
If you're looking for a Python IDE, PyCharm is a good one. I wouldn't say there is a "best".
VS Code is also a good editor with a lot of plugins available.
alright thanks
vim, vscode, pycharm π
The first two are more like advanced editors while pycharm is a full IDE
What options do I have for rendering a huge point cloud (realtime) in python? Each point is a circle with varaible size and color. Need to be able to explore it.
I know this is more related to rendering than games in general
@night bluff I am guessing you'll want a 3D representation of the point cloud? Panda3D would be my go to, but I haven't played around much with the other options (e.g., Pyglet, ModernGL, Ursina).
Thanks! I will take a look π
Hi, here is a question for someone who knows pygame !
I am doing a pac man but when I move my pacman, the older view still there.
Here is the code to move the player:
def move(self):
self.pos[0] += self.dir[0]
self.pos[1] += self.dir[1]
self.draw()
def draw(self):
self.window.blit(self.image, py.Rect(self.pos, self.size))
(self.pos is a tuple representing the position)
(self.dir is a tuple representing the direction equal here to (1, 0))
I am searching where is the problem in my code but... I don't find at all
level is a dict containing multiple lists of rects and the player object
here is the loop
how many self draws() do you have
the first code is in a class called Player and the second in class Level
@dawn quiver tu parles fr dans un serv avec une commu 99% anglophone
mdr
ok sorry I find the problem, I just forgot to draw the background on the beginning of the frame x)
a
I need help with math for my game
else:
percentage = (self.groupgathering / self.difficulty) * 100
if random.randrange(0,100) < percentage:
self.success()
else:
self.failure()
If the player's skill in that particular task (groupgathering) is lower than the required level (difficulty)
the player can still attempt to do it and have some % chance of succeding
depending on how close they are to the difficulty
however, it always fails, no matter what, even if the percentage should be eg. 97%
It should almost always suceed in that case, but it doesn't work
it always fails even after minutes of trying
guys is the tkinter module alright for python game development?
I have no idea why this doesn't work
I tried to hard-code some values such as eg. to check if it's exactly 50% of the difficulty
and then it works and sometimes fails and sometimes suceeds
but when I try to make a general one like this
it always fails
do you have an idea of what groupgathering and difficulty values are?
When you assign characters to a particular task, their individual gathering skill in that particular resource is added to the tasks's groupgathering attribute, because you can assign more then one character to a task
eg. Character1 has 5 in food gathering
Character2 has 4
when you assign them both to the same task their skills are added together as the groupgathering
so you get 9
and the groupgathering is compared with the difficulty to see if the expediton succeds or not
the succeeding part works fine
but the failing part doesn't
It shouldn't matter how small the values are since this is percentage
25/50 and 2/4 are both 50%
You should print all those values to see if they correspond to what you think they are ;)
π€
Alright
They are exactly as they should be
(I'm using Ren'py so can't conveniently print, but can do a narrator statement)
Hey, Iβd like to build a google maps like feature with my own game map where you can click on pins and itβll give you more data about that location or the player instantly travels to that location. It would be awesome if you could zoom in and out and the pins stay the same size... is that possible with pygame? Or is there another way to do it? Do you have any suggestions as to which libraries/functions could be useful for that? Thx!!
@sacred trout I think... I found the problem?
If I print the percentage, it shows up as 0
even though it should be 50
Why isn't it correctly set to what it should be?
if self.groupgathering > self.difficulty:
difference = (self.groupgathering - self.difficulty) * 10
if random.randrange(0,100) < difference:
narrator("You received a rare item! (" + self.name + ")")
else:
pass
This is my primitive version of the rare item check
I do it the exact same way as the percentage code
and it works
but here the percentage always stays as 0
Should make it an attribute of the class?
and then later clear it?
as an attribute used temporarily, like my groupgathering?
does anyone have a good pygame course
Depends on what you want to do, but I quite like the YouTube channel sentdex!
@placid wigeon its not the same thing, in the first one you have a division and in the 2nd one a subtraction (tho if you want a percentage the first is correct). I think you're using python 2 and dividing two integers, so you have integer division (Aka 2//4=0). Try converting one of them to a float
Or use python 3 :p
Yeah, the Ren'py engine still uses Python 2
It finally works
β€οΈ
It was all because of Python 2 division
Thank you! @sacred trout
Hello, wanting to make a 3D card game where 3 random numbers are generated how can I make it so lowest number drawn it teleported somewhere
Hey @keen marlin!
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:
Hello, wanting to make a 3D card game where 3 random numbers are generated how can I make it so lowest number drawn it teleported somewhere
@slender tulip wdym like teleported somewhere ?? u want it to be hidden ?
and are u using unity for htis
this
@keen marlin Use https://paste.pythondiscord.com/
I doubt it's Unity because this is not really the channel for that sort of thing
Oh I solved the problem myself, itβs okay!
Like to an arena
@slender tulip Have you started on this project? What libraries are you using?
If we don't know what tools you are using we can't really answer the question
The dog can just eat the cards then π
Lol
what is the best place to learn game-development ? anyone
alone, in front of a computer with vscode open next to pygame.com
hey everyone please view my game on itch.io https://coders-code.itch.io/car-game
@raw shadow π
I expected a Python game
isn't it a python game?
No, Unity
oof
is thre a way to build 3d games in python?
Yes, but the engine choice is quite limited. You can use something like ursina or make your own "engine" using OpenGL bindings for python
import pygame
pygame.init()
display_width = 800
display_height = 600
black = (0, 0, 0)
white = (255, 255, 255)
gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('Program')
clock = pygame.time.Clock()
carImg = pygame.image.load("Car.png")
def car(x,y):
gameDisplay.blit(carImg,(x,y))
x = (display_width * 0.45)
y = (display_height * 0.8)
crashed = False
while not crashed:
# --all event--
for event in pygame.event.get():
if event.type == pygame.QUIT:
crashed = True
gameDisplay.fill(white)
car(x,y)
pygame.display.update()
clock.tick(60)
pygame.quit()
can someone please explain why thats an error
and how i can fix it
What error do you get?
Exactly?
And use ``` marks before and after the code so that it's easy to read and the indentation can be seen properly
well its not an error, its suppost to put a car picture on the screen but it just stays blank
How do I make my screen resizable in pygame?
@dawn quiver Panda3D, Ursina, Pyglet, and ModernGL are all options for doing 3D games in Python.
and pygame also, all are mentions in channel description
also check pin messages, there can be some useful thing there
@near wedge whats the best one, or the most used
@acoustic gulch There is no "best one." Which one you use will depend on what you're trying to do. I am personally biased toward Panda3D for most use cases.
Alright thanks so much
Hey guys, all right? this link is for my github. I'm developing a minecraft-style 2D survival game in python to be run on any Windows terminal. If you want to contribute to the project, feel free!
.
@frozen knoll thx
@hushed lynx damn thats nice
lol
so what engines do you guys use?
I use Panda3D
Unreal Engine
@hushed lynx damn thats nice
@dawn quiver π π
@vast widget Arcade https://arcade.academy
ModernGL, but that's not for everyone π
Also Arcade and Pyglet
I think Panda3D might be the only one worthy of the "engine" label. Maybe also Arcade (2D). There rest are graphics libraries.
hello les potes
is pygame easier than flask?
Ursina is good
it has some pretty big limitations
hm ok
like, the most glaringly obvious one is that pygame doesn't use the GPU for graphics
which means it's much less performant than anything that does.
i'm a new dev and i'm wondering what to use
ok
thanks
what engine should i use
for an 8bit 3d side scroller
panda3d, for example.
arcade might be a good choice.
ok
Arcade is higher level library so at least easier to start with. Can be a spring board for trying out other graphics libraries or engines.
Does anyone have much experience with Pyglet?
@dawn quiver You can just formulate your question and post it. if no one responds you can always try the pyglet server
I don't think they have a server I did have a look.
@potent ice thank you so much, I searched on discord and nothing came up!
I think Pyglet is a little out of my reach in terms of Python knowledge at the moment. I'm going to try Arcade which is built on top of it and seems to be a little more beginner friendly. I'll come back to it once I understand event dispatchers and things like decorators.
Yes. It's higher level
You can always try pyglet later. A lot lot of the things you do in arcade is useful in pyglet as well.
Even pygame
Pygame drove me nuts for some reason, took me ages to understand it because I've come from PICO-8.
I might give it another go, the steps to get stuff onto screen seemed to be a lot from what I remember.
I'm still pretty new to Python and was hoping to improve it by making games to drive my learning but a lot of stuff requires reading docs that don't seem to be in English haha
i just made a spike dodge game with arcade.
trying to figure out a way to increase a score counter +1 for every second passed
Cool! Screenshot?
@umbral crow sum up the delta time that is passed into on_update could be one way
i didnt knew making comp display a triangle would be that hard ;-;
Something very strange is happening with my lists
I have a system in my game where after the expedition there is a status report eg. (character1, character2 and character3 are now tired!)
This is achieved by creating a list of characters that are assigned to a specific task and then the first part is a string created with
', '.join that includes all elements of the list except the last one
which is then later summoned with the negative index
This works perfectly fine in one place, but in the other place the same code doesn't work
And some really strange things happen
Well, what's the code, and what happens? @placid wigeon
This is how this is implemented in the failure code, for example
if len(self.list) > 1:
self.result = ', '.join(self.list[:-1])
self.characters_secondpart = self.list[-1]
else:
pass
def failure(self):
global injured_list
self.report_generate()
narrator("The expedition in search for " + self.name + " has failed!")
if len(self.list) == 1:
narrator(self.list[0] + " is now gravely tired!")
elif len(self.list) >= 2:
narrator(self.result + " and " + self.characters_secondpart + " are now gravely tired!")```
This works perfectly and just as intended
I have implemented a system where when an expedition fails, it's possible for characters to become injured
when a certain task fails and injuries occur, the characters that were assigned to it (eg. were in the list of characters assigned to a given task) are then added to a special injured_list
and a very similar code is in the injured() function
but it doesn't work as intended
I think it's something weird related to the .extend command?
For some reason, the characters from the assignment list are added to the injured_list once as elements, and then second time as a list within a list?
I have no idea why this happens
if month == "April":
if random.randrange(0,100) < 99: #it's 100% probability for testing purposes
injured_list.extend(self.list)
else:
pass```
this is the code responsible for adding the elements from a task list to the injured_list
extend should add the elements as actual elements, right?
Why does it do that and then adds the entire list again, but as a list?
I have no idea why this happens
It says on line 18 in "injured" that you're making the call narrator(injured_list). But shouldn't that argument be a string, not a list?
@placid wigeon
Yes yes, I did this just to show you the error message and the weird string in full
This is how it looks like in game
is unity good for developing in python?
the list contains the elements of the other lists and then contains the same elements as a list within a list at the end
I have absolutely no idea why
@tired fjord Unity doesn't support Python
there is a way to use python in unity though
@delicate cliff If I do this with two characters assigned instead of three, this happens
Something very weird is going on
I don't get why the list gets duplicated
the only code that modifies/adds something to it is the .extend command
otherwise it is empty
If that injured_list.extend(self.list) is the only thing that modifies the injured_list, then you need to look further into self.list. Since .extend just puts the elements of self.list into injured_list, then self.list must at some point have a list as an element @placid wigeon
But that's impossible, since when identical code is used to generate the general status report using only the self.list, it works just fine
With self.list it works perfectly
but with the extended injured_list the elements are somehow added twice
Maybe I should just try deleting the last element?
I don't know where it comes from but I can maybe just delete it?
Doesn't work
it deletes the last real element
but the duplicate is still created and can't be removed

What is going on here
there is a way to use python in unity though
@tired fjord not that Iβm aware of, there are some libraries that use hooks to c(++) graphics stuff but nothing with unity/ue
Maybe I can just try using the penultimate element instead of the last one?
It works if I use the penultimate element instead of the last one
I have no idea why this weird duplication happens but at least I can work around it
can anyone help me with how to make my bullet go to the right in pygame(im clueless)
Hein
Download a picture on internet
A png image
And change it with photoShop for example
It s that i do
which library are you using? @old vessel
im using pycharm and importing pygame
@umbral crow im trying to make it go to the right but i goes straight down
do u have any example of basic game dev command ? or something like that
?
@old vessel sounds like you messed up the x and y axes, or something.
with ==?
!e
print(1001 is (1000+1))
You are not allowed to use that command here. Please use the #bot-commands channel instead.
yes, with ==.
because ammoX is actually getting passed as the y coordinate to draw ammo at, lol
not do that, presumably
π
idk what to change, can you show me, would be appreciated ^^
so you want the bullet to shoot from player location?
yh
ye but from the top of the screen
maybe you should put playerY there
uhh, probably it should be ammoX,ammoY
on the bottom?
and ammoY can just be playerY if it's constant.
i mean in fire_ammo(playerX, ammoX) change ammoX to playerY
so that it spawns there
ok done that
it spawns on him now
but doesnt move
what im i doing wrong that its no moving to the right
uhh, probably it should be ammoX,ammoY
hi so im making a game and i want it to split out in too directions can someone help me with that
@teal oyster what do you mean?
edit: do you mean like 2 story paths?
yes
@umbral crow
d1a = input ("\u001b[31mHe has no idea what will happen to him if he eats that he'll be ours.\n\u001b[37mSorry about that, heres your BLT, enjoy\n A)Ask your waitress what she was talking about\n B) Say thank you: ")
a whole lotta if else statements - yanderedev
?
not an expert but something like
if d1a == "A":
print("Outcome 1")
elif d1a == "B":
print("Outcome 2")
else:
print("invalid choice")
not sure if you can use Try/Except here either
what about making different paths
maybe you can also assign diff values with the choices
ex
you define some variable with a bool
BLT = False
if the player took the BLT, you would make the variable True and if they didnt then you leave it at False
then you can check on the value and execute the right path
im kinda new at this could you put it into the code?
walkRight = [pygame.image.load('R1.png'), pygame.image.load('R2.png'), pygame.image.load('R3.png'), pygame.image.load('R4.png'), pygame.image.load('R5.png'), pygame.image.load('R6.png'), pygame.image.load('R7.png'), pygame.image.load('R8.png'), pygame.image.load('R9.png')]
walkLeft = [pygame.image.load('L1.png'), pygame.image.load('L2.png'), pygame.image.load('L3.png'), pygame.image.load('L4.png'), pygame.image.load('L5.png'), pygame.image.load('L6.png'), pygame.image.load('L7.png'), pygame.image.load('L8.png'), pygame.image.load('L9.png')]
bg = pygame.image.load('bg.jpg')
char = pygame.image.load('standing.png')
``` isnt working for me, all the pics are in the same folder as my file
nvm fixed
Hello There, i Hope you all are good, i have a question and i need peple who have been programing for a while... The thing is that i want to make game-development, and i have been learning python for 1-2 months... making web pages with html and css but now i want game-dev so ΒΏshould i stay at python or should i change to another leanguage more game-dev friendly...?
Hey @odd kelp!
It looks like you tried to attach file type(s) that we do not allow (.zip). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
ah
arcade for sure 
Depends what kind of game and how experienced you are
what is best game engine for python
That depends on what you want to do, @dawn quiver
RenPy is a very nicely made engine for visual novels, and is very extensible and customizable if you're experienced with python
Right now I'm working on an RPG in it
pygame is a common choice for games with more real time interactivity, although I have next to zero experience with it personally
There is a 3D game engine for python as well, Ursina
There is a 3D game engine for python as well, Ursina
Although again, I have very little experience with it
(python-specific game engines generally don't compare to more modern game engines such as Godot or Unity)
If you already know OpenGL or want to get into it there are great wrappers and libs for it, such as moderngl
Cool, I'll make note of that next time I have time to play around
thanks
whats a good module to go along with pygame for better gui
Been making a game using tkinter (I know, don't ask) and this code is in charge of binding the keys to movement
Game.bind("<KeyPress-a>", lambda *args: getaxis(-1))
Game.bind("<KeyPress-Right>", lambda *args: getaxis(1))
Game.bind("<KeyPress-d>", lambda *args: getaxis(1))
Game.bind("<KeyPress-Up>", lambda *args: Jump(-7))
Game.bind("<KeyPress-w>", lambda *args: Jump(-7))
Game.bind("<KeyRelease-Left>", lambda *args: getaxis(0))
Game.bind("<KeyRelease-a>", lambda *args: getaxis(0))
Game.bind("<KeyRelease-Right>", lambda *args: getaxis(0))
Game.bind("<KeyRelease-d>", lambda *args: getaxis(0))```
but changing directions quickly just makes the character stay still. Is there a fix, like Unity's Input.getaxis?
Is there a way to do a full workflow test on an online game using Python?
What game developer use
Wow nice work! βΊ
thanks!
making a drag racing game is hard for me
I can do better:
System.out.println ("Hello world")
@vapid path is there a java module that looks like pygame
!tempban 697772507142291456 14d I don't know what made you think you could repeat the offense 1 minute after you were told by an admin not, but it seems you're here just to advertise. If you want to be part of the community, make sure to read our rules before coming back
:incoming_envelope: :ok_hand: applied ban to @vapid canopy until 2020-09-22 21:08 (13 days and 23 hours).
The rules around here seem very complicated
Is it possible to make games with just Microsoft Visual Studio 2019?
i think so
ye with unity I did for 2+ years
where to get started with game dev with python
Sinse when can you make games with python c# with unity sounds more easy comparing to python
You can technically but a lot of the popular modules related to it aren't that peformant and great, like pygame
So would you have to code every block? Like back with how they made original super Mario
@dawn quiver I'd start by seeing if any of the libraries in the channel topic meet your needs.
Oops, wrong user
@teal ember ^
@teal ember if you're new to game dev in general, you might want to start here https://arcade.academy/
ok
freak trying to make a game engine urself as a newbie feels like going against 100_000 level boss as level 1 character
;-;

because it pretty much is
atleast i learned more about opengl and creating shaders using it haha
equiping items to slay the 100_000 level boss
π
are you making a game engine or did u already make one?
i mean like i did plan to make one
but just catching with all the necessary knowledge needed for it
in rust π
Oh yeah rust π€
hey can some one explain this to me?
for b in range(len(ammo)):
ammo[b][0] += 10 # change this to change speed and direction
for bullet in ammo[:]:
if bullet[0] < 0:
bullets.remove(bullet)
for bullet in ammo:
screen.blit(ammoimg, pygame.Rect(bullet[0], bullet[1], 0, 0))
in screen blit, pygame.rect is storing the x and y values of bullet
so in the first for loop, each bullet's X in the list ammo, is being updated += 10
the 2nd for loop is just removing the bullets if their X is less than 0 or maybe offscreen
how did it make my code work?
i have no idea, its a miracle
do you actually not know?
yes
You'll getter better help with more specific questions like "why is it ammo[b]" π
why is it ammo[b]
@old vesselammoapears to be a lis of bullets
but why the b
so to get each bullet you do ammo[b]
the b is an index
It would be cleaner to do for bullet in ammo and then replace the ammo[b] by bullet
what about the range
I suggest that you do help(range) in a python intepreter. Looking at the docs is a good way to understand what things do
docs?
documentation ^^
where
Also there are lots of good explanations about (almost) every topic that here : https://realpython.com/python-range/
what do you suggest the easiest way of learning pygame is?
I have the feelingthat you don't know much python, so a good thing you to learn a bit of python first, by doing simpler things than pygame, and once you are more confident with python, learn pygame and have a whole new range of challenges
A lot of people suggest Automate the boring stuff with python to learn the langage, but really pick any tutorial and try to have fun and make things that you like
piggybacking off of that... i do have moderate experience with python. how would I lean to use Pygame?
Maybe not moderate, but midweight
I personally learned with youtube videos. I liked the snake tutorial by sendex (though I starting to get quite old and I wouldn't recommend it). DaFluffyPotato has excellent videos on lots of specific topics and apparently a tutorial (https://www.youtube.com/playlist?list=PLX5fBCkxJmm1fPSqgn9gyR3qih8yYLvMj), I did not watch it, so I don't know the scope but I can guarentee the quality. http://inventwithpython.com/pygame/ is quite often recommended too
Depends on how you like to learn though
what's the point in making my game when no-one plays it anyway?
grind son
grind.
the good tree grows around all obstacles @low lagoon
@blazing heart check out upbge fork of blender
it's pretty powerful too
I'm not a t r e e
how is this tree typing in chat?

How long do u reckon creating one 3d character after u got all the drawing done ?
Would take?
Depends on the style
If you want a good high poly character based on a drawing, assuming youβre a complete beginner, quite some time
Iβd say a week at 5-6h a day
you drew that?
Okay, unnhhh, may I raise that to a month at 8h a day? π
No lol I wish but in future I will.. Oh well thnx for info akπ
Have you followed any blender tutorial yet, like the donut tutorial? 
No
Not yet
I'm making house atm
Haha
But making donut is ez
Just chuck in torus
N it's donut
N learning substance designer n painter
Oh trust me, making a photorealistic donut isnβt that easy
You should give it a try
the texturing, coloring, pbr, pbi can stay away atm
but im going stylised pbr artstyle
For example, it is easier to unwrap your model before applying any clothe sim
3d modelling is very much about planning, or you will end up stuck at some point
i will keep that in mind thnx heaps for ur valuable insight
added that to list of tuts
now lol
rip tuts hell
Started 2 game developement codes
and many basic level codes
\
does anyone know the code for the snake game in python idle
hi, i tried to use pygame and it doesn't work but in the idle it does (im using pycharm)
They are probably using different python versions?
i only have installed python 3.8, ive checked and pycharm uses the same version
@shrewd phoenix PyCharm uses a virtual environment for each project by default. Did you install the package into the venv as well?
Then please describe what "it doesn't work" actually means π
But what is the error that you get ?
does this help?
Uhh, do you have errors when launching, or does PyCharm just say you will?
i dont have any errors when launching pycharn
So what are these lines that you show?
warnings from the python file
...so, do you have errors when running the program or not?
when i try to run the program it just opens and closes
@shrewd phoenix Make sure you don't have a file named pygame.py in your project.
It'll import from that instead of the pygame package if you do, and cause similar errors.
Not stupidity, no way to know that "magically".
anyone help me with why my hash is going wrong
and anyway to fix and improve my little dice game
hey everyone, do you guys know a way to test a full workflow of a python online game
using flask, socket.io
Hello there... Im thinking to get into python Game Dev... And i would like to know the capacity of python to game dev... So would some of you guys show me the best game you have made? It will be very usefull
Nice!
@valid trellis just look at pyweek games
lol
I'm trying to make a game with pygame, i tried the examples to download/test pygame and they don't work. I don't know if pygame is installed or not but my python version is 3.7.8
any solutions?
What errors do you get ?
If you can't import pygame in a console, then pygame is not installed
ok, so I am using a tutorial to make snake in python, but the keys are not working at all...
can someone take a look and see why?https://paste.pythondiscord.com/zizawatoga.py
there are no errors
hey im trying to make snake using python and turtle can anybody help me make the tail vanish after it
i use a library called keyboard
ah
u have to install it
this its an if statement:
if keyboard.is_pressed('F'):
print("F off")
so close to what I have
so pip install keyboard in my console?
i have to do it like
py -m pip install keyboard
so ya
i am using turtle for the graphics bc i have some experience in it
still having the same issue... ugh
it is refusing to take my inputs
So i normally use unity but want to do a text based mmo with some minor graphical elements in python. What are some packages youd suggest i look at to accomplish this.
Turtle will work, as will pygame, arcade
alright so snake didn't work out because turtle bad
But pygame isnβt as good for visualizing scientific models...
Hey there, can anyone tell me how I can make a gif move threw my screen?
Gaming dev library's besides pygame and arcade??
guys, anything about resource-based strategy games? for browser?
@spiral holly If you check the channel topic, you'll see Kivy, Panda3D, and Pyglet listed. In addition to that (depending on your needs) there is also Ursina and ModernGL.
How do i make the coordinates 0 0 the center of the screen in pygame?
nevermind. apparently pygame doesnt have this function
Yup, you need to basically use your own coordinate system and translate when Pygame needs it. Can whip up an example if you're interested.
Gaming dev library's besides pygame and arcade??
@spiral holly
There's a lot. https://pythongaming.rocks/ My co-maintainer on ppb built this. If anyone knows more about any of these libraries than us, please contribute.
Also, uh, hi, I talk about Python game dev a lot and run https://ppb.dev
Hey there, does anyone how I can make a gif move across my window?
I want to have a gif move around randomly on the window
wont that teleport it to those coords?
I cant really give you an example
I dont want it to teleport, I want to go from its origin point to the random point
Write the origin point and do the same except u take place of the original coordinates and u put the random s coordinates
Sry my english is bad
no problem, I just havent worked with pygame
Okay
U understand
I can reexplain
With trad
I can put the text in my original langauage and translate with google trad
F u want
I just want to help u
Bc i like
you dont have too, Im just gonna read the docs on pygame to learn the basics
Good idea
Me i took lessons
Bro if u want i can do a program and i send him
A program about ur problem
U choose
U are the guest
hey
im new to oop
and i have made some games before using pygame
but i would like to make pong again using oop and classes
can someone help me with this
Hi
hi
How can I help u
import random
import pygame
import time
import os
class player(object):
black = (0, 0 , 0)
white = (255, 255, 255)
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((1500, 800))
def draw(self):
self.screen.fill(player.black)
pygame.display.update()
pygame.display.update()
def game(self):
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
self.draw()
player().game()
pygame.quit()
i have this so far
and i would like to create a rectangle
but when i call the class i have to give an argument
I am not really good with self
Have you used pygame?
i am trying to learn classes and things as i heard it helps when making larger games
do you use classes or work without them
It is good to work with
if possible can you send one of your pygame projects
Or just functions it's same
I am in my car and I have a problem with my computer
I can not
And I didn't really do good projects
I just use it for bc it's fun
But I am not bad with pygame
i am also trying to create a gui to select a game mode(single player or 2 player)
can i do this with pygame
or will i have to use something like tkinter
Tssss
Me too I don't know how do it but it's sure it's exist
Try to search on internet
ok
ok thx
But it's can be a good idea to use tkinter
oh ok
new to python or game-dev
that i know a bit nesting etc
This python course is designed to take you from beginner to pro in the python language. This python course is designed to teach you everything you need to know about python. It assumes no prior knowledge and is a perfect python tutorial for beginners. This course is split into...
this video can get you through all basic syntax
dont need to watch full thing
U can use a picture for a button
wdym?
Re moving objects over time, you're looking for the concept of integrations, I have a handful of samples among talks I've given, but not in a position to explain it all right this second. If you're still trying to move objects around when I'm at a computer, will gladly write up something.
File "F:\Snake\snake.py", line 73
for y in range(0, int(GRID_HEIGHT))
^
SyntaxError: invalid syntax```
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.
You're missing the :
so Im using pygame and this image
turns into this
any reason why?
code used for the image: screen.blit(Navi, pygame.Rect(Ox, Oy, 60, 60))
Ox and Oy are coords
it happens with every image I used, they all get a pinkish outline
ok so I converted tha Navi variable but nothing changed
like so
Navi = Navi.convert_alpha()```
the only thing I think its important besides that is the fact that my window is transparent
This person has the same problem
https://stackoverflow.com/questions/62135125/pygame-and-win32api-blited-image-has-outline-when-setting-background-as-transp
What's the filename for the navi image?
Resources
why?
ohh wait
Its Navi.png
lol
thought you wanted the folder for some reason
I'm trying to remember if I've seen this before. I feel like I have. Is navi partially transparent?
kinda
My guess is if you open that in a pixel art program that band of pink has a slightly different color value than the rest.
whats a pixel art program? does photoshop work?
Photo shop should be able to check it.
I assume you are talking about the pixels that are barely visible
Oh that's definitely not color keyed which is what I was looking for.
Hmm...
life is hard
anyone here good with oop
are there any good libraries that allow you to import assets?
Combine os.walk with whatever game library loader you've got?
So, what are you looking for an asset loader to do?
So. . . like this? https://www.pygame.org/docs/ref/image.html#pygame.image.load
maybe
Mostly was asking in case you wanted more magic.
Yeah, than image.load is probably what you want. Give it a file path and it'll give you a Surface you can pass to Surface.blit.
ok
Every game library uses a slightly different method.
but then your image gets a weird pinkish outline
rlly?
ok
Yeah, any chance you have that code on github? I can grab some of the images and see if I can poke through it.
I never used github
Ah. Any other place you could upload the file?
Hey @jade kettle!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Um, I'll need the image file, too.
Where are you getting win32api?
idk, the base code was given to me
I mean, you installed it into your environment?
ohh I assume so
wouldnt it cause an error if it wasnt installed?
yeah if its just the pywin32 lib then I have it installed
and if by environment you mean the place I program in then its just the Python's IDLE
Im a sheltered programmer, I dont normally interact with others so idk how stuff is called
Uh, when I say "environment" I mostly mean the python site packages. Could be a virtual environment, or a system python, or whatever. I just need to make sure I have the right packages to run the code.
The reason is given in the first comment of the SO that you posted π
It's an image or an array of pixels
ok
@sacred trout Piper said the image isnt key colored
and I also dont understand anything of what the first comment is saying
Apparently the way transparent windows work on windows is by making transparent every pixel that is exactly pure pink. The windows itself is actually keyvolored
But if you blit someone with transparency, you get something that is not pure pink at the edge, because et blends the ping with your semi transparent border
So the resultant color is not pink and so is not made transparent by the system and thus is fully opaque
That's why you get the pink. To get rid of it, you need to use sprites with a sharp edge, and no transparency between 0 and 1
so I went to photoshop and pressed Sharpen Edges
There is less pink
Compared to the start
This pink is caused by semi transparent pixels
You need to remove them entirely
Actually the best thing to do would probably to use colorkeyd surfaces
So I tried this
Navi = Navi.convert()
Navi.set_colorkey(fuchsia)```
while there is no pink
the image didnt make it
new problem
π
I meant using colorkeyd image when drawing them like in photoshop
Thing is, you don't want per pixel alpha in your image
I dont know what that means
per pixel alpha
u are saying that in my image, every single pixel has a different transparency?
hey
does anyone know how to make a bot that can play as a second player in a game
or any videos that can help me with that
You'd need to either hardcode the logic in, or use some actual machine learning, and the latter is pretty complicated.
You're basically looking for game AI which is an awful name for it. There's a bunch of ways to design it, so my first question is what kind of game are you making so I can point you at resources more likely to be what you want?
u are saying that in my image, every single pixel has a different transparency?
@jade kettle
so when we're talking about transparency in rendering, there's two big methods for handling it: color keys and per pixel alpha.
If you've ever seen a sprite sheet where the images are on a garish background, usually magenta, those are color keyed. If you tell pygame the color value of that background, it knows how to filter out the color key and leave only the image.
Per-pixel alpha is talking about a color definition known as RGBA. The alpha channel determines how much opacity that pixel has. So a maximum value in the fourth value in the color tuple (usually 0-1 or 0-255) is fully opaque, and a 0 is invisible. Everything in the middle would show up as translucent.
@viscid nexus im making a basketball game where there and two players on opposide sides trying to shoot on each others nets
for single player
i want to make the computer contoll the opponent
Okay, what kind of mechanics do you have? Can the players move around? Steal? Or is it more like a game of horse where both sides take turns?
players can move around and steal
i havent started the game yet but i got an idea of what i would like to do
i jus need to learn game ai so i can start
so how can i go about this and what should i search online to do so
Behavior trees are probably the best tool for that. After I'm done eating I'll find a couple of the articles I read about it.
https://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php Here's the gamasutra article I kept going back to. It was my primary reference while I was building misbehave.
ha ha triple thread go brr
@viscid nexus ping
BTW, this was the game I was working on. I got a little distracted, though, but I plan to return to it as soon as I get some other stuff in my life cleared up.
. . . Okay, I'm going to actually play with that later because I'm a big fan of twin stick shooters and that's a clever way to gen the enemy spawn.
.> I need to actually make a full scale graphic for that game, but here's the stuff I've been working on that are real games.
I'm literally working on a talk today about the tool chain I use.
The Conway's Life aspect of the game is Cython, the rest is pure Python using Pyglet
Very cool.
Blinks whole thing is just experimentation with steering behaviors.
Smuggler's Run was done for the GMTK game jam because well, I could write a Python game for a 48 hour game jam.
Oh, and I also did this https://www.youtube.com/watch?v=lRPDZhXdFK4 but I didn't release it anywhere
A demo of my recreation of the video game Robotron: 2084, using Python and Pyglet. This game is not available publicly; I created it strictly for my own private use.
And Shooter was actually my first proof of concept that ppb can be used for complex games.
It's funny, technically 2084 is before my time, but one of my pre-software jobs had a cabinet in the break room and I played so much.
I went from cloning the game to doing something inspired by the mechanics, which seems like a good step :D
Definitely! I'm very much always tryign to duplicate mechanics in little proofs of concept, then I use that library of knowledge to design my games.
(Not that I make many anymore, spend a lot of my game dev time working on ppb so other people can make cool games.)
Right now I'm neck-deep in both rewriting my blog software and polishing a tool I wrote to help me with my fiction writing, but as soon as both of those things reach a semblance of stability I'll dive back into this game again.
(Those two count as "web" projects)
Yeah, did that not that long ago.
its best to start off with a text adventure, like im doin now
Here, this talk is mostly focused on the concepts via my library ppb, but it's kind of an overview of the mechanics of 2d games.
I can pull up a tutorial from pyohio and a 2016 pygotham talk that has the absolutely worst recording that covers the high level theory if you're interested.
Piper Thunstrom
https://www.pytexas.org/2019/talk/U2Vzc2lvbk5vZGU6OTA=
Python and video games are both used independently to learn software engineering, so Python game frameworks have an important role in the software development space. Come learn how to make games in Python...
I have to click in the corner not on the sprite for htis to wokr
bear = pygame.image.load("Bear.png")
if event.type == pygame.MOUSEBUTTONDOWN:
mouse_pos = pygame.mouse.get_pos()
if bear.get_rect().collidepoint(mouse_pos): print("Clicked")
how to make tic tac toe ?
nvm fixed
!reosurces we have a list of resources right here, you should check it out π
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Any time!
What is the code of mousebutton in pygame?
hello so im working on a platformer and i want to add a background image to my game
but it wont appear
bg = pygame.image.load("bg.png")
while True: # game loop
display.fill((146, 244, 255)) # clear screen by filling it with blue
screen.blit(bg, (0, 0))
also there are no errors
and it wont crash
pls help
You've to update also
Type pygame.display.update()
Send the complete code
shall i DM it?
Yeah
Alright
In the update section, check the state of the key, then move the rect (pick any point, I like center, but you might work with topleft) a little bit based on which key was pressed.
If you are using sprites you'd do it in your update function.
whats the state of the key and the update section lol
sorry bit of a noob
'''def paddlemove():
global paddle_x, paddle_y, paddle2_x, paddle2_y
keys = pygame.key.get_pressed()
if keys[pygame.K_UP] and paddle2_y >= 0:
paddle2_y -= vel
if keys[pygame.K_DOWN] and paddle2_y + 120 <= 800:
paddle2_y += vel
if keys[pygame.K_w] and paddle_y >= 0:
paddle_y -= vel
if keys[pygame.K_s] and paddle_y <= 800:
paddle_y += vel'''
thats my code
How do i make background tiles in pygame?
when to use opengl vs directX vs vulkan?
OpenGL and Direct3D (before 12) are good if you want a higher-level graphics API. Vulkan is if you really want to get low level.
Vulkan is a ton of extra work.
@quartz cedar if you never need to support anything other than Windows, then Direct3D 11 is simpler to use. Otherwise, OpenGL. If you need to ask, I'd recommend against Vulkan or Direct3D 12.
Iβve heard that Vulkan takes a ton of code just to get running
So unless you really need the performance, OpenGL sounds like the best route
i have a simple game for you guys
just decode what i've wrote
z = "CIA...? am i dumb to you ! lmo i\'ve forget to cook the dinner bye"
t = (z[0] + z[21] + z[-16:-15] + z[8] + z[7] + z[16] + z[27] + z[21] + z[8] + z[18])
t += " dG8gcnVzc2lhbiA" #base64
print (t)
need help with some game ai
dead chat
@molten niche Patience will pay off when asking questions. You were given an answer on the pygame server, but you left the server.
@maiden thunder You need som game or graphics library. Pygame is one option.
but i can create it in pycharm right
i have to download some library or something right?
Yes. I think pycharm will ask you to install it once you add an import
There is also arcade if you like simpler libraries with more resources like this free book https://learn.arcade.academy/
amyone need help
No
how do I add a character to my game I want the character to be a square
I want to get into AI development so that I can make a game
I'm new, but I want to get on the level where I can make AI for a basic civilization-esq game
@warm cradle
try pygame.draw.rect()
in the brackets you need the following infor
alright
(the surface the shape will be drawn on, the colour, the x cordinate, the y cordinate, width, height)
and make the width and height the same since you want a square
thanks it worked! @spare phoenix
i left the pygame server beacause there was absolutely no order
for nothing
no rules no roles no orginization
a few text channels slapped together in 5 minutes andi left
It's a server with some helpful people at least. You could have suggested improvements to the server.
There are lots of very interesting conversations there in general. I haven't even thought about the layout of the server.
I think they don't list separate roles because they want to have a flat structure. There server is not really big enough to care about these details.
Your question was even answered within a short period of time π
Can someone plx answer my question
@spare phoenix Don't have much time, but I found this : https://opensource.com/article/17/12/game-python-moving-player
First hit when searching on "pygame move character". I would post some code example if I had time, but at least this is something.
have someone make ai chess application
i just wanna know what do i need to make this game
Pygame
self.screen.fill((0,0,0), (50,250,650,50))
I understand the first tuple that are the RGBs but what is the last tuple for?
Alpha I think
@void tusk the first two are the top left corner of the screen, the last two the bottom right corner, I think
Itβs a rect
fill(color, rect=None, special_flags=0)
From the docs
@void tusk
Sorry Iβm kinda late to the party
where can i download pygame
@dawn quiver what ide are you using?
pip install pygame
its ez like sleeping
its a shame ive done a mistake on the acronym but ig its alright
I need help adding sprites to my game
@spare phoenix yes