#game-development

1 messages ยท Page 1 of 1 (latest)

warped widget
#

pygame.init()

river flint
#

hi

austere kraken
#

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

dawn quiver
austere kraken
#

They all took the time to point out errors in my code and provided solutions, just felt like I had wasted their time

dawn quiver
river flint
#

hi

scenic shoal
#

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

river flint
#

HELLO

#

wait if you made a collisoin

#

doesnt that mean that its a boundry on that side?

river flint
#

guys what does this picture mean

#

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)

#

i dont understand

frank fieldBOT
sour venture
#

๐—ต๐—ฒ๐˜† ๐—ด๐˜‚๐˜†๐˜€ ๐—ฑ๐—ผ๐—ฒ๐˜€ ๐—ฎ๐—ป๐˜†๐—ผ๐—ป๐—ฒ ๐—ธ๐—ป๐—ผ๐˜„๐˜€.....๐˜„๐—ต๐—ถ๐—ฐ๐—ต ๐—ฎ๐—ฑ๐˜€ ๐—ป๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ ๐—ฝ๐—ฎ๐˜†๐˜€ ๐—ต๐—ถ๐—ด๐—ต๐—ฒ๐˜€๐˜ ๐—ฒ๐—–๐—ฃ๐—  ๐—ณ๐—ผ๐—ฟ ๐—ฝ๐—น๐—ฎ๐—ฐ๐—ถ๐—ป๐—ด ๐—ฟ๐—ฒ๐˜„๐—ฎ๐—ฟ๐—ฑ๐—ฒ๐—ฑ ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ผ ๐—ฎ๐—ฑ๐˜€.....

river cargo
#

2048 game in python

#

is there a better way?

deep dome
#

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?

hearty quartz
#

also mac uses a different file system

deep dome
#

Ah I see, is there any way I could make it Windows executable?

river flint
#

Salutations! I was wondering what does the ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108) errror mean?

hardy escarp
#

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.

wooden summit
#

keyboard?

worn moat
river flint
#

Nice vid bro

hardy escarp
#

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
hardy escarp
# wooden summit `keyboard`?

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.

lunar venture
river flint
#

line 28, in <module>
start_button = Button(100, 200, start_img)
TypeError: Button() takes no arguments

#

what does this mean

karmic crescent
river flint
#

ohh ok

#

thanks

#

also how do oyu open a window

#

from pgyame o

karmic crescent
#
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?
river flint
#

yea sure

#

also go into DMS

#

i can ask u questions more directly from there

scenic shoal
#

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 .

tranquil girder
#

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.

scenic shoal
dawn quiver
#

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?

potent ice
#

1000 = 1 second

dawn quiver
dawn quiver
#

@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

rain dome
#

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))
hardy escarp
#

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.

rain dome
rain dome
shut onyx
#

sup?

rain dome
shut onyx
#

that's discord being paranoid about the .py extension

#

it just takes you to a pastebin with their code

rain dome
hybrid burrow
hardy escarp
#

Thanks for giving me support

cerulean nimbus
#

anyone that can guess what im creating๐Ÿ‘€

dawn quiver
cerulean nimbus
#

jup

#

i struggled 3 hours to get that XD

dawn quiver
#

xD

sage dragon
#

Hello, someone tell me how I put resources to my game as images and sounds?

rain dome
#

How do you disable/enable a def function?

rain dome
#

Neverminds

drowsy shoal
#

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

woeful island
#

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

dawn quiver
#

I'd recommend being confident with your language fundamentals first

woeful island
#

i think i amโ€ฆ

#

do you have any more tips

dawn quiver
#

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

ivory raven
#

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

woeful island
#

oh ok

ivory raven
#

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

fair cape
#

there's a Zelda-like tutorial on youtube

#

it's crazy long though (7 hours)

flint current
#

yeah trying to learn patterns or algorithms from guides is good but you should also try to use them and create your own games

ivory raven
#

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

remote timber
woeful island
#

ah ok

woeful island
drowsy shoal
#

does anyone know how to do multiplayer in ursina

#

please

vagrant saddle
drowsy shoal
#

what

drowsy shoal
#

is there a tutorial on how to do that

vagrant saddle
#

nope most of game lib networking are written in C or C++

drowsy shoal
#

oh

vagrant saddle
#

you may find some documentation in their bindings

drowsy shoal
#

is there one that I can use with ursina

#

?

vagrant saddle
#

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

gentle falcon
#

Hey Can someone point me to the correct channel where I can ask my queries related to image processing and Computer Vision Stuffs?

junior tangle
#

Wassup, i think Ursina engine has finally made a macOS port, any1 tried?

tranquil girder
#

it has always worked on mac

potent ice
#

I can confirm

junior tangle
#

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...

โ–ถ Play video
tranquil girder
#

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

junior tangle
#

Well, thx for info, clear code got me messed up

rain dome
junior tangle
tranquil girder
#

yes

half epoch
#

I tried to make a 2d game with pygame

It didnt work well

ivory raven
#

like

#

how didnt it work?

#

pygame itself works fine for me

rain dome
junior tangle
subtle coral
wicked raptor
#

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?

junior tangle
wicked raptor
junior tangle
#

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 ...

โ–ถ Play video
junior tangle
#

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)

wicked raptor
#

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

wicked raptor
junior tangle
#

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

wicked raptor
brittle grove
#

hi

#

im having an issue

#

im trying to do a scrolling background

#

but

#

for some reason its scrolling the wrong way

frank fieldBOT
brittle grove
#

here are the files

frank fieldBOT
brittle grove
#

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

feral turret
#

What type of game you're making?

brittle grove
#

this was the original game

#

now i want to make it with cars

feral turret
#

OOO

#

Cool

brittle grove
#

every time u answer correctly the car goes faster

feral turret
#

You did the Art?

brittle grove
#

the bg u mean?

feral turret
#

Good Context

#

Yes

brittle grove
#

no

feral turret
#

Ok

#

Good Luck

brittle grove
#

so u cant help me?

#

these r the pictures

#

the code

flint current
#

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

(?)

sterile iris
#

how is not known when i downloaded pygame?

junior tangle
#

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)

slow rose
#

what is the best python library to make 3D stuff (beside OpenGL)

raw shadow
#

If I use ursina engine, can the game be exported to apk?

vagrant saddle
vagrant saddle
sterile iris
quasi patrol
sterile iris
#

i did

brittle grove
#

i had to change this
Display.blit(Background, (0, i * Background_Width + Scroll))
into this
Display.blit(Background, (0, -i * Background_Width + Scroll))

junior tangle
#

pretty simple but im working on it

slow rose
tranquil girder
#

yes

slow rose
hardy escarp
#

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 __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_

storm spade
#

Is it on GitHub? ๐Ÿ™‚

manic cloud
#

Does anyone know how to play a sound once inside a game loop - pygame

opaque palm
#

I'm using ursina engine.... I want to make the InputField scrollable

#

also how do I make it fully horizontal

hardy escarp
#

it always says Something went really wrong, and we canโ€™t process that file.

hardy escarp
#

it is but i want to remake it cause it is really buggy

#

i made a saving prototype that works really well

shut tangle
#

Nice how long did it take to program it?

hardy escarp
#

it took 2 years

#

i made like 50 verisons

shut tangle
#

lol

hardy escarp
#

also it is how i learned so i am a lot faster and have a lot more knowledge

visual zinc
#

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

hardy escarp
#

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 __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_

hardy escarp
#

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

frank fieldBOT
hardy escarp
#

one sec

hardy escarp
#

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 __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_

normal silo
#

For example, which parts do you need help coding with? Break it up into sub-problems and ask questions about each of those.

vagrant saddle
#

and there's actually an indirect pygame backend for that called xserver-SIXEL

hardy escarp
hardy escarp
#

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 __/\ _-----_ / , \____ / \ \_____ \| / | _|____/ ____ \ | / | |___/ \ \ |_/ \_/ ___| | / /____\_____// _ _ ( \ / ) \ \/ / |, , \ | \ / \ | \ / \ _\/_ \ / / __\_ __\___/ _---_ << , \_____ \ / \__ | \________/=====- \________/ __|_

rain dome
#

Is Vec3(X,Y,Z) ??

fossil kayak
rugged juniper
dawn quiver
hardy escarp
#

it has an error when I import my files

hardy escarp
paper zenith
#

?

#

oh, I see.

paper zenith
hardy escarp
#

what message

dawn quiver
#

They were also posted in help channels

hardy escarp
#

oh

#

sorry

#

i just want someone to help me

paper zenith
#

You can create a help channel, but you need to be patient. Spamming your message won't get you help any quicker.

dawn quiver
hardy escarp
#

the help channels close in 5 mins

hardy escarp
#

i want some to help me create a game

#

i have already created it and i want ot remake it with new ideas

dawn quiver
#

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 ๐Ÿ™‚

hardy escarp
#

when i try importing it it gives me an error

dawn quiver
#

Alright, what error?

hardy escarp
#

some thing went wrong we cant process that file

dawn quiver
#

Sending the exact traceback would be useful

hardy escarp
#

ok

#

thats all it says

fossil kayak
jagged goblet
#

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

tranquil girder
#

I think it's blit, not blite

jagged goblet
#

ah thnx

hardy escarp
#

!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")```

frank fieldBOT
#

@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
hollow delta
spiral bramble
#

nice

river flint
#

@jagged goblet isnt there supposed to be a def__innt__

#

def_init__ class

#

i think

jaunty prairie
#

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?

near helm
woeful island
hollow delta
near helm
hollow delta
#

Yes, of course, just dm me

lilac yacht
#

@hardy escarp how it should work

burnt dawn
#

hi

#

I'm tryna make conway's game of life in pygame, and idk what the rule is

hardy escarp
dreamy wedge
#

Guys Im making a game and i want to make a camera that follow my player how i do this

tranquil girder
#
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)
dreamy wedge
#

How ?

#

So i need to make a def function and a make a variable and type this ?

#

Alright ?

tranquil girder
#

what library are you using?

dreamy wedge
#

Pygame

tranquil girder
#

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

dreamy wedge
#

Ok

#

Guys Im making a game and i want to make a camera that follow my player how i do this (pygame)

potent ice
#

You just got the answer. You move everything except the player

#

When scrolling around you should only draw what is visible for the "camera"

dreamy wedge
#

And how i move everything

potent ice
#

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

dreamy wedge
#

global scroll.x player

#

Like this ?

potent ice
#

When you draw something you specify coordinates, right?

#

Every time you draw something you need to add the scroll values to those coordiantes

dreamy wedge
#

No i dont

potent ice
#

There are many tutorials on this if you search around

dreamy wedge
#

I search

#

I want to move camera with player

potent ice
dreamy wedge
#

I see it but it doesnt work

#

Its clear code

potent ice
#

Share some minimal code showing what you did.

dreamy wedge
#

Alright

#

Wait a minute

frank fieldBOT
#

Hey @dreamy wedge!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

potent ice
dreamy wedge
#

i paste my code

#

u see ?

#

i save it

potent ice
#

You need to paste the link

dreamy wedge
potent ice
#

I don't see anything related to offset or camera here

dreamy wedge
#

yes

#

i try but it doesn't work, so i delete it

#

i maked a world offset but it doesnt work

potent ice
#

Now that doesn't help

#

Also I would need the resource files

dreamy wedge
#

ok

#

where i send it ?

frank fieldBOT
#

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.

frank fieldBOT
#

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.

dreamy wedge
#

@potent ice

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

dreamy wedge
#

ok

potent ice
#

There are many different ways you make a camera. Some people want player always centered. Others want more complex ones.

dreamy wedge
#

oh thxxx

potent ice
#

If you want a simple camera you can move the camera position instead of the player

dreamy wedge
#

yeah and the complex camera ?

potent ice
#

More complex cameras stop scrolling at the world borders. Some even have zoom.

#

It depends what you need

dreamy wedge
#

oh thx

#

u made my day

#

thx

#

best server ever

potent ice
#

No problem ๐Ÿ™‚

harsh birch
#

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?

zenith pendant
harsh birch
#

kk

#

i used pyinstaller

#

but with diff commands

#

i think it was onefile and no cmd line or something

stark shale
#

does anyone have xperience with OOP and blackjack? I am creating a blackjack game via OOP and needed some help

near helm
#

Here is a little of what I do.

#

Mean Zombie Rip Ears

Play with vol down a little.

woeful island
#

pythongame.exe4:22PM

radiant jungle
#

nice

rugged silo
#

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.. ?

rugged silo
near helm
#

Lol

granite wharf
#

hey

#

what are u guys up to?

dawn quiver
# rugged silo hi all. so i wanna make a rpg game. not with moves, map etc. almost all will be ...

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.

potent ice
rugged silo
rugged silo
#

this module called pygame-gui

#

or pygame_gui

#

theres no difference

#

maybe

#

.

#

@potent ice ok sry for that

#

but it was just a gif

#

not meme

#

.

potent ice
#

Yeah just keep it at a minimum here. It's generally frowned upon.

potent ice
#

This is often the case on large servers. For smaller servers I don't think they care too much

rugged silo
rugged silo
dreamy wedge
#

Guys how can i make a spritesheet player movement i tried but it failed

dreamy wedge
#

Some help

glad sparrow
#

How can I check for collision with any other collider in ursina engine?

frank root
tranquil girder
# glad sparrow 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')
glad sparrow
#

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....

tranquil girder
#

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

magic tartan
#

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

โ–ถ Play video
#

It's probably just me being stupid

quick sentinel
#

bro this so lame

magic tartan
#

?

dreamy wedge
#

guys how i make a player animation in pygame gys

#

guys

stable peak
#

i want to try coding games with pygame, do you have anything to tell me before i start?

dreamy wedge
#

Don't waste your time

dreamy wedge
#

Guys how i make player animation in pygame

covert lagoon
# dreamy wedge 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

glad sparrow
short tapir
#

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

velvet summit
#

hmm

short tapir
#

because wins terminal does not render anything at all when i run the file

#

only vsc

#

!paste

frank fieldBOT
#

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.

velvet summit
#

win terminal as in cmd? or actual "windows terminal"?

short tapir
#

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)

velvet summit
#

i think i see why

#

one second

#

scratch that, hmm.. i'll keep looking

#

how do they get "messed up"?

#

@short tapir

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

velvet summit
#

yea not quite sure sorry, i'll update if i do

short tapir
#

it's happening in all terminals

short tapir
#

@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

velvet summit
#

i've been distracted all day with Midjourney

topaz prism
#

where can I learn to code im abegginer

pseudo rivet
#

what game engines does this channel pertain too?

#

other than pygame

wary plinth
#

guys help

short tapir
short tapir
wary plinth
short tapir
pseudo rivet
#

For python specifically tho?

short tapir
pseudo rivet
#

Like i know unity uses c#

short tapir
#

Not for this place

#

That would be in a unity, c# server or ot

#

Stuff like arcade, ursjna, pyga,e goes here

pseudo rivet
#

Is it more about questions like the code structure

#

Rather than syntax questions?

short tapir
#

General code and syntaxes questions would usually go in general

pseudo rivet
#

@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 ๐Ÿ˜…

wary plinth
short tapir
short tapir
pseudo rivet
#

Ah ok ๐Ÿ‘

#

Thx

wary plinth
#

oh wait

#

i think it worked

#

nah it doesnt

frank fieldBOT
warm vector
#

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.

cold storm
#

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)

tidal snow
dry cloak
#

You dont need anything more than snake

vital yew
#

[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.

short tapir
#

!rule 6

frank fieldBOT
#

6. Do not post unapproved advertising.

frank fieldBOT
#

9. Do not offer or ask for paid work of any kind.

short tapir
#

heh, 69

cold storm
#

๐Ÿ˜„

#

upbge fork of blender + geometry nodes + py

vital yew
short tapir
vital yew
#

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.

vital yew
harsh kayak
#

does anyone know any good websites to download sound effects from?

harsh kayak
#

do u happen to know how to use downloaded sounds as a windows user?

vagrant saddle
#

nope i'm a linux / pygame-web (webassembly) user

harsh kayak
#

dang it

#

im so confused rn

#

windows sucks

vagrant saddle
harsh kayak
#

lol

vagrant saddle
#

but i've heard people use audacity windows version to convert audio for their games maybe that can help you

harsh kayak
#

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

vagrant saddle
#

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()

harsh kayak
#

i was thinking about that, i need my sound to play right when it hits a wall

harsh kayak
#

it worked!!! LETS GOOO finally

harsh kayak
#

My Pong game is now finished

loud lodge
dry cloak
exotic sparrow
#

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

sterile iris
#

tetris.

velvet summit
#

@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)

short tapir
pearl epoch
#

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)

harsh kayak
exotic oasis
#

Hi, anyone familiar with rectangle function in pygame?

tranquil girder
#

Just ask your question

dawn quiver
sterile iris
#

ty๐Ÿ‘ฉโ€๐ŸŽค

ebon shale
limber mountain
#

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...

โ–ถ Play video
bitter blaze
#

Lambda is dumb

frank fieldBOT
#

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

short tapir
#

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))```
limber mountain
#

@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.

limber mountain
#

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

dawn quiver
#

anyone know how to make one of these for my software

velvet summit
#

can you describe it a bit better

#

you just want to make the text to copy and paste?

dawn quiver
#

not muffin.gen

#

that was automatic

velvet summit
#

sure

#
text = """
โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—     
โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘     
โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     
โ•šโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ•  โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     
 โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
  โ•šโ•โ•โ•โ•  โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•   โ•šโ•โ•   โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•
"""
print(text)
#

do you want colors?

#

@dawn quiver

dawn quiver
#

YESSSSSS LIKE THAT I LOVE IT

#

THANKYOU

velvet summit
#
text = """
\033[31mโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—     
\033[31mโ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘     
\033[31mโ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     
\033[34mโ•šโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ•  โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     
\033[34m โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
\033[34m  โ•šโ•โ•โ•โ•  โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•   โ•šโ•โ•   โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•
\033[0m
"""
print(text)```
dawn quiver
#

tysm

velvet summit
#

np

young topaz
#

Its a ''terminal'' game right?

velvet summit
#

Vetrical and Horizon... wow.

velvet summit
young topaz
#

Ok

old axle
#

i dont think this shows the audio though

#

i made all of the images used myself

#

in photshop

old axle
#

!u

frank fieldBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

old axle
#

!server

frank fieldBOT
#
Server Information

Created: <t:1483877013:R>
Roles: 156
Member status: status_online 53,142 status_offline 299,713

Members: 352,855

Helpers: 145
Moderation Team: 39
Admins: 15
Owners: 3
Contributors: 42
Leads: 10

Channels: 324

Category: 34
News: 9
Staff: 63
Stage_Voice: 2
Text: 205
Voice: 11

shrewd night
#

python for game dev?

#

lol

fickle gazelle
shrewd night
frigid rampart
old axle
weary nacelle
#

now days games are only for high end pc

#

they mainly focus on graphics

#

they got realiestic graphics but at what cost

harsh viper
#

Congrats Bro

exotic oasis
#

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?

ancient jetty
snow hill
tidal snow
granite snow
#

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

oak orchid
#

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()
vagrant saddle
white vector
#

lmao y'all using guis

#

the terminal provides all

#

speed is slow cos it's hard

#

larger board example

short tapir
#

Why would you do that

#

What was acheived

white vector
#

snake was boring in 2D

#

now sssnake isss hard

short tapir
#

God save us from the end times

white vector
#

I ascended to a higher plane of existence and back writing this code and I'm still trying to comprehend the walls

#

I also made minesweeper

#

yas 303 seconds solve

full hollow
#

which version of unity should i use guy?

snow hill
woven aurora
#

How can I make a game using python

frozen dawn
woven aurora
#

K

#

Tq

dawn quiver
#

what's a good python library for 2D platformers?

fickle estuary
#

Pygame is your go to for 2d games i would say

dawn quiver
#

I've made a couple platformers with pygame

#

The first video is not just me though, it is the equal effort of 3 developers ๐Ÿ’ช

brave cape
#

wow, both are impressive

#

i could never get that far at pygame

hasty fox
dawn quiver
brave cape
#

always wanted to make something like a strategy game, like a hoi4, but with simpler graphics of course

dawn quiver
dawn quiver
brave cape
#

thx

devout cobalt
#

idk when I'll be like you

#

DAMMMMMMMMMMM

small nexus
#

i hope would one day make something that cool

white vector
#

me trying to do fancy move
also me: presses right-arrow instead of d

hybrid cairn
#

hello

#

many people use classes for their games why is that

small nexus
dawn quiver
#

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

hybrid cairn
#

is it more efficient?

#

maybe faster?

small nexus
dawn quiver
#

!e

class Foo:
    pass

foo = Foo()
print(foo)
frank fieldBOT
#

@dawn quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.

<__main__.Foo object at 0x7f1815adb1d0>
dawn quiver
#

foo is an instance and Foo is a class

dawn quiver
small nexus
dawn quiver
dawn quiver
white vector
small nexus
hybrid cairn
white vector
#

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

white vector
hybrid cairn
white vector
#

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.

hybrid cairn
#

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?

white vector
#

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

hybrid cairn
#

i can fix this by increasing target by multiples of the constant, but i want a solution without this

white vector
#

try capturing a range instead of using direct equality

hybrid cairn
#

yeah i fixed this by getting it to subtract/add by 1 when it reaches a tight range above and below the target

#

thanks

snow hill
#

๐Ÿ‘‰โ€‹ 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...

โ–ถ Play video
snow hill
#

WIP porting a Lua project to Python:

small nexus
#

what will i do when my shell window says actor in a tuple is undifinrd

uncut bolt
#

Does anyone know how complicated it would be to code a dating/chatting sim?

normal silo
#

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.

uncut bolt
#

Wow, coding is complex

restive swan
#

Hello

#

Uh

uncut bolt
#

Hi :)

restive swan
#

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

uncut bolt
#

Im afraid i cant help you, sorry. Good luck tho! :)

#

I hope someone can ^^

restive swan
#

ok thx

hybrid cairn
#

makes more sense now

normal silo
# hybrid cairn 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.

frosty socket
#

the other day I made a death note program on my school pc

harsh kayak
frosty socket
#

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

harsh kayak
terse bridge
#

Anyone in Georgia?

old axle
terse bridge
#

state

old axle
terse bridge
#

i have no friends that know how to code๐Ÿ˜ญ

#

im kinda on my own path with learning and I need some guidance

old axle
#

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

dark sparrow
#

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

ancient jetty
dark sparrow
#

Example:

class items:
  Pot = "A pot"
  DaedricHelmet = "Scary helmet go brrr"

#player picks one
c = DaedricHelmet
print(items.c)
#

@ancient jetty You were saying?

ancient jetty
#

Nvm lol

#

Also

#

WHY YOU ATE CAT

dark sparrow
#

There was muffins the cat. Then python ate cat

ancient jetty
#

Make sense

dawn quiver
#

!e

class Foo:
    SWORD = "test"

player_input = "SWORD"
print(getattr(Foo, player_input))
frank fieldBOT
#

@dawn quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.

test
dawn quiver
#

Or Foo.__dict__[player_input]

dark sparrow
#

No I donโ€™t have a problem

small nexus
#

Please how do you use the 'Actor' method in pygame 1.2.1

dawn quiver
small nexus
small nexus
tranquil girder
#

Isn't that a really old version?

tranquil girder
small nexus
sonic minnow
harsh kayak
quick cargo
#

Hey

#

Guys like how can i turn a code into an app am still confused about that any help ?

#

Am new btw

neon tinsel
#

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

quick cargo
neon tinsel
#

It's an extremely broad question

quick cargo
harsh kayak
woeful island
#

are there other modules i can use for game development instead of pygame and turtle?

grim folio
#
#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).

vagrant saddle
young hedge
#

Please I am new here
Is it possible to create a 3D game with pyGame?

flat onyx
#

@young hedge it might be, but probably very hard. you might just use unity for that since it takes care of that (with pygame)

woeful island
#

just pip install ursina

#

itโ€™s like this 3d game thing

young hedge
harsh kayak
#

All fixed

vagrant saddle
#

it should be the one that contains spaceship_yellow.png spaceship_red.png

little haven
#

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.

harsh kayak
high pebble
ancient jetty
#

I was gonna show my mini game here, but when i see the other ones i dont think i should......

#

Lol

dawn quiver
ancient jetty
#

And the second?

vagrant saddle
slow rose
#

i have just a quick question. Is there another "similar" python library thats like pygame?

vagrant saddle
dawn quiver
#

It wasnt designed to run there, but thanks for notifying
Probably never noticed because of everyone running it locally

crisp arrow
#

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

short tapir
#

!dashmpip

frank fieldBOT
#
Install packages with `python -m pip`

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.

crisp arrow
#

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

grand ember
ancient jetty
#

Hello, can someone teach me about pygame? And yes, i know there are online tutoruals, but i never understand them

white vector
# white vector The most pythonic game: snake. only it's in 4 dimensions https://paste.pythondis...

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.

harsh kayak
harsh kayak
ancient jetty
#
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

nimble dagger
#

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.

steep pilot
#

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

old axle
#

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

eternal shoal
#

Hello

carmine valve
#

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

tawny void
tranquil girder
carmine valve
#

like if player 1's level is higher than player 2 the dodge chances are smaller for player 2 or some stuff?

old axle
frank fieldBOT
#
Server Information

Created: <t:1483877013:R>
Roles: 156
Member status: status_online 44,770 status_offline 308,461

Members: 353,233

Helpers: 145
Moderation Team: 39
Admins: 15
Owners: 3
Contributors: 42
Leads: 10

Channels: 329

Category: 34
News: 9
Staff: 68
Stage_Voice: 2
Text: 205
Voice: 11

tawny void
serene patrol
white vector
white vector
weary haven
#

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

weary haven
#

OK i fount my mistake

lime hamlet
#

Hello!

#

Where I can learn pygame?

frosty nova
harsh kayak
snow hill
#

This afternoon itโ€™s quiet at the office so we setup a cockpit to test the VR mode of the Dogfight

#

Even though people wouldnโ€™t believe it ๐Ÿ˜…

gritty eagle
gritty eagle
gritty eagle
#

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

snow hill
#

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

#
  1. the simulator is TRUELY open source (and not a "semi open source" project based on a proprietary engine)
  2. Python can natively interconnect with AI and maths libs (numpy, pytorch, tensor flow...)
#
  1. 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 ๐Ÿ™‚

eager mantle
#

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)

hot willow
#

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.

winter kraken
dawn oriole
#

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?

#

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?

old axle
old axle
gritty eagle
#

Let me know how it goes

untold fern
dawn quiver
untold fern
#

not sure what that means but that's impressive that you made that in python

last prism
#

Im trying to use PyOpenGL.GLES3 for a 3D environment but whenever i import it this happens....
AttributeError: 'Win32Platform' object has no attribute 'GLES2'

lime hamlet
#

Pip install

dawn quiver
#

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?

old axle
#

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?

dawn quiver
#

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

old axle
#

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

dawn quiver
#

so a bottom-left facing corner, bottom-right facing corner, etc

old axle
#

how can you even tell if a corner if a bottem-left facing corner

dawn quiver
#

I assume you have a model for your game in some sort of class right

old axle
#

yes

dawn quiver
#

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

old axle
#

so basically ```
if connectedneigbor is rightofblock and direction is up:
draw bottemleftfacingcornerblock

#

pardon my psdudocode

#

but soemthing like that ^^^

dawn quiver
#

yeah!! I think so at least

old axle
#

so many possibilies to loop over

dawn quiver
#

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

raw shadow
#

lmao

late timber
#

hi guys. I have made a videogame with python called "turtle racer". Pls could you tell me where can I upload it?

celest breach
#

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

pine plinth
#

pyinstaller changed your line numbers

#

i think, it crashed when you use open(...)

celest breach
pine plinth
#

show code

celest breach
#

ok

frank fieldBOT
#

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.

celest breach
#

there you go

#

im a Beginner in python, sorry if its a bit dumb

pine plinth
#

you can spam prints like print(1) print('foo') print('+') and find where your code crashed

celest breach
#

than what do i do when i found it

#
  • how could that help when the whole code works(in pycharm)
pine plinth
#

not every code that works can work inside pyinstaller

celest breach
#

oh than shouldn't the line it crashes be line 73?

dawn quiver
#

They just changed their code after compilation most likely

pine plinth
edgy arch
#

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.

dawn quiver
#

Taking suggestions on what to add to my Chernobyl based game

quasi patrol
#

anyone want to join my pyweek team

#

?

quasi patrol
dawn quiver
#

Ok

quasi patrol
dawn quiver
#

Ye

#

I really didn't think about it

quasi patrol
#

You could make like a race against the clock and

dawn quiver
#

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

terse verge
#

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++

dawn quiver
#

Search up pygame for beginners on YouTube great tutorials

cerulean citrus
#

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

dawn quiver
#

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?

stable lion
stable lion
dawn quiver
#

ok thx

dawn quiver
#

What is the input for left enter

#

in pygame>

#

*I mean just enter

#

What is the input for enter

celest breach
#

K_KP_ENTER
I think