#game-development

1 messages · Page 103 of 1

restive parrot
#

For education purpose

runic granite
#

ohh i learned more python more for virtual intelligence and build on website

restive parrot
#

Lot of program is virus

#

It almost make my computer death

runic granite
restive parrot
#

@runic granite I love your profile.

runic granite
runic granite
restive parrot
restive parrot
#

I am 12.

runic granite
#

so i stopped playing

restive parrot
restive parrot
runic granite
restive parrot
#

So I can focus on python 🙂

restive parrot
#

You wanna see?

runic granite
#

me, same, I have deleted almost all my social media apps (I still have only Instagram)

runic granite
restive parrot
#

hohoho

#
import random
while True:
 y = 0
 z = input('Called ben?1 YES / 2 NO: ')
 if z == '2':
    continue
 while y<10:
   number = random.randint(1,4)
   x = input('Ask question here: ') 
   if number == 1:
      print('Yes')
      y = y+1
   elif number == 3:
      print('No')
      y = y+1
   elif number == 4:
      print('Hohoho')
      y = y+1
   elif number == 2:
      print('Uhhh')
      y = y+1

 print('Ben hang phone on you.')
runic granite
restive parrot
#

Basic program

#

Use What I learned

runic granite
#

how long have you been working on 'Python?

restive parrot
restive parrot
#

No CAP

#

I learned from codecamp

runic granite
restive parrot
runic granite
restive parrot
#

They said CPU is dumb but It is fast

runic granite
runic granite
#

nice, that's what many people say to me

restive parrot
#

community

runic granite
runic granite
runic granite
restive parrot
#

But In real life we copy and paste(Only part that don't know how to deal with it)

#

@runic granite I gtg

#

It is about 10 PM here

runic granite
runic granite
runic granite
restive parrot
#

Thailand

restive parrot
#

JK

runic granite
restive parrot
patent urchin
azure atlas
#

can i participate in someone's game project?

frank fieldBOT
#

Hey @severe flame!

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

unreal river
frank fieldBOT
#

Hey @severe flame!

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

sour cobalt
patent zenith
#

more curses

#

might gonna work on filled frames

azure atlas
patent zenith
azure atlas
sour cobalt
#

Uh

sour cobalt
#

And I'm not using/making any sprites since I'm lazy af

patent zenith
serene patrol
#

Source code

frank fieldBOT
restive parrot
#

I made puzzle game there is only one question if you want script DM me

potent ice
grand whale
#

in this channel

#

nvm

grand whale
#

are you using optimization?

#

i see

#

the player speed

#

is slow

rare goblet
#

Hey guys.

#

may I ask. Difficult to explain but I'll do my best.

#

What is the concept called when In a open world game like WoW for instance. Only what is in the radius of the character is visible but not the whole map.

#

to reduce resource consumption.

#

Consider this. Star being the character, yellow being what the character can see at the time. Then the Grey as the rest of the map, but inactive because there's no need to view it at the time.

keen beacon
# rare goblet Consider this. Star being the character, yellow being what the character can see...

Clipping, in the context of computer graphics, is a method to selectively enable or disable rendering operations within a defined region of interest. Mathematically, clipping can be described using the terminology of constructive geometry. A rendering algorithm only draws pixels in the intersection between the clip region and the scene model....

rare goblet
flat aurora
#

There’s also level of detail tactics

#

Where you basically have higher and lower resolutions versions of textures/models and render lower quality things that are further away and switch to higher quality assets for closer things

green jasper
#

Which library is used for game development sorry for bad English*

frozen knoll
#

Arcade, pygame, ursina, pyglet, etc.

covert lagoon
#

Any reason for me to switch from pygame to a better 2d lib?

spiral skiff
covert lagoon
#

Well i havent had issues with pygame, and it seems to meet my current needs for it. Ive just heard theres better ones out there and wondered if i should consider switching

spiral skiff
#

do you have any progress on your current project in pygame? if yes then dont switch, you can use the other lib when u start a new proj

frozen knoll
#

You might want to see if the speed or features make it worthwhile. If you spend a lot of time coding a feature that is built into another library, that's time wasted. Or spend time optimizing a slow program when another is fast up front.

grave grove
#

heyy

#

I've just started learning pygame and I had one doubt regarding screen.blit()

#

this is from a tutorial I'm currently watching on how to code flappy bird in pygame (and they're making like the floor move towards left-
and it says that there are two floors next to each other moving left at the same speed)

#

I've understood what they wanna do

#

BUT MY QUESTION IS-
doesn't screen.blit() just redraw the floor? like how are there two floors simultaneously?

tranquil girder
#

no it doesn't, that's why you have to clear the screen manually
you code draws the same floor surface at two different positions

grave grove
hasty arch
#

Hello, i am working on my first game ever with python using pygame => basic game to write what program typed and i have problem that text to write is not on same line as the entered text by user. How can i fixed that? I tried to find to set something like "line height" but without any success 😦

normal silo
dawn quiver
normal silo
#

Or, if you are drawing to a surface and then drawing that surface to the main screen then it's drawing that surface on top of the old one. Effectively clearing the screen in an indirect way (that might also not clear the entire main screen depending on if the surface is the size of it or not) by drawing a big background, you can think of it as using a background image as a clearing tool. Either way, it's recommended to just always clear the screen.

hasty arch
pine kayak
#

is there a geometrydash coded in python, with the same physics as in the original game?

dawn quiver
#

Sadly i dont think sublime has that scheme ill have to search for a similar one

hasty arch
dawn quiver
#

Fullscreen it if you cant see it clearly

#

This could be extended to 3 dimensions against cubes. It may be a cheaper alternative to more general raycasting algorithms

#

It uses a form of vector projection and point slope form to calculate ranges(yellow lines). If the rectangle is within these ranges then the ray hit

dawn quiver
#

Someone notice me 🥲

proven iris
unreal river
wanton lodge
#

cool collision check

steel juniper
#

HI, I am trying to code a chess game based on a youtube ||video|| which is 2 years old. Here is a python function whose task is to draw the bhess board.

def drawBoard(Screen):
    #this function draws the squares on the board
    """The top left quare on the chess board is always light colored."""
    colors = [pygame.Color(255,255,255),pygame.Color(127, 127, 127)]   #defining the coloured used to fill up the squares on the board
    for rows in range(dimension):
        for cols in range (dimension):
            #choose the colour based on the rule.
            """if row+col %2 == 0 square is light coloured otherwise dark coloured."""
            #color = colors[((rows+cols)%2)] this I think causes errors
            if ((rows+cols)%2==0):
                ind=0
            else:
                ind=1
            color = colors[ind]
            #drawing the square on the board after selecting it's colour
            pygame.draw.rect(Screen, color, pygame.rect(rows*sq_size,cols*sq_size,sq_size,sq_size))```
but the last line is not working maybe due to some syntax changes of pygame. The error is as follows :
```  File "/home/shiv/projects/Cheng/CHESS_ENGINE-Cheng-/chessMain.py", line 55, in drawGameSate
    drawBoard(Screen) #function to draw the board
  File "/home/shiv/projects/Cheng/CHESS_ENGINE-Cheng-/chessMain.py", line 76, in drawBoard
    pygame.draw.rect(Screen, color, pygame.rect(rows*sq_size,cols*sq_size,sq_size,sq_size))
TypeError: 'module' object is not callable```
can anyone help me in figuring out the solution.
young pine
sour cobalt
#

Oh wait nvm

young pine
sour cobalt
#

I didn't realize message u were replying to

sour cobalt
young pine
#

do you know how can i collide animated object bcz my character is colliding to that object but not touching the img

sour cobalt
#

idk I just use circle collision, line/psuedo rect collision for my game

#

;_;

#

(my game has hundreds of projectiles and already nears being too slow for 60 fps so I can't use masks)

#

,_,

young pine
#

should i use masks i am making platformer game

sour cobalt
#

I guess

young pine
#

but there is no tutorial for using masks with animated objects

sour cobalt
#

isn't animation just swapping between images so couldn't you just do collision based on the current image chosen?

young pine
#

yes but its not working

#

oh nvm

#

waittt

#

ig i figured it out

#

thankss man

sour cobalt
#

oof

#

np even tho u figured it out urself 👀

smoky thunder
robust knoll
#

Where did u learn pygame btw

young pine
#

me?

robust knoll
#

Yes

young pine
#

many resources

dawn quiver
#

#bot-commands

snow urchin
#

so how it going

steel juniper
steel juniper
#

here is the youtube video I used for making the project

crisp junco
#

Does anyone have any idea on how would I go about making the tank shoot along the blue line?

#

how would I apply the physics in game?

snow urchin
#

ok

#

yes i do

urban oak
#

hello does anyone know how to make the "camera" follow the player on pygame?

blissful goblet
#

finally got sprite explosion to work behind player when they kill a enemy

dense harness
#

Hey is it typical for game windows to be scalable? I'm trying to make mine scalable but i'm running into a lot of issues with my UI textures breaking when scaled too small

sinful lodge
#

you can follow this tutorial perhaps: https://www.youtube.com/watch?v=5q7tmIlXROg

The implementation of a camera is actually an illusion. Instead of moving a "camera", you just move everything on screen.

The project can be downloaded here: https://dafluffypotato.com/static/platformer_project.zip

A larger platformer example project: https://cmlsc.itch.io/super-potato-bruh

If you were confused by the tile physics in the last...

▶ Play video
edgy aspen
#

can some1 give me a ez way to do camera follow in pygame

#

like its confusing

covert mason
dense harness
#

Honestly, I'd love to do it in Unity but I'm terrified that my knowledge of coding will not be enough

#

I barely have a grasp on python at this point haha

covert mason
#

Don't worry, at first it may look confusing but trust me, you want regret learning it

#

Maybe try Godot

#

It is also using python as far as I know

#

Or something similir

dense harness
#

hm, perhaps I will try that

#

I appreciate the advice

covert mason
#

Good luck

ember carbon
#

hello im doing a test and it worked but thats weird

#

to display seconds 0 to 1 min in the surface

#

it keep saying me not responding

#

but when i print in the console the seconds its working

#

@young pine If you can help me and btw sorry for the ping

young pine
#

time.sleep() pauses whole program so it wont respond you should use pygame ticks instead

#
mainticks = pygame.time.get_ticks()
while i < 60:
  ...
  now = pygame.time.get_ticks()
  if now - mainticks == 500:
    second += 1
    mainticks = now
    i += 1
  ...``` ig this works @ember carbon
meager apex
#

hi

next sun
#
        self.manager = arcade.gui.UIManager(window=parent_window)
        self.manager.enable()

        self.v_box = arcade.gui.UIBoxLayout()
        manage_building_button = arcade.gui.UIFlatButton(text="Manage Buildings", width=200, x=100, y=100)
        self.v_box.add(manage_building_button)
        manage_building_button.on_click = self._on_click_manage_building

        self.manager.add(
            arcade.gui.UIAnchorWidget(
                child=self.v_box)
        )

I have this code for a button in arcade but the button isn't placing at x=100 and y=100, it is always placing at (443, 326) no matter whatever value i give

Figured it out need to add align_x in anchor widget

glossy juniper
#

how do you load a png image to a sprite in pygame so that the transparent background doesn't turn black?
here's how I load the image:

class Piece(pg.sprite.Sprite):
    
    def __init__(self, pos):
        pg.sprite.Sprite.__init__(self, self.containers)
        data = starter_locations[pos]
        self.image = load_image(f"Pieces\{data}.png")
        ...

def load_image(file):
    """loads an image, prepares it for play"""
    try:
        surface = pg.image.load(file)
    except pg.error:
        raise SystemExit('Could not load image "%s" %s' % (file, pg.get_error()))
    return surface.convert_alpha()
#

but the background will still be black, even with convert_alpha()

sour veldt
glossy juniper
#

you gotta start somewhere

#

I've made a tictactoe discord bot before 😄

#

k but how do you load that image :C

sour veldt
#

I don't know

#

But its very nice

glossy juniper
#

yeah

sour veldt
#

I made clicker

#

And I can't make points

#

When the button is pressed

#

I will try to send the program code sometimelemon_wumpus

hasty arch
glossy juniper
#

let's check

#

this is the screen or?

#

screen = pg.display.set_mode(SCREENRECT.size, pg.SRCALPHA) didn't change anything

hasty arch
#

idk how you name variable for creating main surface = window, but if it is, then yes

glossy juniper
#

uh, that's kinda weird there but you can take a look at it if you want to

#
def main():
    pg.init()

    screen = pg.display.set_mode(SCREENRECT.size, pg.SRCALPHA)
    pg.display.set_icon(load_image("Pieces\\bq.png"))
    pg.display.set_caption("Chess")

    board = load_image("Board.png")
    background = pg.Surface(SCREENRECT.size)
    for x in range(0, SCREENRECT.width, board.get_width()):
        background.blit(board, (x, 0))
    screen.blit(background, (0, 0))
    pg.display.flip()

    pieces = pg.sprite.Group()
    all = pg.sprite.RenderUpdates()

    clock = pg.time.Clock()

    Piece.containers = pieces, all
    for pos in starter_locations:
        Piece(pos)

    while True:
        for event in pg.event.get():
            if event.type == pg.QUIT:
                pg.quit()
                sys.exit()

        all.clear(screen, background)
        all.update()

        screen.fill((0, 0, 0))
        dirty = all.draw(screen)
        pg.display.update(dirty)
        clock.tick(40)
#
    for x in range(0, SCREENRECT.width, board.get_width()):
        background.blit(board, (x, 0))
```just realised I don't need this part
hasty arch
#

i dont see any problem with this, it should be transparent

#

Anyways cool idea to make chess

glossy juniper
#

would be cooler if it worked

#

👀

#

might it be a problem with the png files?

hasty arch
#

if they really have alpha channel, then not, check if they dont contain black background

glossy juniper
#

don't think so, seems fine

hasty arch
#

tried to put image over my game and it works

#

even without the SRCALPHA tag

glossy juniper
#

try putting that that I just sent above

#

or I could try set_colorkey

hasty arch
#

idk mby, i have no problem with alpha channel so idk

glossy juniper
#

set_colorkey neither

glossy juniper
#

@hasty arch got it after commenting out screen.fill((0, 0, 0)) in my main

#

just so you know it works now 🙂

rustic valve
#

what application would i use to create game sprites?

#

(preferable a free one)

obtuse drift
#

do y'all prefer python over unity?

exotic dock
#

That is a huge number of contributors, and I like browsing the code therein mhmm

young pine
frank fieldBOT
#

Hey @hasty ruin!

It looks like you tried to attach file type(s) that we do not allow (.exe). 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.

meager apex
#

can someone explain the formula of slope calculation

#

why is the (y2 - y1)/(x2-x1) the slope calculation

sinful lodge
sinful lodge
serene patrol
#

Block Breaking Game-

sinful lodge
young pine
sinful lodge
young pine
sinful lodge
young pine
sinful lodge
#

editor

young pine
next sun
#

!paste

#

and apparently this error doesn't pops up when using UITextArea with the same arguments

magic flame
#

I love this

empty wraith
#

using arcade lib. can i in any way bind primitives/set of primitives such as rectangle to a sprite, so i'd be able to deal with it like an object (without using an actual image)?

#

i see there is arcade.SpriteSolidColor, that might be useful

willow nimbus
#

hey can somone help me

thick geyser
#

i have a pygame question maybe someone can help me with

tranquil girder
#

maybe if you ask it someone can help you with it

frozen knoll
#

@empty wraith There's a circle and a solid color sprite available.

#

For advanced draw-on-a-sprite work, you can use code like this minimap example:

#

The minimap is a sprite, and you can draw whatever on it.

empty wraith
#

very interesting, thanks

#

cool lib btw 🙂

frozen knoll
#

Glad you like it!

thick geyser
#

increase = 1

score_list = 0
hands_list = []
mouth_list = []

class ClickButton():
def init(self, image, x_pos, y_pos, text_input):
self.image = image
self.x_pos = x_pos
self.y_pos = y_pos
self.rect = self.image.get_rect(center=(self.x_pos, self.y_pos))
self.text_input = text_input
self.text = main_font.render(self.text_input, True, "white")
self.text_rect = self.text.get_rect(center=(self.x_pos, self.y_pos))

def update(self):
    screen.blit(self.image, self.rect)
    screen.blit(self.text, self.text_rect)

def checkForInput(self, position):
    if position[0] in range(self.rect.left, self.rect.right) and position[1] in range(self.rect.top, self.rect.bottom):
        score_list += increase
#

UnboundLocalError: local variable 'score_list' referenced before assignment

#

does anyone know why i get this error

#

this is pygame btw

empty wraith
#

could you upload the entire file? just drag&drop it in here

rustic valve
#

oh im not swag ic

#

?tag code

light nestBOT
#

This is not a Modmail thread.

rustic valve
#

jah

#

sad

wanton lodge
frank fieldBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

wanton lodge
#

wrong prefix 😉

sinful lodge
next sun
#

its arcade

potent ice
#

There's an issue on it

potent ice
pulsar yew
#
screen.blit(left_wall , (left_wall.x , left_wall.y))

is showing the error screen has no attribute blit . why is that ?

royal hawk
#

what's minesweeper's mine generating algorithm?

normal silo
#

Might be unsolvable without randomly guessing.

#

You can write a generation algorithm that makes sure it's always solvable.

wanton lodge
#

place any random pos besides the position the player clicked

#

then scan each grid and indicate the number on the grid

sinful lodge
pulsar yew
#

ohk then can i buy google and twitter?

#
  File "c:\Users\saksh\Desktop\pygame\game1\main.py", line 29, in <module>
    player.add(Player('sidewall.png' , 0 ,0 , 100 , 100 , 'left_Wall'))
  File "C:\Users\saksh\AppData\Local\Programs\Python\Python310\lib\site-packages\pygame\sprite.py", line 454, in add
    sprite.add_internal(self)
AttributeError: 'Player' object has no attribute 'add_internal'```
#

why is there an error in pygame file?

empty wraith
#

because most likely Player is not a subclass of Sprite

pulsar yew
#

so i have to do somthing like class Player(p.sprite.Sprite)?

empty wraith
#

yeah

pulsar yew
#

how do i make an object move continuously while i keep pressing the button instead of pressing it again and again?

tranquil girder
#

When you press the button, set a bool to True and back to False when you release it
Then every frame, move of that bool is True

echo wadi
#

if i wanted to animate ( sprite ? ) a needle gauge or a custome gauge , is there a limit to how many animation frames i can use ?

frozen knoll
#

If I was doing a guage like that, I'd probably have two sprites, one for the needle, one for everything else.

#

Also, kind of depends on the library you are using.

thick geyser
#

does anyone know a way to add a value to a variable every second?

quartz dock
#

Hey, I coded a hangman today in python but when I open it in cmd prompt it immediately closes…might any one know why?

#

Very new with Python, so don’t have much idea what to expect with it

upper nacelle
empty wraith
#

arcade. is there a way to disable logging, like for exampe suppress the Attempting to add texture log message, which is of a fairly high INFO level

potent ice
empty wraith
#
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s')
logger = logging.getLogger()

i have this specifically, and i import logger wherever i need

#

when i said disable logging i meant only disable logging for arcade, was hoping there's an option to do that

potent ice
#

It's a python logging thing, not an arcade thing

#

logging.basicConfig changes the global/default log level of everything

empty wraith
#

oh, but logger can have its own level right?

potent ice
#

yes. Just like the above code

empty wraith
#

i somehow got confused and thought logger/arcade_logger in this case would change the global level

#

oh man, what a silly mistake

potent ice
#

Also a good idea to name your loggers logger = logging.getLogger() will just return the default one

empty wraith
#

thanks

potent ice
#

logging.getLogger(__name__) is great

empty wraith
#

what would be the purpose for naming? putting the name of the logger into the output?

#

(with corresponding format)

potent ice
#

The logger name hierarchy is analogous to the Python package hierarchy, and identical to it if you organise your loggers on a per-module basis using the recommended construction logging.getLogger(__name__). That’s because in a module, __name__ is the module’s name in the Python package namespace.

empty wraith
#

i mean, what would be the practical use for it. i've been using just one logger object and importing it in things, i guess with extensive logging and a lot of different modules i could use multiple logger objects and name them so i could instantly tell where potential warning etc come from

potent ice
#

We have lots of loggers in arcade. Typically per module. loggers could be arcade, arcade.sprite, arcade.spritelist, arcade.texture_atlas etc.

#

This will set the level for all of them ```py
arcade_logger = logging.getLogger("arcade")
arcade_logger.setLevel(logging.WARN)

#

That's the advantage of just using __name__ (name of the module)

empty wraith
#

thanks for your help. i have been using logging for quite some time, just apparently not to its full potential (also made this dumb oversight today) 🙂

potent ice
#

Loggers can be a mess sometimes. Not blaming you 😄

empty wraith
#

after messing around with it a bit more, i now understand the source of my confusion better, basically if you leave the name empty it will indeed set the global logging level when you setLevel to it (because you get the root logger). i just forgot how crucial this detail is after several months of not doing python 🥴

#

also since i'm here, is there an easy way to check for "collision" of the mouse cursor and Sprites, in other words, an easy way to detect when i'm hovering over a specific sprite
from what i've seen so far there's no easy way, and i'd need to loop over all sprites and see if mouse cursor position belongs to an area/hitbox of each individual sprite. Do it in on_mouse_motion, most likely.

potent ice
#

For example : get_sprites_at_exact_point

#

If you have spatial hashing enabled in the spritelist it will be an O(1) operation. Otherwise it will loop all the sprites (O(N))

empty wraith
#

i assume for static sprites i want that spatial hashing enabled

#

well, not assume, i've read that it's not as good for dynamic ones

#

..or maybe it's only applicable to sprite-sprite collisions

potent ice
#

You could have 1M sprites and still have fast collision detection with spatial hashing

empty wraith
#

would spatial hashing improve performance if all sprites are dynamic?

potent ice
#

It depends. It's a tradeoff. Every time you rotate or move a sprite it needs to update the spatial hash

#

You will have much slower movement, but fast collision detection

#

(against the list of moving sprites)

#

If it's like 50 sprites it might not be worth it

potent ice
#

There are plans to cythonize spatial hash and a few other things for 2.7

blissful goblet
#

day night cycles based on real time in discord bot game, still not happy with artwork

#

granular sunrise/sunset and background change based on time. Anyone want to give feedback on art?

#

doing a rework of the market stall now

frozen knoll
#

I like this! Well done.

covert lagoon
#

Trying to implement jumping. Right now, i have it working so the player rises during the ascension time and falls during the dissent. However, it looks very linear. Is there a way i could make it so as the player approaches the peak, they go slower, and do the inverse on the fall down?

dawn quiver
#

that way it consistently reduces

#

idk what ur code looks like, im assuming u have a y axis velocity or something

#

if something doesnt work well, try replicating it using an asynchronous visual coding language

#

i.e. scratch, its super fast and easy to fix small bugs with ur physics engines and stuff

covert lagoon
dawn quiver
#

i assume rising is a binary variable where it detects if ur going up? or not?

covert lagoon
#

True or false, ye

#

It isnt actually that, just used that as a placeholder to explain

dawn quiver
#

lemme check smthng really quickly

#

Sorry, i was typing it all up and i forgot to include a gravity script

#

💀

#

i gotta sleep now, sorry

covert lagoon
#

Alr, no worries 👍

patent zenith
scenic steeple
#

Is it okay if I ask something about pygame in this channel?

potent ice
#

Sure, but probably other places with more eyes

#

Probably way more pygame people on pygame discord to be honest

fluid spire
#
IGN

Watch our Elden Ring review. Elden Ring is a massive iteration on what FromSoftware began with the Souls series, bringing its relentlessly challenging combat to an incredible open world that gives us the freedom to choose our own path.

Elden Ring Reviewed by Mitchell Saltzman on PC. Also available on PlayStation and Xbox.

#IGN #Gaming #Elden...

▶ Play video
safe spade
#

aaaannnnnddddd

slender siren
#

how am i supposed to render a red cube in python?

frank fieldBOT
junior lintel
#

Hey guys , How can I make the logic of tic tac toe like if X is marked it will be the turn of O and etc

#

btw I'm trying to do this game by myself , so if u find something weird on the code just ignore

empty wraith
#

create player objects, loop over them with itertools.cycle

steady helm
#

i want to make a function and i want it to check for a yes or no and turn that into a 1 or 0

empty wraith
#

"yes" or "no" as user input?

#
def is_yes():
    return input().lower() == 'yes'
#

if really want 1 or 0 instead of a bool, can just convert it to int

sage ermine
#

can someone help me with some pygame stuff

#

i want to create a button

#

i searched a lot of toturials

#

didn't find anything simple

feral plaza
#

when i make a game in pygame on repl.it how will i be able to play the game?

rough warren
feral plaza
#

or i could code on repl.it and then copy it all to my machine

rough warren
feral plaza
serene inlet
#

Hello wondering if someone knew how to rotate a drawing is there a command for it or would I have to rotate the surface its on?

#

Drawing would be pygame.draw.circle() or polygon etc no images imported

young pine
serene inlet
young pine
#

i mean png will not be changed it will be changed in pygame window

serene inlet
#

Its not an image its the built in draw function

#

Drawing many shapes on screen and trying to rotate them all at once

young pine
#

if its a surface which you can draw on screen it can be rotated

serene inlet
#

Alright I'll try it

#

Thanks

burnt pulsar
#

How to make a snake game on python?

serene inlet
#

Should watch a yt video

burnt pulsar
#

Ok tysm!!!

feral plaza
#

What did i do wrong in this code? its not giving any error, but it wont run when i try to have the sound effect:

BULLET_HIT_SOUND = pygame.mixer.Sound('Assets/Grenade+1.mp3')
BULLET_FIRE_SOUND = pygame.mixer.Sound('Assets/Gun+Silencer.mp3')```
keen shard
#
import pygame
pygame.init()

WIDTH, HEIGHT, = 700, 500
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Pong")

FPS = 60

WHITE = (255, 255, 255)
BLACK = (0, 0, 0)

PADDLE_WIDTH, PADDLE_HEIGHT = 20, 100

class Paddle:
    COLOR = WHITE
    VEL = 4


    def __init__(self, x,y, width, height):
        self.x = x
        self.y = y
        self.width = width
        self.height = height

    def draw(self, win):
        pygame.draw.rect(win, self.COLOR, (self.x, self.y, self.width, self.height))

    def move(self, up=True):
            if up:
                self.y -= self.VEL
            else:
                self.y += self.VEL


def draw(win, paddles):
    win.fill(BLACK)

    for paddle in paddles:
        paddle.draw(win)
    pygame.display.update()

def handle_paddle_movement(keys, left_paddle, right_paddle):
    if keys[pygame.K_w]:
        left_paddle.move(up=True)
    if keys[pygame.K_s]:
        left_paddle.move(up=False)

    if keys[pygame.K_o]:
        right_paddle.move(up=True) #Pay attention to here, it was K_UP, K_DOWN, but, then I had to spam the arrows up, and down for right paddle to move. I changed it to K_O, K_l all of a sudden it fixed my problem?
    if keys[pygame.K_l]:
        right_paddle.move(up=False)



def main():
    run = True
    clock = pygame.time.Clock()

    left_paddle = Paddle(10, HEIGHT//2 - PADDLE_HEIGHT//2, PADDLE_WIDTH, PADDLE_HEIGHT)
    right_paddle = Paddle(WIDTH - 11 - PADDLE_WIDTH, HEIGHT//2 - PADDLE_HEIGHT//2, PADDLE_WIDTH, PADDLE_HEIGHT)

    while run:
        clock.tick(FPS)
        draw(WIN, [left_paddle, right_paddle])


        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
                break

            keys = pygame.key.get_pressed()
            handle_paddle_movement(keys, left_paddle, right_paddle)

    pygame.quit()

if __name__ == '__main__':
     main() ```
formal mountain
feral plaza
# formal mountain did you initialize the mixer?

this is the error i get:

  File "main.py", line 18, in <module>
    BULLET_HIT_SOUND = pygame.mixer.Sound('Assets/Grenade+1.mp3')
FileNotFoundError: No file 'Assets/Grenade+1.mp3' found in working directory '/home/runner/Test-spel'.```
formal mountain
#

you probably passed wrong path or wrong name of file

feral plaza
#

i did lol

#

i just fixed it

formal mountain
#

lol

feral plaza
#

im dumb

#

its fine lol

formal mountain
#

kek

feral plaza
#

thanks for the help still man

blissful goblet
#

i hate doing my own art. how do i even do a mushroom cloud

normal silo
blissful goblet
#

😤

normal silo
#

Notice the bottom is lumpy clouds of smoke, and the top emits a lot of light (so shading is different than a normal object). Also it has a bunch of darker spots / texture.

#

(nor is the top a perfect mushroom shape, try breaking the contour a bit)

potent ice
#

If it's a still image you can add some shock waves or something

#

Honestly, I tough it was just an overgrown mushroom

normal silo
#

*The explosion should also be shading the rest of the objects in the scene as a back light.

#

Due to the dust there may be some nice visible rays of light / volumetric lighting.

#

You can see how in the reference image it glows around the mushroom as well.

#

Near the top and bottom it's so bright that it's basically pure white.

#

Then it becomes more lumpy and darker:

blissful goblet
#

alright thanks, ill give it another shot in a minute, just so tired of drawing tho

blissful goblet
#

slowly getting there

sinful lodge
frozen knoll
karmic prawn
#

Guys, can anyone help me in building a TCG, sort of like MtG Forge? How do I code in the card effects?

blazing torrent
karmic prawn
#

As far as I can think, it would involve things like moving a card from one point to another, tapping/untapping/ removing summoning sickness, battle/combat, tap ability, etc.

karmic prawn
dawn quiver
dawn quiver
crisp junco
#

it's working now

#

the thing is in the X direction it would move to a distance of = velocityX * time
in Y it would be Y = ut + 1/2at^2

dawn quiver
#

well what id do is constantly add to your y velocity component. This simulates gravity. Then give an initial push by adding a vector in the direction you want to shoot.

#

It should give an arc

#

oh

#

right i forgot you need to decrease your horizontal velocity as well

#

velocity.x *= .5 should slow it down

ancient crescent
#

Can someone

#

tell I need to start

#

my

#

pygame

#

I am very week

#

in it

#

and if I write code in pygame

#

and use in kivy

raw shadow
sage ermine
#

'''py

frank fieldBOT
#

Hey @sage ermine!

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

#

Hey @sage ermine!

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

sage ermine
#

the last part of my code ain't working

blissful goblet
#

😤 finally done

ashen condor
#

is there any way to get a pygame.Surface from a pygame.Rect?

potent ice
#

This also includes a new feature: Headless rendering on linux server.

dawn quiver
#

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

dawn quiver
#

Cave generation

dawn quiver
wanton lodge
#

zamn

#

nice

#

da speed

dawn quiver
# wanton lodge zamn

That was just a shot of it compiling and running. it actually takes 14 milliseconds.

#

Though im not sure how good that is

wanton lodge
#

recruiting is not allowed here unless you have mods approved iirc 😬

#

might want to get one at @light nest

sick eagle
wanton lodge
sick eagle
#

btw vaxeral is in the server

feral plaza
#

<@&831776746206265384>

proud hamlet
#
def draw_window(sydän):
    WIN.fill(MUSTA)
    WIN.blit(TAUSTA,(0,0))
    WIN.blit 
    pygame.draw.rect(WIN, KELTAINEN, (400, 100, 400, 400), 6)
    WIN.blit(SYDÄN, (sydän.x, sydän.y))
    pygame.display.update()  ```


this is my window so far and I want that the hearth is inside of rectangle(it already is) and it cant go trhu the walls but other objects can that i make later
blissful goblet
#

hmm what should i make a blackjack npc look like

#

i wish i had made the perspective of the drawings anything but head on, i could draw a tabletop and cards and it would have made so many things easier

blissful goblet
dawn quiver
#

Hello can someone help me with making snake game in python and with pygame?

blissful goblet
#

how tf do you draw a bush istg

#

ffffffffffffffff

ocean lichen
#

Hey guys very nooby question, i've just started coding. Im about 2 days in and i'm getting stuck with an issue. Can i recall 2 functions in a elif statement? i've had alittle look around google but i cant find anything i can really use to help me

#

or can i call a function, and then recall to a variable after the function has finished?

potent ice
ocean lichen
#

Thanks mate, through my own problem solving i think its an issue with my function which is why its not being called properly. i'm going to do abit more diggin before i start bothering people lol!

peak hinge
#

can someone help me i can't do this puzzle in python

#

i try but i can not

dawn quiver
#

Hello, can someone help me with making snake game in Pyhon and with pgame?

#

?

feral plaza
#

i've made a game using pygame and i wonder how i could make it publicly available? Im not trying to earn money or anything. i just want it to be publicly available without forcing the user to downloading the game files

dawn quiver
#

@feral plaza you can copy paste

feral plaza
#

what do you even mean by that?

dawn quiver
# feral plaza huh?

You said that you want to publice your code. so you can copy paste and drop it in the chat or somewhere else

feral plaza
#

i said i want my game to be public not my code...

dawn quiver
#

Ohw

#

I think you can make a link or so

dawn quiver
feral plaza
tranquil girder
#

I don't think copy pasting it is what they want. Players would have to 1. Be on this server, 2. install python, 3. install pygame and any other modules it uses, 4. launch the game through a terminal interface.
There are packaging tools you can use, such as pyinstaller, but there are lots of other ones too. When I released a game on itch.io, I just uploaded python.exe, the modules I used and game code + assets, so that's possible too.
Maybe follow this: https://www.youtube.com/watch?v=lTxaran0Cig, since he's actually released commercial games

feral plaza
tranquil girder
#

No, that's literally impossible. If you mean make it run in the browser, that's still downloading. I don't think pygame has an export to web option either

blissful goblet
#

does this bush look remotely right

#

i can't even tell anymore

hidden eagle
#

I can confirm that bush looks like a bush.

ripe marsh
#

How to fox it?

blissful goblet
#

bush confirmed thank

ripe marsh
feral plaza
#

me running a small game using repl.its cpu

lean peak
#

Ez

dawn quiver
#

you execute it by passing it to python

#

python -m pyinstaller -F test.py

untold anvil
#

how do we use python for game dev

patent goblet
#

Would you recommend a nice Python editor

tired aurora
#

Hey all, I'm using Lua, but any answers in other languages would be appricaited, as I understand that this is more of a programming concept than anything else probably.

How would you call a function ULT_Ped.setWeapon like this:

controllerWeapon.all(pedestriansMenu_weapon, ULT_Ped.setWeapon)

pedestriansMenu_weapon - is a variable something unrelated

And but pass in the value from inside the controllerWeapon.all method?

-- controller
function controllerWeapon.all(parent, func)
     
    for index = 1, #data do
        local ult_category = data[index]

        local ult_categoryName = ult_category.name
        local ult_weapons = ult_category.children

        local ult_categoryParent = menu.add_feature(ult_categoryName, "parent", parent, nil).id

        for j = 1, #ult_weapons do
            ult_weapon = ult_weapons[j]
            menu.add_feature(ult_weapon.name, "action", ult_categoryParent, function(feat)   
                -- ULT_Ped.setWeapon(ult_weapon.hash)
                func(ult_weapon.hash) -- Thissssssssss
            end)
        end

    end
    
end

Feels like needs a callback? or a global state umm

#

The function is what's dynamic. Although there are only a few options that it can have so maybe having a switch could be better such as (parent, option) if option is 1, give weapon to npc, if option is 2, give weapon to player, is option sis 3 ec... and maybe have like up to 5 options 🤷‍♂️

#

But can't guarantee this would be the same with other stuff since this is just weapon controller

patent goblet
tired aurora
patent goblet
#

Why do you think that?

tired aurora
# patent goblet Why do you think that?

You're not very nice, are you - please don't write anything if you're here to insult/mock whatever you call that people. Were not here to have 'fight's over nonsense. Take that elsewhere - this discord/channel is not the place for that.

patent goblet
#

And since there are not enough software resources in my country, I need foreign resources, I'm in Turkey, and there are almost no software resources in Turkey, and the resources that will force me financially, so I don't even know your language.

#

I'm glad I could explain myself.

gentle mauve
#

Hi guys, I'm a little new to pygame, I'm trying to create a Button to display unto the screen, but for some reason when I call my Button's draw method, I don't see it on the screen.

#

This is my code

class Button:
    def __init__(self, surf: Surface, text: str, coords: Tuple[int], size: Tuple[int], bg='black'):
        self.x, self.y = coords
        self.width, self.height = size
        self.text = text
        self.font = pygame.font.Font('assets/fonts/playfair_italic.ttf', 30)
        # Make a rectangle for the button
        self.rect = pygame.Rect(self.x, self.y, self.width, self.height)
        self.surface = surf
        self.bg = bg
        self.clicked = False
    

    def draw(self, border=False):
        # Draw the button
        self.textBox = self.font.render(self.text, True, (0, 0, 255), self.bg)
        self.size = self.textBox.get_size()
        pygame.draw.rect(self.surface, (0, 0, 0), self.rect)
        # Draw the border
        if border:
            pygame.draw.rect(self.surface, (255, 255, 255), self.rect, 1)
        self.surface.blit(self.textBox, (self.x + self.width / 2 - self.font.size(self.text)[0] / 2, self.y + self.height / 2 - self.font.size(self.text)[1] / 2))
frank fieldBOT
#

Hey @keen valve!

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

blissful goblet
#

this started off as trying to draw a cat and now idk where im going with it

#

how tf do legs work

blissful goblet
#

animal following you 🤔

#

i think i got the legs kinda working

#

idk i give up

dawn quiver
ripe marsh
#

I have already dealt with this problem

icy valve
#

hey guys im searching if some one know how to create, open and write plain text archives to save simple data as arrays

frank fieldBOT
#

Hey @icy valve!

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

icy valve
#

im using pickle but it saves the data in binary files and i tink i cant edit whit git if i want to retur to a older version of the IA

icy valve
#

from what i've read it means i can configurated pickle to save in an simple .txt?

patent goblet
#

@ripe marsh Dude, what's the name of the program you're using?

hazy cliff
gentle mauve
ornate inlet
#

join this vc

still flicker
#

hey legends
im super slow and idk how to return this function and use 'guess' and 'answer' can someone help?

def update_history(history: tuple[tuple[str, str], ...], guess: str,
                   answer: str) -> tuple[tuple[str, str], ...]:
rustic valve
glass haven
#

I game developer

#

I make game

#

About Vlad and Alexey

#

In Russia

#

Name CyberVkid228

snow hill
dawn quiver
#

noise generated caves(black)

icy valve
#

hello guys i want some help about how to make an very specific part por a python game

#

i want to encrypt just part of the source code of some characters because there are the dialogs of every character and i dont want the pepole spolier them self

meager knoll
#

Hi. Can anyone help me with an idea how calulate value which will help change position Y from text? If needed i can drop whole code. Im trying to do it in ursina engine (which is build on panda3d)
https://pastebin.com/H48T1jsb

potent ice
icy valve
#

well nothing but at least they will not blame if they get spoiled of the story

#

i want to encrypt the code whit out lose funtionality in the whole program

potent ice
#

It can work if you have a server and a client and the server sends keys on demand to decrypt some text

#

It's not unusual for games to do this. For example encrypting items data on the client

icy valve
#

if this could be virtually imposible to unencrypt by no dev pepole could be the best tbecause i want the characters dont be trated as tings i want they fell real but if they can see all the dialogs then the magic is gone

icy valve
#

lets called a semi open source game writed in python

#

the players can make all the changes they want in the code but they cant see the scource code of the characters ill made

#

i tried making the code inside of a image whit steghide

#

but it has to be so hard to work propelly than the code to make that works was 20 times biger than the character code

potent ice
#

The weakness is that only one person needs to figure this out and then it's all open

#

You could do weird stuff like getting a sha256 of some file and use that as key to encrypt things?

#

To be honest I don't thing that would be any safer than just base64 encoding the text

#

Unless you are doing some heavy code obfuscation when building the game

#

For example with Nutika

sinful lodge
potent ice
#

Nothing wrong with just scrambling data, but I wouldn't put that much energy into it. 99.9% of the users won't know how to unscramble it.

icy valve
#

@potent ice @sinful lodge And I down want anybody get the information for another's

#

It's like the case of FNAF or pops playtime if I want to keep the story in secret it's for keep the players aware of his actions not only for the spoilers

#

If someone doesn't care about the spoilers but he want to solve the mystery it brokers the experience for the rest of players I want the game be played as it has to be

#

And also as I don't know how to make an executable game all I can made it's a .py format

sinful lodge
#

anything that you can unscramble client-side should be able to be unscrambled by the clien t as well

icy valve
#

it could be but i cant aford a web server or making my wabe only bia accesible whit web serving

#

and what hapends if the player loses his internet conection?

sinful lodge
#

which is why i'm saying this is a strange problem, anything you wanna keep 100% secret shouldn't be stored client-side

#

but you could always encrypt the data

icy valve
#

the alternatibe is maybe i can encrypt all the source code to make all inaccesible

#

because all the game are like 1000 lines of code in only one python script

sinful lodge
icy valve
#

and is full based in text whit no libraries

#

you cant just compile the python code and then run it like an normal .exe?

#

or like an binary file of c++?

sinful lodge
#

if you absolutely must keep the stuff secret from the user, afaik you can only store it on a web server/some backend

#

you can always host that web server/backend on replit

icy valve
#

damit so there is also not 100% unecryption proof?

sinful lodge
#

if something can be encrypted it's going to be possible to decrypt it, HASHING is different though, but it wouldn't work for what you're asking

icy valve
#

well i tink maybe i have to forgot the mystery in my game and focus in the adictive gameplay instead

#

you wanna try the game?

frank fieldBOT
feral plaza
#

is there anyway to ask questions in pygame and then let the user type in their answer?

median timber
ornate pivot
#

is tkinter good for making a game window or is there another lib i should use

potent ice
#

If can do some crazy stuff of course if you dig into things on the OS level manually setting the window or widget framebuffer, but that's a pretty complicated affair.

white vector
#

this looks like both a gui and a cli at the same time

blissful goblet
#

is there a cleaner way to get a top 5 list split by guilds, i start with a structure which is {guild id: {#1 player id: score, #2 player id: score}} then whenever someones score (generated) changes i use this code:

if player.guild not in guild_gen_rank:
    guild_gen_rank[player.guild] = {player.id: player.generated}
else:
    temp_ggr = guild_gen_rank[player.guild].items()
    for count, tup in enumerate(temp_ggr):
        _, generated = tup
        if player.generated > generated:
            temp_ggr.insert(count, (player.id, player.generated))
            guild_gen_rank[player.guild] = dict(temp_ggr[:5])
            break```
foggy gulch
#

How do I get global ports into a python socket? To be able to connect from another computer

snow hill
void ivy
#

anyone know how to use collision detection for maze generated using DFS? Need to identify and establish walls, so player cant go through them

silver cargo
#

what is the best framework for beginners to start

frozen knoll
#

You'll get a lot of opinions on that.

#

I'll recommend Arcade. Pygame is popular too.

void ivy
#

@frozen knoll thanks

sinful lodge
snow hill
#

We have a dozen more to come

sinful lodge
snow hill
#

Do you think it would help ?

#

(Sorry for the naive question)

#

Ah yeah :)))

#

I see you former nickname now 🙂

#

I had in mind you had a preference for text tutorials though

#

These tutorials are made by Thomas, one of your team mates who implemented a short API to make Harfang more easy to use

sinful lodge
tidal egret
#

anybody here familiar with renpy ?

rigid ferry
#

opinions on ursina?

random roost
#

anyone know if kivy works on 3ds?

potent ice
# random roost anyone know if kivy works on 3ds?

It can definitely do 3D. It's using opengl es. However, I don't know if there's any higher level support for it, but you can definitely crank out some shaders doing that. If I know the Kivy community right there's at least something.

potent ice
potent ice
random roost
#

Ok, so can I use Kivy to create a game for the Nintendo 3DS?

#

idk how to be more specific

potent ice
#

According to kivy.org

Kivy runs on Linux, Windows, OS X, Android, iOS, and Raspberry Pi. You can run the same code on all supported platforms.

random roost
#

mhm.. but it also says this:
With Kivy, you can create apps that run on:

Any other touch-enabled professional/homebrew devices supporting TUIO (Tangible User Interface Objects).

#

is there not a 3rd party lib or something to make kivy work on 3ds?

potent ice
#

I would imagine the Nintendo 3DS platform is very different unless it's based on some android version. I have no idea. Can always jump into Kivy discord.

random roost
#

got a link?

potent ice
hybrid burrow
#

Hi, Do you have any libraries to recommend, when it comes to 3d development?

hybrid burrow
#

I've tried ursina

#

And I want to go a little bit futher

gray cedar
#

anyone know python

#

*pygame

normal silo
# hybrid burrow And I want to go a little bit futher

Using Panda3D directly can get you all the way down to low level. Unless you want to use OpenGL / DirectX / etc directly (kind of no point (unless you really know what you are doing / or for education), you will end up just making a copy of Panda3D at that point).

#

It's a full 3D/2D game engine. It can do whatever.

#

It's also mature.

potent ice
#

Definitely look at Panda3D. That's a nice next step after urina anyway since ursina is using panda3d

#

You can pick apart ursina to expore how it's working

normal silo
#

Panda3D has far above average documentation for an open source project too.

potent ice
#

It's better than spending 5 years making your own game engine/renderer that would probably be worse than panda3d

#

Going down to GL / Vulkan can work if you have very simple needs.

normal silo
#

It's not even that it's better or worse, it's just that consider now wanting to work with others. What do you do? They have to learn a whole new thing if using your custom engine.

#

Same reason everyone uses Unity or Unreal now. You can be on the same page.

#

*Also Panda3D being tested on projects already, while your custom engine is an unknown as to whether or not it will work out in practice.

#

**Still there are times when a custom engine is not a bad idea. But that's a bit hard to explain (when and when not). So for beginners it does not really make sense unless you want to learn how game engines work in depth / maybe you want to contribute to something like Panda3D or work on Unity, etc.

foggy python
#

made in 48 hours for the Ludum Dare

raw shadow
#

ofc its not, making an exploit is only legal when the opposing party which said exploit damages thier property consent to the development and usage of said exploit, seeing as i know the individual that employed you to make this cheat probably has malicious intent behind this "cheat" i highly recommend you not attempt this because its highly unethical and probably highly illegal.

raw shadow
raw shadow
raw shadow
#

i also saw your tutorials on youtube, your advice being " understand the problem and figure out ways it works and try to conceptualise them" because i've seen many individuals talk about "how limited pygame is" but your advice totally breaks down those conceptions of limitations just because pygame is a simple direct layer of graphics. the "particle" video is a must watch for all developers aspiring for 2d pixel art game developers.

dawn quiver
#

lol, i cant sent any messages anymore to the job offerer

icy valve
#

hey guys i have a question. how reliable is traslate a python proyect into a unity vr project?

#

im making a prototype of the mecanics and world in a 2d vision but the game works in 3d

#

im just playing whit the code and evertings looks good so i have to finish the bots and then move my 3d matematical model to unity which i never touched before

sullen wagon
#

please don't discuss this here, it breaks our rules on posting job advertisements and malicious projects

dawn quiver
#

ooh sorry

icy valve
#

@sullen wagon do you mean me or aeternus?

sullen wagon
#

not you

dawn quiver
icy valve
#

@dawn quiver are you working on a project? about what?

icy valve
#

comoon im searhin for coders friend to learn about

#

im breaking my shell to meet pepole

ocean lichen
#

Hey guys i need some help. Im creating a text based game. i've given the player 4 options on "Classes" and im looking how to recall which option the player has chosen to move forward with the story. I know this is abit vague so here is the code im talking about

        slowprint(f"So you have chosen the Berskerer is that right?: \n", 0.5)
        bb = input(f"Yes/No: ")
    elif choose_class == '2':
        slowprint(f"So you have chosen the Sniper is that right?: \n", 0.5)
        sn = input(f"Yes/No: ")
    elif choose_class == '3':
        slowprint(f"So you have chosen the Scientist is that right?: \n", 0.5)
        s = input(f"Yes/No: ")
    elif choose_class == '4':
        slowprint(f"So you have chosen the Animal handeler is that right?: \n")
        ah = input(f"Yes/No: ") ```

like how do i get the players choice from the variable so i can recall their choice later. sorry if this is the wrong channel
icy valve
#

@ocean lichen i tink its the correct chanell

#

well like i can see in your code it still very raw

#

you have to do 1 of 2 tings

ocean lichen
#

Yeah it is xD i've only been coding for a couple of week and this is my first solo attempt

icy valve
#

1 make a universal and imutable tree of elections and events(which is very extensive and long and very low reliable)

raw shadow
#

lol what?

icy valve
#

or 2 make modificators whic will keep the story going and mark the important choices for the future

icy valve
#

better dont use elif or if you have to make it more clean

#

and complex

raw shadow
#

complex?

#

dont need it to be complex

#

what's wrong with it

ocean lichen
#

So if i change my elif to if how would i recall the players choice? after the fact

icy valve
#

for example i made a lets call it "bitcoin simulator" and its only 1000 lines of code

raw shadow
#

is that your full code?

icy valve
#

that its not very complex but not very simple too

#

yea less than 1000 is the full game in 1 archive

raw shadow
#

complex code != better code

dawn quiver
raw shadow
#

complex code == harder to read code

icy valve
#

of course be complex its not the solution its make the code escalable

#

scalable is the word i was wanting to use

#

my game its like a tetris all based in text but i later will ad some story and more mecanics

ocean lichen
raw shadow
#

its extrememly elementary, i dont think they need to impliment a design pattern xD

#

i get your point and you're not incorrect

#

also wdym how to recall the play's input

ocean lichen
#

ive done the best i can xD but yeah i've got a lot of stuff to learn

raw shadow
#

if you got the players input then its there, it doesnt expire

icy valve
#

whit variable = input("give me you election player")

ocean lichen
#

so their is choice 1 - 2 - 3 - 4 for the classes how would i be able to recall what the player has chosen to refer to it later, rather then making my if statements huge

raw shadow
#

what do you mean

#

you literally asked for input from the player

#

why cant you use that

#

just use the variable again

#

choose_class = input(f"Choose: ")

icy valve
#

using elif nest the next elif inside the last if one

raw shadow
#

you asked for the input

ocean lichen
#

i think im maybe confusing myself and you guys

raw shadow
#

yeah you used elif, meaning you terminate the posibility of other ifs,

raw shadow
#

because you've defined the player's input as a variable and have worked with it thoroughly within the main loop

#

class start(): should be def start():

ocean lichen
#

their isnt an error, the code runs ok, so what you saying is the choose_class var will register the players choose and i'd only need to refer to choose_class as i continue?

raw shadow
#

yes

ocean lichen
#

i get you

#

their is a second question if you have time, it will help me tidy up my code abit.

raw shadow
#

chose_class variable is put into memory, it stays defined as long as the game is running

#

your "classes" should use a dictionary

#

are all the attributes the same but just different values?

#

you've just defined them with different names because of nameerror right?

#

you can use a "python class" for the play classes

#

a class is something difficult to understand but if you know what a class is, you should make a class called "Atributes" and then inherit from it into the berserker class

#

and etc

#

but only if you understand what it will do

icy valve
raw shadow
#

otherwise a dictionary will do fine to store the attributes

ocean lichen
#

Ill look into that, the next question that i have is. if you look at my paste in you can see i've reused the same set of "player options (refer to the end of my code) how could i recall the options of 1 - 2 - 3 - 4 - 5 after the player has select option '5' so after seeing the stats of the classes they can then choose one.

raw shadow
#

okay

#

for the 5th time

#

choose_class is defined as a variable, you can refer to it anytime ,anywhere after its been defined

#

if you want to "redefined" choose_class

#

you can redefine it

#

by simly

choose_class = input()
#

oh

#

wait i think i understand what you mean

ocean lichen
#

so how could i recall that choose_class var to rerun the options. after they have selected option 5 and seen the stats? print(choose_class())?

raw shadow
#

a player can say "1, 2 3 or 4" multiple times?

#

and depending on what they press, something is effected?

#

no its not xD its just a choice

ocean lichen
#

ill try and be as detailed as i can here. one second

raw shadow
#

wait, if this is an rpg game, i think you're going at it, the right way but there's things you can improve

ocean lichen
#

The player has come to choosing a class and is presented with 5 options. The player has chosen option 5 to see the stats of each class. how after seeing the stats can i then rerun the options for the player to then choose which class they want. without repasting the whole code again. can i rerun the code

raw shadow
#

using if statements that many times isnt good

ocean lichen
#

should i maybe use a class function and define the player options to return to it?

raw shadow
#

you should have a main game loop in which there's not much visible code and most of the functionliaty is handled by functions that are called upon user input

ocean lichen
#

if that makes sense. i know my code talk is abit gibberish

raw shadow
#

yeah, making a player object is good

#

yk what a object is right?

ocean lichen
#

Yeah

raw shadow
#
class Student:
  def __init__(self, name, age):
      self.name = name
      self.age = age
  def show_details(self):
      print(self.name, self.age)
rick = Student("rick", 16)
rick.show_details()

>>> "rick, 16"
#

you can do the same for a player

ocean lichen
#

I think i can see where i've gone wrong, i've made this so much complicated then it needs to be. which is probably why im confusing myself

raw shadow
#

all that code can be avoided by one class xD

#

you can make a player have attributes

#

those attributes effect other objects

#
class player_class:
  speed = 0
  attack = 0
  health_points = 0
  rs = 0
  ms = 0
  charisma = 0
  ah = 0

class Breserker(player_class):
  def __init__(self, name):
    self.name = name
    
  def set_attributes(self):
    speed = 8
    attack = 3
    health_points = 8
    rs = 1
    ms = 8
    charisma = 8
    ah = 2

getting_gold = Breserker("GettingGold")

print(getting_gold.speed)
  
#

that can seem like complex code but its making objects on inital values, therefore you can have scoped definition of attributes

#

and in order to make more and more kinds of classes of players you can "inherit" that player_class and adjust the attributes

ocean lichen
#
  def __init__(self, , name, str, agi, hp):
      self.name = name
      self.str = str
      self.age = agi
      self.hp = hp
  def show_details(self):
      print(self.name, self.str self.agi, self.hp)
warrior = Student("Warrior", "str: 8", "agi: 4", "hp: 9")
warrior.show_details()

>>> "Warrior, str: 8, agi: 4, hp: 9" ``` 

something like this? i would create a class for each "Class" and then def the attributed underneath to recall later?
raw shadow
ocean lichen
#

yeah im with you. ill rename it specs or something 😄 and thanks for the help thats alot clearer now

raw shadow
#

mine is more complex, yours is better for you, mine is used for a bigger game design but yours is good because you can understand what you write

ocean lichen
#

no i understand what yours does and how to use it, i can read and maniplute codes pretty well. but writing them from memory is abit of an issue at the min lol

raw shadow
#

that's why mine has a player_class which defines attributes and allows for inital values for a class so that if theres a new player, if you get to the stage where you have multiple save files, you can easily start a new game with a player class

#

glad you know oop

#

im gonna stay online, try to impliment the oop

#

also get a github, makes it easy for others to easily work on your code with you

ocean lichen
#

i've made one, ill have to learn how to post to it xD maybe should of started with that to make things abit easier. Cheers bud appreciate your time.

random roost
#

hiya

#

so uhh

#

whats a good guide for pygame?

#

i cant find a decent on

#

e

#

ive tried going into the docs and make just a simple rectangle that moves left and right using the arrow keys but the docs are confusing a bit

potent ice
eternal monolith
#

can anyone help me with this one?

#

please make it simple it doesnt matter if it doesnt work.

ocean hornet
# eternal monolith
import random

xmen_array = []
random_xmen_array = []
print("Welcome to the x-man battle simulator")

for i in range(2):
    random_xmen = random.choice(xmen_array)
    random_xmen_array.append(random_xmen)

print(random_xmen_array[0] + " is battling " + random_xmen_array[1]) 
#

Idk

#

but is this what your looking for???

sour cobalt
#

booooooleeet hell

#

i legit made those 6 attacks

#

using the same attack function

#

and just some minor number changes and maybe like 1 line of code addition on avg per attack

mental jetty
#
C:\Python\Pygame\Ms. Martin Game>py main.py
Traceback (most recent call last):
  File "C:\Python\Pygame\Ms. Martin Game\main.py", line 1, in <module>
    import pygame, time, random, sys, numpy
ModuleNotFoundError: No module named 'pygame'

anybody else tends to get these errors by chance?

#

the module is installed bt

sinful lodge
sour cobalt
#

Nah LOL

true ridge
mental jetty
#

i have the correct version

#

I figured it out btw

#

it's because i have both python 3.10 and 3.9 installed simultaneously

true ridge
#

yeah i had pretty similar problem with tkinter few months ago

hybrid burrow
#

What courses, pages, and videos do you recommend for ursina?

grand apex
rigid ferry
#

what is the biggest python flaw for game development?

true ridge
rigid ferry
#

i already knew that, but, is that it?

true ridge
#

yep, its pretty big problem for bigger games, python is useles for making some sort of professional games, but for small games made by one person it should be completely fine

potent ice
sour cobalt
#

i mean maybe for games which have like 0 stress on computer than maybe it has some use

scenic dome
#

Anyone here interested in sharing their game concept? Bounce ideas around?

round obsidian
#

I mashed up Robotron 2084 with Conway's Game Of Life @scenic dome

scenic dome
#

@round obsidian: Do you shoot gliders at enemies?

round obsidian
scenic dome
#

Oh wow it really feels like a retro gaming! (Except for the fact that no 80's atari rig could do that.

#

Do the enemies interact with the conway also?

sour cobalt
dawn quiver
rigid ferry
frank fieldBOT
#

Hey @void ivy!

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

void ivy
#

what does : AttributeError: partially initialized module 'arcade' has no attribute 'Window' (most likely due to a circular
import) mean?

potent ice
#

Did you by any chance make a file called arcade.py?

void ivy
potent ice
#

I'm waiting

void ivy
#

what do i do after i have pasted it?

potent ice
#

You press the save icon and paste the url here

void ivy
#

alr, lemme do that

#

this work?

potent ice
#

yes

#

What is the name of the file you pasted here?

void ivy
#

it is saved in a folder called Games

#

vsc

potent ice
#

import random

#

and your module is called random.py

void ivy
#

ooooooooh

#

oh thanks

#

i see the problem

#

thanks

potent ice
#

The error message you got is confusing though

void ivy
#

i was so confused

#

it works, thanks for the help

untold sentinel
#

What sort of game engines is there for python these days?

rigid ferry
untold sentinel
rigid ferry
#

at least is't windows exclusive...

olive parcel
dawn quiver
#

what all modules are good to use if i wanna create a simple game(2D)

trail yarrow
round obsidian
steep temple
#

yo im making an SOS game sorta like tic tac toe using tkinter, does anyone know how to make a dynamic game board using user input?

raw shadow
#

use the board values be arguments so that everytime the board is created, the values are different and dependant on the values being passed as args

#

like this

def board(1,2,3,4,5,6,7,8,9):
  print(f"|{1}|{2}|{3}")
  print(f"------")
  print(f"{4}|{5}|{6}")
  print(f"------")
  print(f"{7}|{8}|{9}")
#

then when you call it, the values will be dependant on your value states

#

like if the player selected 1, 2, or 5

raw shadow
# dawn quiver That's cool

pygame is the best, SDL2 is a C (c language) library for graphics and visual software. Pygame is a native wrapper for SDL2. I personally belive that SDL2 and pygame are the best that 2d development has to offer

dawn quiver
#

So what about 3d

#

And where can I install modules

cinder mist
#

I was following tech with tim's paint app in pygame. How do I save a screenshot of only the grid area?

azure atlas
#

yall seen the new epic games app

#

realityscan

#

its so cool

#

basically you take pictures of objects and you can upload it to your game as a 3d model

azure atlas
#

i donnu i hope it works for other stuff

#

but tbh that thing should've existed long time ago

#

the only reason i dont make games is the lack of models and assets

tranquil girder
dawn quiver
rigid ferry
#

usually, what is the best way to handle multiple levels in game? do you make a an "abstract" class, and when you need to load a particular level, create an object

frozen knoll
#

But depending on your game logic, that can all be different.

rigid ferry
#

true, i'm making a 1943 clone, so my levels need a custom background, some randomly generated decoration like island for pacific themed levels, cloud cover, style of enemies stuff like that

#

it's a bit of a mess, but i'm working on it @frozen knoll

robust rapids
#

hello

wheat dune
#

Hey, can anyone help me?
I am making a 3d engine which is going on pretty well so far.
Currently I am trying to implement sphere and box collision. Can anyone help me how to do it? I can quite figure it out.
My implementation so far:

    # Recieves a cube (c), sphere center point (c_center) and a sphere radius (s_radius)
    def check_collision(c, s_center, s_radius):
        center_distances = c.center - s_center
        distances = c.dimensions + s_radius
        if (-distances[1] < center_distances[1] < distances[1]) and \
                (-distances[0] < center_distances[0] < distances[0]) and \
                (-distances[2] < center_distances[2] < distances[2]):
            return True
        return False
sly iron
#

I'm trying to create a basic space invaders game in Python, and I have ran into this error using pygame

#

Basically, I try to run it but there is an error trying to load the files from github.

#

My IDE is replit, and I need to know a fix to this problem.

bitter blaze
#

oh gawd what have i done

#

i have a problem

dawn quiver
#

lmao

vagrant spear
#

my little game-server)

dawn quiver
#

Hi, not even a beginner at game dev but in the unreal engine 5 keynote, I saw Epic mention python in their tutorial forum

#

quick google searches showed you can use python for scripting but not in real time

#

I have very little clue what that means, if anyone could tell me what this is about. cause it seems interesting

#

being able to use python in Unreal without messing with C++, if its true

potent ice
#

I'm guessing python is more used on the tools and asset pipeline side. This is very common with productions dealing with lots of assets. Games, animation, film etc etc

dawn quiver
#

it does mention something about importing a module called unreal that can be used to link with blueprints just like how C++ does

rigid ferry
#

can multithreading be useful for handle multiple enemies actions in a game?

hollow delta
outer cloak
#

Hey I am new to python discord saw YouTube video what are the competitions that take place and how will I get to know.?

heavy pond
hollow delta
hollow delta
teal ember
#

oh thats neat

hollow delta
#

Thanks a lot

frank fieldBOT
#

Hey @keen valve!

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

#

Hey @keen valve!

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

ancient onyx
#

would python really be great for a heavy story-driven platformer or a multi-path QTE action? if not, what language?

sharp rover
#

hello there, how can i save some variable data into my pygame project? DM me in private chat if u can teach me! 😄

north bridge
#

!e print(“Hello World”)

#

!e print("Hello World")

frank fieldBOT
#

@north bridge :white_check_mark: Your eval job has completed with return code 0.

Hello World
north bridge
#

!e

for i in range(1,5):
     print(i)```
frank fieldBOT
#

@north bridge :white_check_mark: Your eval job has completed with return code 0.

001 | 1
002 | 2
003 | 3
004 | 4
hasty walrus
#

for K in range(1,9):
print(K)

sour cobalt
#

!e x = 5

frank fieldBOT
#

@sour cobalt :warning: Your eval job has completed with return code 0.

[No output]
junior tangle
junior tangle
#

just wandering when pygame is better, and when pyglet

potent ice
#

You can do a lot with these libraries if you know how to write efficient code.

junior tangle
#

Thx a lot

pale light
#

My sister just started developing games And I want to help her
if you can guys Give me some tips to help her get started

junior tangle
# pale light My sister just started developing games And I want to help her if you can guys G...

Youtube pygame tutorials work for me, this one is very clear imo - https://youtu.be/FfWpgLFMI7w

Learn how to use Pygame to code games with Python. In this full tutorial course, you will learn Pygame by building a space invaders game. The course will help you understand the main game development concepts like moving characters, shooting bullets, and more.

💻 Code: https://github.com/attreyabhatt/Space-Invaders-Pygame

🎥 Course created by bu...

▶ Play video
paper tartan
#

Hi can someone explain me why it's still saying that pygame "could not be resolved" even if I download it ?

sour cobalt
jade owl
#

@ornate blade

#

Take a look in the console, you'll see that the 2 in 2 cards is yellow

#

I'm super proud of it

ornate blade
#

I can tell. The code looks like some real effort was put in.

jade owl
#

this took a while to do, and for it being my first OOP-based work, I'm happy with how it turned out

#

Also: