#game-development
1 messages ยท Page 1 of 1 (latest)
hi
Sorry to inform everybody that responded to me but I am restarting without any tutorials to see what I have learnt! I am struggling to finalise a method that will shoot bullets from the middle of my spaceship, here's my code: https://paste.pythondiscord.com/jipilozasi
Why do you apologize? You've done nothing wrong.
They all took the time to point out errors in my code and provided solutions, just felt like I had wasted their time
No. Instead of apologizing you should thank them.
You've not done something wrong, do not do that to yourself, it's not a good trait.
hi
guys plz help me i was trying to make a collision ,so i created 4 rects to make a square but whenever the player go to the left rect for example he stop why ?i just started learning pygame one month ago so i dont have alot of experience
HELLO
wait if you made a collisoin
doesnt that mean that its a boundry on that side?
guys what does this picture mean
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)
i dont understand
Hey @river cargo!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
๐ต๐ฒ๐ ๐ด๐๐๐ ๐ฑ๐ผ๐ฒ๐ ๐ฎ๐ป๐๐ผ๐ป๐ฒ ๐ธ๐ป๐ผ๐๐.....๐๐ต๐ถ๐ฐ๐ต ๐ฎ๐ฑ๐ ๐ป๐ฒ๐๐๐ผ๐ฟ๐ธ ๐ฝ๐ฎ๐๐ ๐ต๐ถ๐ด๐ต๐ฒ๐๐ ๐ฒ๐๐ฃ๐ ๐ณ๐ผ๐ฟ ๐ฝ๐น๐ฎ๐ฐ๐ถ๐ป๐ด ๐ฟ๐ฒ๐๐ฎ๐ฟ๐ฑ๐ฒ๐ฑ ๐๐ถ๐ฑ๐ฒ๐ผ ๐ฎ๐ฑ๐.....
I used PyInstaller to create an executable of my game, I did this on a Mac. But when I send the zip file to my friend (whoโs on a Windows), he gets a file which he canโt open. I put all of the game assets on the ZIP file, and I can open the executable just fine on my computer. Does anyone know what the problem is?
mac executible. not a windows executible
also mac uses a different file system
Ah I see, is there any way I could make it Windows executable?
Salutations! I was wondering what does the ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108) errror mean?
Hi, I have a prob. In my game there are text maps that you can move around with WASD but it uses win32api which only supports windows. I don't use the input function because it takes input before it shows up with your prompt. If I use the win32api and input function then the input prompt it shows something like wadwasdwadddas. So I want to find a lib that supports windows, mac, and Linux that I can use to make my own input function.
keyboard?
The Programming Language Battle Royale. In this video, I put every programming language in a battle arena to determine which one is the best.
Nice vid bro
Hi, I have a prob. In my game there are text maps that you can move around with WASD but it uses win32api which only supports windows. I don't use the input function because it takes input before it shows up with your prompt. If I use the win32api and input function then the input prompt it shows something like wadwasdwadddas. So I want to find a lib that supports windows, mac, and Linux that I can use to make my own input function. I know of keyboard but I think it only has input for waiting for a key to be pressed not checking for a key to be pressed in a loop.
This is my old input function
def restricted_input(text, keys, max_length = 1) -> str:
hex_keys = []
for key in keys:
if key == '1':
hex_keys.append(0x31)
elif key == '2':
hex_keys.append(0x32)
elif key == '3':
hex_keys.append(0x33)
elif key == '4':
hex_keys.append(0x34)
... # To shorten
elif key == '9':
hex_keys.append(0x39)
elif key == '0':
hex_keys.append(0x41)
hex_keys.append(0x42)
hex_keys.append(0x43)
... # To shorten
keys.remove('0')
keys.append('a')
keys.append('b')
keys.append('c')
... # To shorten
print(text)
display = ''
while True:
time.sleep(0.11)
for index, hex_key in enumerate(hex_keys):
if win32api.GetKeyState(hex_key) < 0:
if len(display) < max_length:
display += str(keys[index])
clear()
print(text)
print(display)
elif win32api.GetKeyState(0x08) < 0:
display = display[:-1]
clear()
print(text)
print(display)
elif win32api.GetKeyState(0x0D) < 0 and display != '':
return display
I know of keyboard but I think it only has input for waiting for a key to be pressed not checking for a key to be pressed in a loop.
>>> from keyboard import is_pressed
>>> help(is_pressed)
Help on function is_pressed in module keyboard:
is_pressed(hotkey)
Returns True if the key is pressed.
is_pressed(57) #-> True
is_pressed('space') #-> True
is_pressed('ctrl+space') #-> True
>>>
line 28, in <module>
start_button = Button(100, 200, start_img)
TypeError: Button() takes no arguments
what does this mean
start_button = Button() no arguments means you cant fill in the parenthesis
SCREEN_WIDTH = 1920
SCREEN_HEIGHT = 1080``` this is how i started my window would you like me to send you the tutorial im watching so you can follow along aswell?
guys can someone bad at art(pixel art to be precise) become good at it with practice or is it like a talent that is not for everyone .
Definitely the first. Not only do you need practice, you also need study. I recommend studying drawing and painting in general and not just pixel art, since they're really the same and there are better learning resources.
thanx man i will practice i am an intermediate at pygame i know how to code verry well on python and i wanted to improve my art skills then moving to music/sfx.
How do I add a cooldown to lets say jumping in pygame?
Is it like:
cd: bool = False
def jump():
cd = True
pygame.time.delay(5000)
cd = False
Does that wokr?
Save a timestamp when a jump is performed and check the timestamp for every jump attempt
1000 = 1 second
Ur so smart! โค๏ธ thank you
@potent ice
I have this:
if pygame.time.get_ticks() - 2 > self.stamp:
print('woooh')
self.y -= self.VELOCITY
self.stamp = pygame.time.get_ticks()
``` but it isn't working, how come?
def __init__(self, x: int, y: int) -> None:
self.cooldown: bool = False
self.stamp = pygame.time.get_ticks()
self.x: int = x
self.y: int = y
I'm trying to make flappybird
The bird isn't supposed to fall
until the jump is completed
im not sure how to do that
and Im also not sure how to add a cooldown for the jump
until the previous is completed
or maybe not until its completed
like a 0.5 second delay
because all it does right now is if i hold space
it doesnt check
I have a text label with the number 10 on it, I want to make that number go down one how would I do that?
[1] ammo = Text(text="10", scale = (4, 4, 4), origin=(6.5,4.5))
Hi, I am looking for a coding friend to help me on a project. I have been coding for more than 2 years now. I have been working on a project called PyBattle. It is a Pokรฉmon style fighting text game where you can move around maps. It doesn't really work yet and I have a lot of idea to add.
The code is here: https://paste.pythondiscord.com/qogazugiqo.py
Nice piece of code ๐
It's a download, I'm calling mod.
<@&831776746206265384>
sup?
Click that link, it will prompt a dangerous download.
that's discord being paranoid about the .py extension
it just takes you to a pastebin with their code
Oh okay, sorry for bothering y'all, usually I call a mod when that happens, but I'll remember later.
I've read everything. It looks interesting. Really. I'd like to play, when it will be finished :)
Thanks for giving me support
anyone that can guess what im creating๐
mine sweeper
xD
Hello, someone tell me how I put resources to my game as images and sounds?
How do you disable/enable a def function?
Neverminds
has anybody done networking in ursina?
becuase whenever I do this
from Ursinanetworking import *
server = UrsinaNetworkingServer("localhost", 22625)
def update():
server.process_net_events()
it gives the error could not be resolved for both Ursinanetworking
Hi
Iโm new to game development
i want to create my first game with python
and uhh
I donโt know what to do
or what to start withโฆ
can anyone help me pls
just ping me if you have an answer
Game development is pretty challenging
I'd recommend being confident with your language fundamentals first
In that case, pick up a nice graphics framework
pygame is a popular choice with a lot of cross compatibility
You can even run pygame applications on the browser now
The docs and examples are great
i would start out with less "games" but more sort of these simple samples
what you need to do to start is just worry about finishing what you start
once you can learn to finish projects you can slowly improve and make them better
oh ok
like
my first project i made in pygame
was literally a square that moves around the screen
and i couldnt move it off screen
then my second one was just pong
techwithtim made good tutorials
for pygame
but dont follow them exactly
you want to learn the patterns that he is using (the main loop, the clock, getting key input, etc)
then use those for your own games
yeah trying to learn patterns or algorithms from guides is good but you should also try to use them and create your own games
as long as you dont just look up your idea and then copy a tutorials code
make sure you at least use their code to understand
Wait i think i have seen it
ah ok
iโm gonna try watch it
use a separated tested and maintened python networking library for that, and preferably compatible with async model and webrtc if you want to run on web someday
what
what
is there a tutorial on how to do that
nope most of game lib networking are written in C or C++
oh
you may find some documentation in their bindings
well in the past it was quite easy to use pyenet, but it would be more interesting today to bind to something that look like humblenet
Hey Can someone point me to the correct channel where I can ask my queries related to image processing and Computer Vision Stuffs?
Wassup, i think Ursina engine has finally made a macOS port, any1 tried?
it has always worked on mac
I can confirm
Was it? Idk i heard it from this clear code tutorial (but it was 2020)
1:16 https://youtu.be/DHSRaVeQxIk
A basic tutorial on how to create Minecraft in Python by using the Ursina Game Engine. This also includes a general introduction to the engine itself.
Timestamps:
0:00 - Intro
1:24 - The basics of Ursina
15:49 - Creating Minecraft style blocks
35:25 - Creating a sky, a hand and adding sounds
Project files are available here:
https://github.co...
It did work then too, it just wasn't listed on the website. Mainly be cause I don't have a Mac to test on
Technically everything that panda3d works on, ursina also works on
Well, thx for info, clear code got me messed up
Oh hi poke.
How would I fix this? Everytime I shoot the number goes down but. which is good but it moves for some reason.
Code: https://pastebin.com/nFmP6xDa
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.
Are you the ursina dev by any chance?
yes
I tried to make a 2d game with pygame
It didnt work well
You have a typo on your ursina website on the API reference.
well thats an honour ๐ณ
Hi All. https://www.pygame.org/ reports "Internal Server Error". Who to contact?
I'm not saying that I want to immediately jump into game development but I want to head in the game development direction. So far I have made a bunch of terminal games and a few Tkinter windows applications. Any advice?
Pygame tutorial, then recreate the game without a tutorial. This will give you a solid base of game dev. Then study unity, roblox studio or ue4, then c# or lua, c++ if you have the guts.
Im not a pro yet but hope its helpful
would you recommend any specific tutorials?
gimme a sec
I watched this one, but i suggest you watch it twice (game dev can be very time consuming) https://youtu.be/AY9MnQ4x3zk
In this tutorial you will learn to create a runner game in Python with Pygame. The game itself isn't the goal of the video. Instead, I will use the game to go through every crucial aspect of Pygame that you need to know to get started. By the end of the video, you should know all the basics to start basically any 2D game, starting from Pong and ...
cool thanks
But if you want to work for a company, i suggest you make a few games on pygame, as its good for general cs knowledge
If youre going indie, you can try just going straight into Unity or UE4 (but you will have to learn c# or c++ which are hard)
I was thinking of doing a pygame course/tutorial but I have seen a lot of people who have just started just go into this channel and say "what's the easiest game engine to use" and I just wanted to make sure I wasn't rushing into anything to advanced even though I have been coding for a while
Yeah I will eventually go into c, c# and c++ but for now I want to fully learn python and js before trying a new launguage
Imo you dont really need a course, you can watch a few tutorials, but the key is to do stuff, and not just listen to tutorials
for pygame
for Unity a course would not be a bad idea imo
Anyway good luck on ur journey
thanks a lot mate
hi
im having an issue
im trying to do a scrolling background
but
for some reason its scrolling the wrong way
Hey @brittle grove!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Hey @brittle grove!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
it wont let me send the pictures that u need
but can anyone help
i want it to scroll so that the car will look like its driving forward
right now it looks like the car is driving backwards
What type of game you're making?
this was the original game
now i want to make it with cars
every time u answer correctly the car goes faster
You did the Art?
the bg u mean?
no
Maybe this is the issue? Your scroll variable is always having a negative value or 0. Since you add that variable into the y value of where you want to blit the road. It actually causes a decrease in the y value. Decrease in y value = going higher in pygame.
Looking from your car image. Its direction is upwards. Im guessing you want the road images to go downwards so that the car looks like its going upwards. Why dont you try replacing the
scroll -= 5
line with
scroll += 5
(?)
Hey, im here to make some new friends who are keen on pygame. Maybe to exchange our game code and give each other tips and share experience
Feeling a bit lonely doing this project, so if some1 is up for a nice chat, or even a teamup - looking forward to it)
what is the best python library to make 3D stuff (beside OpenGL)
If I use ursina engine, can the game be exported to apk?
Ursina engine
Ursina is based on Panda3D which can be exported to apk and web, so maybe
there is also Harfang3D 3.2.3, which could probably run on android and web with some good will.
^^
type pip install pygame
i did
Amazing game
thx for the help but that wasnt the problem
i had to change this
Display.blit(Background, (0, i * Background_Width + Scroll))
into this
Display.blit(Background, (0, -i * Background_Width + Scroll))
so you can like use panda3D with python?
yes
thx
Hello, I am trying to create a text based Pokรฉmon project in python. I need some help coding it and adding ideas. I have programmed many versions of the game (PyBattle) but I want to remake it. Can anyone help me? Here is an example of the graphics: py __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_
Is it on GitHub? ๐
Does anyone know how to play a sound once inside a game loop - pygame
I'm using ursina engine.... I want to make the InputField scrollable
also how do I make it fully horizontal
it always says Something went really wrong, and we canโt process that file.
looks like a really cool game
it is but i want to remake it cause it is really buggy
i made a saving prototype that works really well
Nice how long did it take to program it?
lol
also it is how i learned so i am a lot faster and have a lot more knowledge
does anyone have any resources / articles concerning best practices validating (or maybe detecting cheating?) for javascript games -- or really, anything where the code execution is out of my hands. Validating user input is obvious to me at the scope of form input (e.g. is this value valid for this form field) -- but when "valid" is dependent on player skill I lose my bearings about where and how to trust. I'm not assuming there's a perfect solution, but I'd like to read about how other people solve that kind of problem
Hello, I am trying to create a text based Pokรฉmon project in python. I need some help coding it and adding ideas. I have programmed many versions of the game (PyBattle) but I want to remake it. Can anyone help me? Here is an example of the graphics: py __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_
can you print pixel art in the terminal?
no
i like the text graphics
no
i can animate them if i need to
want to see some code?
the game
Hey @hardy escarp!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Hello, I am trying to create a text based Pokรฉmon project in python. I need some help coding it and adding ideas. I have programmed many versions of the game (PyBattle) but I want to remake it. Can anyone help me? Here is an example of the graphics: py __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_
Please ask a more specific question. "Can anyone help me?" won't get you very far.
For example, which parts do you need help coding with? Break it up into sub-problems and ask questions about each of those.
yes on vt420 dec terminals with sixel support (xterm / mintty and others )
and there's actually an indirect pygame backend for that called xserver-SIXEL
I am not trying to get help with errors and stuff like that. I just want a friend to help me make remake the game.
Hello, I am trying to create a text based Pokรฉmon project in python. I need some help coding it and adding ideas. I have programmed many versions of the game (PyBattle) but I want to remake it. Can anyone help me? Here is an example of the graphics: py __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_
Is Vec3(X,Y,Z) ??
Do you have a Github repo for your project?

You can check the pygame documentation.
https://www.pygame.org/docs/ref/music.html
@light nest crosspost + flood
i want to help you make the game, dm me
<@&831776746206265384> ^
no
it has an error when I import my files
?
Please don't spam the same message everywhere.
what message
They were also posted in help channels
You can create a help channel, but you need to be patient. Spamming your message won't get you help any quicker.
You want someone to make an entire game for you?
the help channels close in 5 mins
no
i want some to help me create a game
i have already created it and i want ot remake it with new ideas
Well you may have a better chance attempting some of it first and updating the codebase on a place where people can collaborate, like GitHub ๐
when i try importing it it gives me an error
Alright, what error?
some thing went wrong we cant process that file
Sending the exact traceback would be useful
A screenshot might help.
hi guys can you help I am new here so if i posted in wrong room just tel me
import sys
import pygame
from settings import Settings
class Ship():
def init(self, screen):
self.screen = screen
# load image
self.image = pygame.image.load("images/ship.bmp")
#
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
self.rect.centerx = self.screen_rect.centerx
self.rect.bottom = self.screen_rect.bottom
def blitme(self):
self.screen.blite(self.image, self.rect)
def run_game():
pygame.init()
ai_settings = Settings()
screen = pygame.display.set_mode(
(ai_settings.screen_width, ai_settings.screen_height)
)
pygame.display.set_caption("Alien Invasion")
ship = Ship(screen)
# Starting the main loop for the game
while True:
# watch for keyboard and mouse events.
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
# Redraw the screen during
screen.fill(ai_settings.bg_color)
ship.blitme()
pygame.display.flip()
run_game()
this is my code and can you help me where is problem I can understand
I think it's blit, not blite
ah thnx
!e```py
class Ability:
def init(self, func):
self.func = func
def call(self,*args,**kw):
return self.func(*args,**kw)
def foo(name="me"):
print("Hello",name)
Abi = Ability(foo)
Abi()
Abi(", did you know you can do that instead :0")```
@hardy escarp :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hello me
002 | Hello , did you know you can do that instead :0
Hey, I allready did something similar https://github.com/lxgr-linux/pokete
nice
import keyboard
if keyboard.is_pressed("q"): # if key 'q' is pressed
print('You Pressed Q Key!')
Hi everyone, could anyone give me ideas about how to solve this issue?
That's awesome! I want to make a game like it but, but I'm still learning to code. Is a project like that a good one to take on?
Just run your command line as the administrator?
I mean its the way I learned proper python, so yes
Awesome do you mind helping me get started down the right path? And PS: I'm a Linux gamer as well so that might sweeten the pot lol.
Yes, of course, just dm me
@hardy escarp how it should work
i didnt know thats why i ran it
Guys Im making a game and i want to make a camera that follow my player how i do this
camera.parent = player
that's how to do it with ursina at least.
for nice smooth movement i do this instead:
def update():
camera.position = lerp(camera.position, player.position, time.dt*5)
How ?
So i need to make a def function and a make a variable and type this ?
Alright ?
what library are you using?
Pygame
oh
idk then
I think you have to move everything but the player in the opposite direction in order to make it look like there's a camera
Ok
Guys Im making a game and i want to make a camera that follow my player how i do this (pygame)
You just got the answer. You move everything except the player
When scrolling around you should only draw what is visible for the "camera"
Move all the individual things you draw by a global scroll x and y value
"Move" is probably misleading here. You simply redraw everything offset by the global scroll value
When you draw something you specify coordinates, right?
Every time you draw something you need to add the scroll values to those coordiantes
No i dont
There are many tutorials on this if you search around
Share some minimal code showing what you did.
Hey @dreamy wedge!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
You need to paste the link
I don't see anything related to offset or camera here
yes
i try but it doesn't work, so i delete it
i maked a world offset but it doesnt work
Hey @dreamy wedge!
It looks like you tried to attach file type(s) that we do not allow (.ttf). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
Hey @dreamy wedge!
It looks like you tried to attach file type(s) that we do not allow (.ttf). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
@potent ice
Try something simple to start with like ```
camera_pos = pygame.Vector2(playerx, playery)
screen.blit(bg, -camera_pos)
That should at least move the background
ok
There are many different ways you make a camera. Some people want player always centered. Others want more complex ones.
oh thxxx
If you want a simple camera you can move the camera position instead of the player
yes i know simple camera and complex camera
yeah and the complex camera ?
More complex cameras stop scrolling at the world borders. Some even have zoom.
It depends what you need
No problem ๐
so im tryna make a pygame project an exe using some python modules, but they all trigger a false-pos for the antivirus. any way to let someone play my game without having them download python or trigger their antivirus?
For me the same thing happened with auto-py-to-exe
I converted my game to exe using pyinstaller
pyinstaller -F --onefile PROJECT.PY
(I think thats exactly how i did it although im not 100% sure)
Windows still gives a unknown author pop up,
But with my game didn't get instantly removed like before by windows defender
kk
i used pyinstaller
but with diff commands
i think it was onefile and no cmd line or something
does anyone have xperience with OOP and blackjack? I am creating a blackjack game via OOP and needed some help
Here is a little of what I do.
๐ง Zombies ๐งโโ๏ธ
I do voice acting as well.
Mean Zombie Rip Ears
Play with vol down a little.
pythongame.exe4:22PM
nice
hi all. so i wanna make a rpg game. not with moves, map etc. almost all will be user interface. firstly i tried with tkinter but it was a bad idea. i also searched something in youtube how to work with gui in pygame but i found only how to make buttons. someone know good videos/tutorials so how to make labels, animations, then delete it and other things.. ?
cmon it almost has 69 kb๐ญ๐ข
Lol
I find that Tkinter is only good for text-based games...... by text I mean just text, no pictures. If you want something with a little more flexibility, you could use PySimpleGUI, but that will only get you so far. If you want to get crazy, you can make a GUI + game with the same module using Ursina's (the 3D game engine wrapper around Panda3D) pre-built text and button objects along with 3D or quad models.
this is not a meme channel
i found 1 cool module to work with gui in pygame
this module called pygame-gui
or pygame_gui
theres no difference
maybe
.
@dawn quiver check this if interesting : https://pygame-gui.readthedocs.io/en/latest/index.html
@potent ice ok sry for that
but it was just a gif
not meme
.
Yeah just keep it at a minimum here. It's generally frowned upon.
This is often the case on large servers. For smaller servers I don't think they care too much
it would be nice if it possible to allow gifs/stickers only for users with special roles. maybe.
oh that is very interesting
yeah๐
Guys how can i make a spritesheet player movement i tried but it failed
Some help
How can I check for collision with any other collider in ursina engine?
ball = Entity(model='sphere', collider='sphere')
wall = Entity(model='cube', collider='box')
def update():
if ball.intersects(wall):
print('hit wall')
It's recommended to specify what it can hit for performance reasons, but if you want it to be able to hit anything with a collider, you can omit the argument:
if ball.intersects():
print('hit something')
Hmm thanks
Okay can anybody tell me how can i create a simple shop sort of in ursina? Any simple idea I've an complicated one, that I don't want....
Just use buttons
inventory = Entity(gold=55, hamburgers=0)
def buy():
if inventory.gold < 10:
print("can't afford")
return
inventory.gold -= 10
inventory.hamburgers += 1
print('gold:', inventory.gold)
print('hamburgers:', inventory.hamburgers)
buy_button = Button(text='buy', scale=.3, on_click=buy)
if you need many options you can use a for loop and iterate through a list
I am trying to follow AtiByte's Youtube tutorial on the Blender Game Engine but at the point where he tries to add a component it doesn't work for me. When I go to GameComponents and try to add one it says "(Report: Invalid Input Error) no module named ""my_component"" or script error at loading". Any ideas?
import bge
from collections import OrderedDict
class Movement(bge.types.KX_PythonComponent):
args = OrderedDict([
("Move Speed", 0.2),
("Turn Speed", 0.4)
])
def (self, args):
self.move_speed = args ["Move Speed"]
self.move_speed = args ["Turn Speed"]
def update (self):
keyboard = bge.logic.keyboard
inputs = keyboard.inputs
move = 0
rotate = 0
if inputs[bge.events.WKEY].values[-1]:
move += self.move_speed
if inputs[bge.events.SKEY].values[-1]:
move -= self.move_speed
if inputs[bge.events.AKEY].values[-1]:
rotate += self.turn_speed
if inputs[bge.events.DKEY].values[-1]:
rotate -= self.turn_speed
self.object.applyMovement((0, move, 0), True)
Also here's the tutorial
https://www.youtube.com/watch?v=wSKDEMu2sE8
UPBGE game engine is the renewed Blender Game Engine, for short BGE. You can use logic bricks, logic nodes, python scripts and python components to add behaviors to your game. UPBGE supports the 3 main desktop platforms: Windows, Linux and MacOS.
Project files only available for patreon Supporters:
https://www.patreon.com/attila_toth
It's probably just me being stupid
bro this so lame
?
i want to try coding games with pygame, do you have anything to tell me before i start?
Don't waste your time
Guys how i make player animation in pygame
One thing I did, create a list of frames of the animation. Inside the game loop, keep track of the number of frames there are. Index the sprite list by the total frames mod the length of the list, then blit that to the screen. Feels a bit like reinventing the wheel, there's probably a better solution, but this should work
Well what I meant is how to create the UI, I already got the logic
heya so i made a snake game using ansi sequences that plays on the console
there is only one current issue
when the snake goes to the very bottom (it does not collide with the bottom, it moves next to it) the ansi sequences get messed up
any idea why?
and yes, i cleared the ansi sequences before doing \n
it still happens anyway
it might just be my side
hmm
because wins terminal does not render anything at all when i run the file
only vsc
!paste
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.pythondiscord.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.
win terminal as in cmd? or actual "windows terminal"?
actual wins terminal
like, the app you download from store
so far i have been running it in vsc
(ignore all the blinking of the screen, that's just it refreshing really fast)
i think i see why
one second
scratch that, hmm.. i'll keep looking
how do they get "messed up"?
@short tapir
gimme a sec @velvet summit
how it looks like for any other wise
side*
how it looks like when i go to bottom
if you find something, tell me
im gonna play fn till then
yea not quite sure sorry, i'll update if i do
anyone?
it's happening in all terminals
@velvet summit i fixed the issue, turns out it was with the END_STR var being added to the snake variable, which added new lines visually, but not ingame
hey. good to hear!
i've been distracted all day with Midjourney
where can I learn to code im abegginer
Rename your file to pygame-test.py
Every major one
is that gonna work
Yes
For python specifically tho?
Yes
Like i know unity uses c#
Not for this place
That would be in a unity, c# server or ot
Stuff like arcade, ursjna, pyga,e goes here
General code and syntaxes questions would usually go in general
@short tapir I meant for games that dont have python like syntax
Iโm asking whether the questions asked pertaining to these game engines are more about the code structure and computational thinking rather than syntax questions
Because it generally doesnโt do a lot to ask a question about a c# question in a python community
Or maybe Iโm wrong, idk for sure ๐
uh how
Everything related to the game dev is asked and sent here
Did you even try it?
nah aint working
oh wait
i think it worked
nah it doesnt
Hey @rancid gust!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Does anyone have any guide on how I can convert screen coordinates into world coordinates on an isometric world? I have been trying some stuff but it's very buggy and confusing.
'Smooth City Streaming' - with physics - :D [Blender 3d fork upbge + Geometry nodes]
split the update in 3 pieces for now
Hey all
been busy for a while
came back to say hi / drop this off
๐
realtime 100% procedural
using smol py to ochristrate when stuff updates
(triangle mesh physics)
Made a little snake game today ๐
https://github.com/xatero/snake-game
๐
You dont need anything more than snake
nice
[HIRING]
Just a gamer who's wanting to finally create/play a perfect FIGHTING game.
Looking for a modder who has knowledge of manipulating and understanding code.
Pay: Offering $65 for a small project that should only take a few hours to finish (first of many). We can negotiate.
Requirements:
- Decent communication skills. I can't read your mind.
- A freelance worker who wants to help. I'm not rich, so don't expect to get rich off me.
-Someone who isn't bothered by the MATURE rating on video games.
DM me for more details. Thanks.
!rule 6
!rule 9
heh, 69
A bit more polish on 'Smooth Streamer' - UPBGE fork of blender / Geometry nodes
music
Something Completely Different with Sine Lead -- Trap/Urban -- Royalty Free Music
๐
upbge fork of blender + geometry nodes + py
So how can I be approved? And sorry :l
you can dm @light nest to ask
It doesn't need to be payed work. People can do it for free as a favor if they want. lol
It's also no really advertising since I'm can't sell a modded game.
๐
Sup?
does anyone know any good websites to download sound effects from?
do u happen to know how to use downloaded sounds as a windows user?
nope i'm a linux / pygame-web (webassembly) user
i feel obliged to agree
lol
but i've heard people use audacity windows version to convert audio for their games maybe that can help you
maybe
winsound.PlaySound('sample.wav', winsound.SND_FILENAME|winsound.SND_NOWAIT) This is what i have to do to play a single sound!!!
windows in on something bro
use pygame maybe ?
it's as simple as ```py
pygame.mixer.music.load('music.ogg') pygame.mixer.music.set_volume(1.0)
pygame.mixer.music.play(-1)
or
sfx= pygame.mixer.Sound('sfx.ogg'); sfx.play()
i was thinking about that, i need my sound to play right when it hits a wall
it worked!!! LETS GOOO finally
My Pong game is now finished
cool
Awesome
Niceeeeeee
Nice
If Iโm making a game from scratch with multiple levels, would it be better to have an if statement and check which level to draw each frame (which I can see being slow) or have a game object array which I can just append and remove levels to draw each frame
tetris.
@short tapir ^
@hybrid badger just wanted to show you results of what you contributed to in the help channel today. ๐
the images used as puzzles are AI generated as a bonus
(not integrated with this app)
Niceness!
yo
why does my prime number hunter think that 4 is prime -.-
prime_list = []
def is_prime(num):
prime = True
for i in range(int(num/2)):
if i > 1:
if num % i == 0:
prime = False
return prime
for i in range(1,99):
if is_prime(i):
prime_list.append(i)
print(prime_list)
Nice.
Hi, anyone familiar with rectangle function in pygame?
Just ask your question
Looks neat!
ty๐ฉโ๐ค
i in range(4/2) is the same as i in range(2) which returns 0, 1 right? Both of these are being ignored by if i > 1
Hey all i am going through the clear code zelda tut here https://www.youtube.com/watch?v=QU1pPzEGrqw at 1hr 10 mins he uses lambda, can someone please explain what that does? I am not sure by the examples i am seeing on W3 schools
A Zelda-style RPG in Python that includes a lot of elements you need for a sophisticated game like graphics and animations, fake depth; upgrade mechanics, a level map and quite a bit more.
Thanks for AI camp for sponsoring this video. You can find the link to their summer camp here: https://ai-camp.org/partner/clearcode
If you want to suppor...
Lambda is dumb
!d lambda
An anonymous inline function consisting of a single expression which is evaluated when the function is called. The syntax to create a lambda function is lambda [parameters]: expression
for example
double = lambda integer: integer*2 # this returns the integer provided times 2
def double(integer):
return integer*2 # this does the same thing
print(double(4))```
@short tapir So I understand that usage but I guess it's more how he is implementing it in the tutorial, which may be a lot to ask. I'll take a look again. Thank you for the response.
so he is using it as a key to the sorted
which is being applied to a sprited group (pygame), i get the concept of sorting the elements (sprites) of sprite group and drawing them starting with highest sprite.centery as that will mean lower sprites get drawn over higher ones (ysorting) the concept makes sense just not sure why a key is needed and what lambda sprites does as thats not an expression this may not be the place to post as it has to do with python and pygame
anyone know how to make one of these for my software
sure
can you describe it a bit better
you just want to make the text to copy and paste?
i want the text to say vertical
not muffin.gen
that was automatic
sure
text = """
โโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโ โโโโโโ โโโ
โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโ โโโโโโโโโ โโโโโโโโ โโโ โโโโโโ โโโโโโโโโโโ
โโโโ โโโโโโโโโโ โโโโโโโโ โโโ โโโโโโ โโโโโโโโโโโ
โโโโโโโ โโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโโ
โโโโโ โโโโโโโโโโโ โโโ โโโ โโโ โโโโโโโโโโ โโโโโโโโโโโ
"""
print(text)
do you want colors?
@dawn quiver
text = """
\033[31mโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโ โโโโโโ โโโ
\033[31mโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
\033[31mโโโ โโโโโโโโโ โโโโโโโโ โโโ โโโโโโ โโโโโโโโโโโ
\033[34mโโโโ โโโโโโโโโโ โโโโโโโโ โโโ โโโโโโ โโโโโโโโโโโ
\033[34m โโโโโโโ โโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโโ
\033[34m โโโโโ โโโโโโโโโโโ โโโ โโโ โโโ โโโโโโโโโโ โโโโโโโโโโโ
\033[0m
"""
print(text)```
tysm
np
Its a ''terminal'' game right?
Vetrical and Horizon... wow.
it was him who asked
Ok
my snake game is finally done
i dont think this shows the audio though
i made all of the images used myself
in photshop
!u
You are not allowed to use that command here. Please use the #bot-commands channel instead.
!server
is there a problem with it?
yes
a small memory puzzle game i made with tkinter
that looks super fun
now days games are only for high end pc
they mainly focus on graphics
they got realiestic graphics but at what cost
Congrats Bro
hi im using pygame and i have an issue. im im drawing an image over a rectangle and get the proximity of the mouse to the rectangle but its not accurate since its responding to the top left of the rectangle
is there any way to consider the height and width of the rectangles as top,bottom,left and right?
Looks sick!
That's a really cool snake game!
I want to detect collision between non-AABB objects
How do I do that
I've heard of Separating Axis Theorem, but don't really understand how it works
Anyone know why this is not moving the rectangle?
import pygame
successes, failures = pygame.init()
print("{0} successes and {1} failures".format(successes, failures))
screen = pygame.display.set_mode((720, 480))
clock = pygame.time.Clock()
FPS = 60 # Frames per second.
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
rect = pygame.Rect((0, 0), (32, 32))
image = pygame.Surface((32, 32))
image .fill(WHITE)
while True:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
rect.move_ip(0, -1)
elif event.key == pygame.K_s:
rect.move_ip(0, 1)
elif event.key == pygame.K_a:
rect.move_ip(-1, 0)
elif event.key == pygame.K_d:
rect.move_ip(1, 0)
screen.fill(BLACK)
screen.blit(image, rect)
print(rect.x, rect.y)
pygame.display.update()
it's moving for me, and btw the quit test should be the last of elif chain for performance reason
lmao y'all using guis
the terminal provides all
The most pythonic game: snake.
only it's in 4 dimensions https://paste.pythondiscord.com/piziwepina.py
wasd within grid, arrow keys to move through grid
speed is slow cos it's hard
larger board example
.bm 4d snake
Why would you do that
What was acheived
God save us from the end times
I ascended to a higher plane of existence and back writing this code and I'm still trying to comprehend the walls
https://paste.pythondiscord.com/copinaxixi here's the 2D version
I also made minesweeper
yas 303 seconds solve
which version of unity should i use guy?
None.
Python is better.
How can I make a game using python
Read documentation, id recommend starting at pygame
what's a good python library for 2D platformers?
Pygame is your go to for 2d games i would say
I've made a couple platformers with pygame
Here are some of my proud ones,
The first video is not just me though, it is the equal effort of 3 developers ๐ช
wow thats nice
It gets pretty easy once you have some basic concepts down!
always wanted to make something like a strategy game, like a hoi4, but with simpler graphics of course
For example, the first one there was made in 7 days for the pygame community game jam
Strategy games seem like a fun choice to develop, GL!
thx
SHEEEEEEEEEESH
idk when I'll be like you
DAMMMMMMMMMMM
me trying to do fancy move
also me: presses right-arrow instead of d
what are classs
In Python? Well, in Python everything is an object, so creating types and instances are a pointless thing to try and avoid
Though, just because you use classes doesn't mean you use OOP
Classes in Python are versatile enough to support ECS, OOP(inheritance) and many other kinds of paradigms and design patterns
i mean if my code runs fine without classes why should i use them
is it more efficient?
maybe faster?
hello, please what are classes
A blueprint to create instances
!e
class Foo:
pass
foo = Foo()
print(foo)
@dawn quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
<__main__.Foo object at 0x7f1815adb1d0>
foo is an instance and Foo is a class
If it is flexible and fast enough for your needs, then I see no problem with not using classes and continuing as it is for you
thanks helps a lot
There is no need for you to define any types yourself
Heres a detailed video on it to get a better understanding
https://realpython.com/lessons/classes-python/
An alternative to using dictionaries to store data and functions to manipulate it, but you can also program how an instance of a class behaves under different syntax situations, like a + b is decided by a.__pos__(b)
thanks, am so so so greatful๐
this example doesnt have to do with game dev but if lets say i have a sql database which has data on students (marks, subjects, etc..) and I want to retrieve certain records and perform various calculations, concatenations and functions, would making a class and instances improve my code in any way? instead of just using my functions and returning the values
It would ideally make it more readable, and possibly more efficient depending on the alternative
It mostly helps grasp the concepts of your code.
For example when making a database that records data about people, you might make a Person instance so you know to expect certain attributes.
But technically you don't need it you can just make a structure out of dictionaries for the same effect. The syntax might suffer though.
anything that works, works; classes are just the ideal way to make an object-oriented script
Sorry about my bad explanation I'm just trying to code with 4 dimensional objects at the moment
But in game development, objects are useful to represent in-game items like the window, the background, various sprites, etc.
thanks for the explanation it all makes sense. ๐
It does?
I'll give an example of how I have recently used classes.
Attached image is a ss of me playing 4D Snake.
I used a class for a cell (one small square), Cell to simply contain engine-coordinates and the state of the cell at that coordinate
I used a class Engine to contain it's own matrix of Cells and carry methods to manipulate the states of those cells for each action.
I used a class Interface to detect keyboard data and show the state of an internally initialised Engine() instance when it updates, and to run an event loop when called until a halting state is raised from the engine
It looks weird because 4D space doesn't really fit on a 2D screen, but that's beside the point.
use of classes like this still seems unclear to me but i do understand it makes code cleaner, ill look up a few tutorials and explanations later
oh also
i have a question regarding a game im making, i have a few if statements that detect if a value is 0 or not, and i control this value by adding or subtracting a certain constant, 3 for example, and when this value reaches 2 it goes into an infinite loop of increasing and decreasing, how can i fix this?
detect if in a range?
something like if value in range(2): break
idk I would need to see the context to know why it isn't behaving as expected
so im increasing or decreasing the radius of a circle by a 10, first i set a target radius (radius+10) and add 3 to the radius every loop until it reaches target for smooth animation, and as u might expect it will never reach target like this because it can get as close as 9 but never 10
i can fix this by increasing target by multiples of the constant, but i want a solution without this
try capturing a range instead of using direct equality
yeah i fixed this by getting it to subtract/add by 1 when it reaches a tight range above and below the target
thanks
๐โ In this tutorial, we will see how to import a GLTF scene, and display it in a python program:
-Download HARFANG3D resources
-Import a GLTF scene
-Customize scene from Python
-Move the camera
๐ Harfang core, to download shaders
https://github.com/harfang3d/harfang-core-package
๐ Tutorial resources:
https://github.com/harfang3d/video_tutoria...
what will i do when my shell window says actor in a tuple is undifinrd
Does anyone know how complicated it would be to code a dating/chatting sim?
Lets say you are calling a function with the arguments x y and z. And you find yourself calling other functions that also have x y and z as arguments. So you are constantly passing around x y and z together. It makes sense to make a class out of them because they are tied together / often come together.
Which reduces your code size, and prevents mistakes in which you maybe don't pass x y and z together correctly.
If those functions that you were passing x, y and z into are all manipulating x y and z in some way / making use of, you can make those functions methods of the class.
Now if you decide that those functions/methods want not only x y and z, but all/some of them also want w, you can just add w to the class and now all of them have access to w. Without the class, you would have to go edit each function's signature to take w, and now also pass in w at each call site. So the point of classes is organization and dealing with larger projects at scale, reducing complexity, work, and mistakes.
Wow, coding is complex
Hi :)
So
I want to make a private brawl stars server
I'm a modder
But I don't know how to make one๐ฝ
Can someone explain some basic things to me
ok thx
this is the clearest explanation so far, thank you so much mate
makes more sense now
The last part about being able to edit what is in the class and that now being automatically in all those methods for use is one huge part of it. Especially in game dev where your idea of what you wanted / need access to in those functions constantly changes.
It may help to replace the word "class" with "record".
A record is some group of heterogeneous data (e.g. an int, string, other record).
Clustered together so that it can passed around together.
the other day I made a death note program on my school pc
Nice, I find it so hard to program while in school because of how crappy and administrative the computers are
mine had 4gb ram and no graphic card lol
but it did the job, there wasn't much to compile anyway, the program code was hardly a few hundred lines long
lol wow
Anyone in Georgia?
country or state?
state
perhaps... why?
i have no friends that know how to code๐ญ
im kinda on my own path with learning and I need some guidance
learn some of the basics and then make a simple project that you enjoy
learn some more, rinse and repeat
google is your best friend, dont be afriand to fail. Always have a goal in mind before coding and make sure to plan stuff out
think ahead, its better to waste one day realizing something is dumb than to waste a month doing that dumb thing
surround yourself with more experianced programmers and always look for ways to get feedback on code
dont be afraid of critisicm and try your best
^^^^^^^^^^^^^^^those are the best tips i can give a beginner
Is it possible to grab an item from a class without knowing that the item will be beforehand?
Example:
class items:
IronSword = "An iron sword"
IronOre = "Chunk of raw iron"
#player picks one
c = IronSword
print(items.c)
But oh, c isn't an object in items, so this won't work
This looks like Minecraftโฆ..
Example:
class items:
Pot = "A pot"
DaedricHelmet = "Scary helmet go brrr"
#player picks one
c = DaedricHelmet
print(items.c)
@ancient jetty You were saying?
There was muffins the cat. Then python ate cat
Make sense
Yes, you can use getattr
!e
class Foo:
SWORD = "test"
player_input = "SWORD"
print(getattr(Foo, player_input))
@dawn quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
test
Or Foo.__dict__[player_input]
Thanks. Iโll try this tomorrow when Iโm not in my bed watching youtube instead of sleeping
No I donโt have a problem
Please how do you use the 'Actor' method in pygame 1.2.1
i was searching for information for that method, and found only in pygame zero documentation.
here it is:
Thanks a lot but i needed pygame 1.2.1
Please how do you use the 'Actor' method in pygame 1.2.1
Isn't that a really old version?
Doesn't seem like pygame 1.2.1 ever existed
i guess so
That's sick!
Just finished a game i call Space battle! https://github.com/Asublime01/Space-Battle
Hey
Guys like how can i turn a code into an app am still confused about that any help ?
Am new btw
Hey, can someone show me a quick example of how you would create a player class and then store the data into a database?
I'm using MongoDB, and I want to make sure I'm doing things efficiently
Do you know the answer of my question ? ๐ฃ๐ฉ
It's an extremely broad question
Sorry
I may not live in Georgia but im currently learning alone rn and i think it would be fun to have a like minded friend who enjoys programming as a hobby
are there other modules i can use for game development instead of pygame and turtle?
#improve user experience
import random
import hangman_words
import hangman_art
from hangman_words import word_list
print(hangman_art.logo)
chosen_word = (random.choice(word_list))
print(f"Woo, solution is {chosen_word}")
display = []
for underscores in chosen_word:
display.append("_")
print(' '.join(display))
lives = 6
def hangman():
global lives
guess = input("Guess a letter: ").lower()
if guess in display:
print(f"You already guessed '{guess}'")
for n in range(len(chosen_word)):
if chosen_word[n] == guess:
display[n] = chosen_word[n]
if not guess in chosen_word:
lives -= 1
print(f"You guessed '{guess}', that's not in the word. {lives} lives left.")
print(hangman_art.stages[lives])
print(' '.join(display))
while '_' in display and not lives == 0:
hangman()
if lives == 0:
print("You lose.")
elif not '_' in display:
print("You win!")
Made Hangman few days ago, modified it today.
Kinda feeling good since I did everything on my own and my code is shorter and I guess more readable than the solution (of the course I'm follwoing).
you are missing "start sound.wav" in repo and the Assets folder
Please I am new here
Is it possible to create a 3D game with pyGame?
@young hedge it might be, but probably very hard. you might just use unity for that since it takes care of that (with pygame)
Ok thanks @flat onyx
you can use ursina if you want
just pip install ursina
itโs like this 3d game thing
ok
oh thats not good, thanks for letting me know
All fixed
are you sure ? i don't see the Assets folder after pull
it should be the one that contains spaceship_yellow.png spaceship_red.png
I'm working on a renderer for working with pygame to create a top-down style game with basic 2D sprites. I'm wondering how I should design the renderer class. I'm thinking that it should take in the difference between the state of the screen at timestep t-1 and timestep t, and only draw the differences in the screen between those two steps
I'm not sure if that'll work or if I'm oversimplifying.
yea sry about that xd, nowww it should be fixed: https://github.com/Asublime01/Space-Battle
where can i get this game
I was gonna show my mini game here, but when i see the other ones i dont think i should......
Lol
Hello! You can try the first one here: https://sss-says-snek.itch.io/daves-anniversary
And the second?
small note : that game and alien dimension from quantum have the same problem. the less powerfull is the machine running the lower the player can jump. Hard to notice when running native but easy to reveal on web
i have just a quick question. Is there another "similar" python library thats like pygame?
You ran it on the web?
yep
It wasnt designed to run there, but thanks for notifying
Probably never noticed because of everyone running it locally
hello, for some reason i'm getting an error trying to import pygame in my program but when i do pip install pygame it says it's already downloaded
ModuleNotFoundError: No module named 'pygame' This is the error i get
do python -m pip install pygame
!dashmpip
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
i removed python, i'm going to reinstall it
i reinstalled python but now it can't use pip
can someone help
nvm, i got it to work
You saw this from Tech with Tim, right?
Hello, can someone teach me about pygame? And yes, i know there are online tutoruals, but i never understand them
Anyone still struggling with how my 4D projection works, the highlighted space in the following example is a 3D cube. If you were a 3D observer in this area, then if you look down, there is food on the floor touching a wall, if you look up, you see a small blob of snake, followed by a twisted section of snake, and touching a wall higher up is another small blob of snake.
The extra dimension is also space, but not accessible by our imaginary 3D observer. The entire board is a hypercube
you can temporarily reconstruct a 3D space in your mind by imagining all the panels rotating in the desired hyperdirection to show panels stacked on top of each other. Change direction of panel rotation in your imagination to "look" in a different direction.
im pretty sure people have made other libraries like pygame and better before
yessir, i just tried a little bit to make it my own
import pygame as pg
def main():
screen = pg.display.set_mode((640, 480))
font = pg.font.Font(None, 32)
clock = pg.time.Clock()
input_box = pg.Rect(100, 100, 140, 32)
color_inactive = pg.Color('lightskyblue3')
color_active = pg.Color('dodgerblue2')
color = color_inactive
active = False
text = ''
done = False
while not done:
for event in pg.event.get():
if event.type == pg.QUIT:
done = True
if event.type == pg.MOUSEBUTTONDOWN:
# If the user clicked on the input_box rect.
if input_box.collidepoint(event.pos):
# Toggle the active variable.
active = not active
else:
active = False
# Change the current color of the input box.
color = color_active if active else color_inactive
if event.type == pg.KEYDOWN:
if active:
if event.key == pg.K_RETURN:
print(text)
text = ''
elif event.key == pg.K_BACKSPACE:
text = text[:-1]
else:
text += event.unicode
screen.fill((30, 30, 30))
# Render the current text.
txt_surface = font.render(text, True, color)
# Resize the box if the text is too long.
width = max(200, txt_surface.get_width()+10)
input_box.w = width
# Blit the text.
screen.blit(txt_surface, (input_box.x+5, input_box.y+5))
# Blit the input_box rect.
pg.draw.rect(screen, color, input_box, 2)
pg.display.flip()
clock.tick(30)
if __name__ == '__main__':
pg.init()
main()
pg.quit()
import random
andom_number = random.randint(1,1000)
try_counter = 0
while try_counter < 11:
guess = int(input('geuss a number between 1 and 1000: \n'))
if type(guess) != int:
print('enter a number')
elif guess not in range(1,1000):
print('thats not a valid number')
elif try_counter == 10:
print('you lost')
print('the number was:' + str(random_number))
elif guess > random_number:
print('try lower')
elif guess < random_number:
print('try higher')
elif guess == random_number:
print('nice, you did it')
break
else:
pass
if guess in range(1,1000):
try_counter += 1
x = input('prestt enter to close')
so, how to fuse those 2 together?
because i have a huge error
has anyone compiled a pygame with tensorflow lite to keep the size of the built code under 50 mb?
it requires compiling tensorflow lite first then using it in the pygame that's then compiled (i'm using cx_freeze). there are no pre-built packages to use.
is there any way for me to write text inside the pygame window ?
for example i have it opened and there is a way for me to write text and save the text somewhere lets say
https://github.com/aydensbadger/SnakeGame i made my snake game open source
the controls are kind of stiff sometimes and when you click the back button after dieing you occasionly accedentily click medium which starts a new game right away
the rules and ai button dont work and im pretty sure i accedentily set my highscore as the starting highscore
but besides that the game is complete
it took like 2 months and was super fun
also mind my english cause im not from america
im from canada
Hello
ok so i am building a turn based rpg game and for some reason i want to badly implement the agility stat ;-; but idk how i can use it effectively in the battles do yall have any suggestions? ๐ i have already decided to use it for deciding who is going to attack first
damn thats amazing, well for a begginer like me lol, how long did it take u to learn how to do that
Maybe dodge chance? That's always fun
o but how i am going to do it
like if player 1's level is higher than player 2 the dodge chances are smaller for player 2 or some stuff?
beginner.... ive been coding for nearly 2 years
tips: youtube
this took 2 months to make
i mean in the eyes of one - me, dont take offence lel ๐
Ok.
Call of duty using mobile as a wireless controller - https://github.com/YashIndane/Call-of-Duty-
Turn your phone into a wireless controller for shooting games, with voice control! - GitHub - YashIndane/Call-of-Duty-: Turn your phone into a wireless controller for shooting games, with voice con...
If you change some dimension widths to 1, you can play lower dimensions of snake, so it encompasses 2D, 3D and 4D snakes
and there is a game win feature
so along time ago i made a snake game and it worked today i decided to try to make an ai to play it .
so i make an exact copy of the game. i changed some things so it can work with the ai. notice i didn't touch the collision detection and ow it gives me this message
i know what it means but in the exact same code on my old version of the game just works
OK i fount my mistake
The pinned messages have some resources for the different libraries. Also, I imagine the pygame website has a few suggestions.
when i first started i really just watched tutorials of people making games using pygame and after a few i started to understand the concept
This afternoon itโs quiet at the office so we setup a cockpit to test the VR mode of the Dogfight
This simple flight simulator is implemented in Python (see https://github.com/harfang3d/dogfight-sandbox-hg2)
Even though people wouldnโt believe it ๐
Neural link?
Your mentality wonโt let you. You can do anything you want but not when you say things like that. Even if your joking it affects deeply
Arenโt games best developed in c/c++
I saw you had physics and etc, Iโve did a little of game developing on unity and I just had to apply a little c++ script
the simulator is written in Python but the 3D engine, VR and physics are in C++ ๐
besides, doing this in python has a lot of advantages
- the simulator is TRUELY open source (and not a "semi open source" project based on a proprietary engine)
- Python can natively interconnect with AI and maths libs (numpy, pytorch, tensor flow...)
- we can do all the project outside of a proprietary IDE (VSCode, Pycharm) ... you don't need to start Unity to run this program ๐ or even to develop it ๐
so yeah, I agree, Unity is cool
but Python is just another way that seems as acceptable to me ๐
Hi people, new to this channel.
For learning i want to recreate a board game which i play with the kids (ticker to ride junior)
I want to practise OOP and wandering on some issues:
- there are 22 stations (list of 22 objects Station)
- there a 2 decks of cards (routes = several sections to go for first station to second stations. At least 2 sections).
I'm wandering about this:
Between a station and other adjecent station there is a "section"; total 45 section.
How would you handle this in OOP?
On paper i created a 2D matrix with all connections. 45 in total, 90 if you count both ways.
Would i make a section a seperate object with a "start" and "finish" station in it? and a mark if the section is completed by a player (sometimes a section can be filled in 2 seperate options; so P1 can claim the section and also P2 can claim the section
furthemore i don't know if i should store the sections within the stations list. (Like London has 5 sections associated with). Don't want to store them duplicate. (London - Dublin and Dublin - London). Cause in the end i need to check if a route is completed between stations.
suggestions welcome!
(PS second deck of cards is full of color cards + jokers; missed this at line 6 of previous comment)
Hey, I'm not sure if this is allowed but I have a game dev related question currently in Help Pancakes. It's rather complicated so I just wanted to throw it out into here. If there are any experts I'd much appreciate if someone could check it out.
cool, this seems like a good start for the next google ceo ๐
In this day and age when internet bandwidth can be largely considered irrelevant, is there a reason to favour binary serialisation over other methods of serialising like JSON or whatnot? I thought with most games being server-authoritative (through various means) using plaintext methods would not affect anything?
For context: I'm doing some packet analysis for a gacha game (which by TOS is perfectly fine (https://arterygear.biligames.com/termofservice/), and I'm just trying to write a gear dumper for management) and was curious why
Another example for this is LiveOverflow's series on packet analysis for Pwny Adventure. All packets sent between client and server are serialised to binary. Is this security by obscurity, a way to avoid extra dependency and/or overhead, or something else?
im making a neural network for the snake game right now
thats what were aiming for๐
๐๐ฝ
Let me know how it goes
is that made in python?
Yeah, with a wrapper for SDL2
not sure what that means but that's impressive that you made that in python
Im trying to use PyOpenGL.GLES3 for a 3D environment but whenever i import it this happens....
AttributeError: 'Win32Platform' object has no attribute 'GLES2'
Pip install
I know modern game studios generally develop in engines with an abstracted graphics API, with low-level graphics implementations for several different platforms so that the platform can be chosen before exporting.
How do game devs using engines without a pre-existing abstracted graphics API convert a project from, say, DirectX to Metal?
how can i make my snake game look like this:
like the lines not touching
cause right now it looks like this
when the snake is touching its body it is stuck together as opposed to having little spaces in between
how can i add the little spaces?
it looks like the green snake game has separate textures for a pair of segments when they connect from left to right and when they connect from top to bottom
and I imagine one would include some exceptions to that like when there's just one block (although you could just start off with two, I think that's how it works in the original actually)
but that would seem to solve the issue, tracking pairs of segments in the game model and displaying a texture based on the direction
how can you tell if the snake is conected by actually being connected or just by being right next to it
also how can would i be able to do the corners
i realtively understand how to do it for two lines parralel to eachother
but the same logic doesnt work for the corners
it should be fine if you can just overlay the textures
if you can't, then you need textures for every type of "single block"
so a bottom-left facing corner, bottom-right facing corner, etc
how can you even tell if a corner if a bottem-left facing corner
I assume you have a model for your game in some sort of class right
yes
so I guess checking each segment of the snake in that would tell you, by checking the connected neighbors
idk the specifics of your class for the snake's abstract model but maybe that helps
so basically ```
if connectedneigbor is rightofblock and direction is up:
draw bottemleftfacingcornerblock
pardon my psdudocode
but soemthing like that ^^^
yeah!! I think so at least
so many possibilies to loop over
I think there are just 6 types of textures (4 corners + left-right + up-down) in the end lol so it would be 6 combos overall
maybe a pain to look at but won't be too bad, u got it gigachad
thanks bb๐
lmao
hi guys. I have made a videogame with python called "turtle racer". Pls could you tell me where can I upload it?
hello, i have a question, i don't know if this is the right channel to ask but im going to ask any ways, so im made a game with pygame and now i want to make it exe with pyinstaller, and i keep getting this error when i run the exe file that pyinstaller gives me
but there is nothing wrong with line 73
do you know how to fix that?
show code
ok
Hey @celest breach!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Hey @celest breach!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
you can spam prints like print(1) print('foo') print('+') and find where your code crashed
than what do i do when i found it
- how could that help when the whole code works(in pycharm)
not every code that works can work inside pyinstaller
oh than shouldn't the line it crashes be line 73?
No?
They just changed their code after compilation most likely
you are probably right :)
Hello, my code is now like this:
mouse_x = -pygame.mouse.get_pos()[0]
#Player control takes (move x, move y, x position of mouse cursor)
player.control(0,0,mouse_x)
keys = pygame.key.get_pressed()
if keys[pygame.K_w]:
player.control(2*math.cos(mouse_x), 2*math.sin(mouse_x), mouse_x)
But when controlling the actual sprite wabbles and it does not go in the same direction in which I rotate it. Is anything strange in the code? I would like to use math formulas. (Not actual vectors in Pygame).
Thanks.
Taking suggestions on what to add to my Chernobyl based game
radition meter so that the longer your there the radition goes up and when it reachs 100% you die
Ok
good idea?
cool
You could make like a race against the clock and
Making its own moding code :| rn so I don't have to edit the source everytime
Made 'makeglobal(test, nice, hello)'
I don't feel like making it able to import other python scripts
hey so im not sure where to go but i dont know any coding and id like to learn how to code for game development, personally i have a super short attention spam but i really would like to learn how to, im not sure how to familiarize myself with coding in a way thats more streamline
(what i do know is from my 7,8 grade classes when we did c++
Search up pygame for beginners on YouTube great tutorials
guys
has anyone experienced panda3d
?
In case, do you know how to increase the quality of the textures and smoothen polygons instead of that bad quality
Hello
If you plan on using python and presumably a game framework/library that you can use with it, you need to familiarize yourself with python itself first
Understanding the libraries and frameworks becomes way more doable
How do I create grids like this?
best way is using a image like this.You can also creat with pygame.draw.rect()
Ok i use pygame.draw.rect
but the rects of this image has gray grids so you should make rectangles by using pygame.draw.line() but i do not recommend
ok thx
What is the input for left enter
in pygame>
*I mean just enter
What is the input for enter
K_KP_ENTER
I think
53,142
299,713