#game-development

1 messages · Page 77 of 1

low shadow
#

then to parse it and get the info u just need a lib to read it
so u can pretty much use it anywhere

potent ice
#

yeah 🙂

#

There are even plugins for Unity and UE for those I think

low shadow
#

@potent ice do u try using : ) and it gets translated to 🙂?

potent ice
#

?

blissful depot
#

🙂

#

oh

#

cool

low shadow
#

do u try using the text and then it translates to emoji

#

?

blissful depot
#

🙂

#

::::::::))))))))

low shadow
#

: ) feels good
🙂 feels soo dangerous

blissful depot
#

ok

#

: )

potent ice
blissful depot
#

I am thinking about learning Ar...ca...de..?

potent ice
#

You can do that in pygame as well, just a bit more work

blissful depot
#

huh

dawn quiver
#

hi guys

#

i need help

low shadow
# blissful depot I am thinking about learning Ar...ca...de..?

yup ig its fine
ive only used pygame and u pretty much have the most basic features in it
like drawing lines and boxes
so ull learn more with pygame, but it will take time and ull gain some skills u probably wont use ever
but arcade will be faster to learn and easier to use ig

low shadow
dawn quiver
#

with pyhon

#

it's school homework

#

are you good at that?

blissful depot
#

um... does it have to do with game dev?

dawn quiver
#

nope

blissful depot
#

cuz this is a game dev chat

dawn quiver
#

oh sorry

blissful depot
#

'tis ok

low shadow
#

send it in anyways

blissful depot
#

you can try claiming a help channel

dawn quiver
#

cya then/:

blissful depot
dawn quiver
#

bc it's like 25 questions

blissful depot
#

Matters who

dawn quiver
#

😕

low shadow
#

is it school homework?

blissful depot
#

BTW I am a noob so don't ask me

dawn quiver
low shadow
#

im pretty trash too, but someone will help

dawn quiver
#

oh ok

#

cya, stay safe!

blissful depot
#

ok

low shadow
# dawn quiver oh ok

yo u the dude who puts
"to whomever may read this, have a nice day"
in the end of every yt vid?

blissful depot
#

@dawn quiver you can either try claiming a help channel (and sometimes if the questions are about the same code you can ask your other ones in that same channel) or try the #python-discussion if they are smaller questions

low shadow
#

hmmmm sus as hell

#

lol

low shadow
blissful depot
#

yeah

low shadow
#

theyll tell u to do it on your own

#

and ask if u r stuck

blissful depot
#

yeah but sometimes it is fine

low shadow
#

ig

blissful depot
#

usually you don't say that it is homework

#

but ok

#

anyways

#

gtg

low shadow
#

bye man

#

i need to sleep lol.
its 5AM here

blissful depot
#

thanks @low shadow and @potent ice !

potent ice
#

I think when choosing a library you should spend some time looking though the documentation and examples

#

Then you will get a better feeling what the library is about

dawn quiver
#

@potent ice

#

sorry for the ping but it was the only way to contact you

#

are you there?

potent ice
#

yes?

#

You can just type the question. No need ping.

dawn quiver
#

oh ok

#

i want to make a game

#

but idk how

#

can you help me with that?

signal bramble
#

learn a language

#

😄

#

no but really, what do you know about making games?

dawn quiver
#

nothing

#

i know the design

#

but not to code

signal bramble
#

do you know a programming language?

dawn quiver
#

nope

signal bramble
#

I would start there

dawn quiver
#

can you teach me?

proud fern
signal bramble
#

No, there are many resources on the internet and I'm sure there are schools around you that could help you

dawn quiver
#

thx

#

i appreciate it(;

potent ice
#

Find some beginner tutorial

#

free books

#

Or seek out the official docs for either of these projects

signal bramble
#

What's a good place to find riddles or puzzles to solve that I can add to my game?

blissful depot
thorn grail
#

hello

gleaming zealot
#

einarf, any idea on how to fix the overlining of pieces?

gleaming zealot
#
def vinnare():
    drag = [x for x, letter in enumerate(spelbord) if letter == '' and x != 0]
    move = 0

    for drag2 in ['O', 'X']:
        for i in drag:
            spelBord2 = spelBord[:]
            spelBord2 [i] = drag2
            if isWinner(spelBord2, let):
                move = i
                return move```
#

@potent ice sorry for tagging but how does that look?

plucky bramble
#

yo

#

im not really using any particular framework, just vanilla python

#

im new to game dev stuff and i want to make a turn based game

#

i can create an actor function for entities like the player and enemies

#

but how would i go about designing the actual battle/gameplay loop

dawn quiver
#

but which website can i use to make a game?

potent ice
#

What kind of game?

dawn quiver
#

a really simple one

potent ice
#

So a 3D game?

dawn quiver
#

yes

#

correct

#

but where?

potent ice
#

Or you can use Panda3D directly

#

That's at least the easiest way to make that kind of game with python

#

You can use other game/graphics libraries as well, but those are more low level (more effort)

#

If you have never worked with 3D before and find this very difficult you might want to try something 2D first 🙂

#

There is a Panda3D discord server as well

dawn quiver
#

oh ok

#

thx!

civic kernel
#

hi

#

anyone here

#

i wanted to learn python game development so i came here

potent ice
#

A lot of the concepts there translates well to other game / graphics libraries as well

gleaming zealot
#

einar

#

ive made a lot of improvements

#

been awake for a long time

#

but now this error comes up line 117, in Manniska pjaser(-280,80)
TypeError: 'list' object is not callable

dawn quiver
#

does anyone know what is the best software I should use to create pixel art?

gleaming zealot
#

does anyone know how i can fix this xD

dawn quiver
#

oof

#

fix positions

gleaming zealot
#

ive tried

#

no sucess

#

can u check it out if i send a hastebin?

dawn quiver
#

im not that good

#

but i may try

gleaming zealot
#

okie

dawn quiver
#

nvm too complex for me

#

sry

gleaming zealot
#

okie thanks anyways

tawny venture
#

Hi ! Sorry to disturb you all but I have a quick question : How can we replicate a cmd-style shell of our own in Python ?

vast halo
#

Hello, I have a sudoku.py file that works on someones computer(Mac OS) and it doesn't work on mine (Windows)

low shadow
gleaming zealot
#

okay 1 sec bro

low shadow
low shadow
gleaming zealot
#

i appreciate it a lot honestly, more than you think thank you very much!

gleaming zealot
#

@low shadow hello, how did it go?

surreal talon
#

Hello everyone. Im currently working on game in pygame. But Im sort of stuck. I need to rotate a image so that its facing the mouse cursor. In other words I need to calculate the what the angle of the mouse is and then rotate the image. Ive done the rotating bit, its just working out the angle of the mouse now. Any ideas would be great!

fickle lion
#

I have same issue in my project, I am using 2 vectors for rotation. try again with vectors, You wrote angel = pos[1] I think pos[1] not a angle so you cant use it for angle.

low shadow
#

and i dont understand the comments. I dont know the language you have used
so it will take me some time to analyse the code properly too

gleaming zealot
#

its fine no need ill try to get help from someone else, thank you a lot for trying atleast, its urgent thats why xD

low shadow
low shadow
surreal talon
fickle lion
#

@gleaming zealot knk Turtle ile pygame arasında ne fark var ?

low shadow
#

but ill tell you what u should do

#

u should first calculate difference b/w sprite and mouse pointer's x and y pos

#

then you should divide y/x

#

then fin tan inverse of mod of that

btw mod means only positive
so if its -5, its mod is 5
if its 5, its mod is 5

#

that should give you the angle with respect to the x-axis

gleaming zealot
#

@fickle lion sorry i dont understand

frozen knoll
blissful depot
#

There is a downloadable version though

#

Anyways, can I load a gif with pygame?

#

cuz that would save lots of time

blissful depot
vast delta
patent pecan
#

Hi guys, I tried to make a simple game in which a player can shoot after a 3 seconds countdown to increase his score. However, if the player shoots, before the countdown ends, I want him to get minus points at his score. Everything is working fine, however I have one problem: I tried to deal with the countdown with a simple "time.sleep()" function, however, while I was running the "if" statement, the player was unable to shoot... can anyone help me? Im using pygame...

waiting = True

if event.type == pygame.KEYUP:

#If the player presses "g" the game begins

    **if event.key == pygame.K_g:**
        **pygame.time.wait(1000)**
        **print("3")**
        **pygame.time.wait(1000)**
        **print("2")**
        **pygame.time.wait(1000)**
        **print("1")**
        **pygame.time.wait(1000)**
        **print("GO")**
        **waiting = False**

#If the player shoots while "waiting" is true, he gets points subtracted

**if waiting:**
    **score_value -= 1**
**else:**
    **score_value += 1**

The countdown works, but while it is running, the player is unable to shoot bullets... Can anyone help?

frank fieldBOT
#

Hey @dawn quiver!

It looks like you tried to attach file type(s) that we do not allow (.exe). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.

Feel free to ask in #community-meta if you think this is a mistake.

gleaming zealot
#

Ive made a game, human vs bot but the bot doesnt seem to start what code do i put in, i want the human to activate the bot after placing a piece

dawn quiver
#

sorry, i don't know pygame, only pygame 0

#

my game:

#

my entry for pyweek30

gleaming zealot
#

thats not pygame

#

thats turtle

dawn quiver
#

oh, pygame is better

#

did u play my game?

gleaming zealot
#

not interessted rn im having a mental breakdown not being able to solve this issue

dawn quiver
#

i can't make good games on turtle

gleaming zealot
#

can you solve my problem?

dawn quiver
#

um, can u send me ur code?

severe saffron
#

it's fairly simple trigonometry, but idk how much you've done

#

and it's harder to figure out when it's code

modern marsh
#

hi

#

any game engine

#

2020

#

that uses python

bold nacelle
#

hi so like, ive tried out ursina, installed it using terminal but for some reason when i go to pycharm and try to import it, pycharm cant find the ursina module or whatever, it worked earlier(idk how but when i did import ursina it managed to work), but i had a problem and decided to restart, and i cant get it to work again.

#

really gives me a headache

fickle lion
#

it is probably at incorrect path

#

I dont know exactly

blissful depot
atomic mural
#

so i making a game and i need to do onscreen help allready googled so i dont know what to do

#

im not very experianced with python

bold nacelle
fickle lion
#

@blissful depot yes possible

blissful depot
fickle lion
#

@atomic mural ?

#

@blissful depot this will help you

#

to understand

blissful depot
#

oh ok

#

thx

atomic mural
#

thats not answering my thing i need to like a help system

fickle lion
#

did you mean like help button?

#

@atomic mural

atomic mural
#

its a text based game on each scene it needs to display a help menu

fickle lion
#

I can't write entire steps but

#

you can use Pygame.surface to create menu

#

search it

atomic mural
#

but its not coded in py game

fickle lion
#

so idk. I am sorry

wheat ember
#

Hey

dawn quiver
#

if im trying to create a modular powerup system how do i reference the variable that im altering right now im using a constant defined in another file

#

would it be better to have 2 variables like

#

original stat = X

#

boosted_stat = 0

#

then whenevre the player gets a boost just alter boosted_stat

#

that way theres no bad referencing going on

#

also would appreciate any resources available on this im probably not doing a good job of explaning it and cant find much online in the way of tutorials

fickle glacier
#

can I make pygame press a key

gleaming zealot
#

Hello, ive made an X and O game, code for bot and code for player. The issue i have right now is that when i try to run it and play i both control the X and the O when im only supposed to control X, can someone look over this?

wet folio
#

Can you share your code?

gleaming zealot
#

Manniska() is X and i want Data() to be the bot playing against Manniska()

#

i know i need to make a function for it to work
but idk how

wet folio
#

Uh you're using turle, can't help you

#

anyway you really hate classes huh

gleaming zealot
bold nacelle
#

new problem: "IndentationError: unindent does not match any outer indentation" level this stupid error keeps popping up. i dont even have any spaces as indentation i just use tabs- and the worse part is: I DONT EVEN HAVE AN INDENT IN THIS LINE LIKE- BRUH!??!

#

or maybe im just dumb

tranquil girder
#

Looks like the next line is indented though

bold nacelle
#

ok yeah, the way i cropped it does look like its indented

#

but it isnt

low shadow
bold nacelle
#

app = Ursina()

test_square = Entity(model = 'quad', color = color.red, scale = (2,1), position = (3,4))

pp = load_texture('assets/Sans.png')
sans = Entity(model = 'quad', texture = pp)

test_cube = Test_button()

app.run()

low shadow
#

is it a multi file program or something?
if it is not, send the full code

bold nacelle
#

nope

#

okok

low shadow
#

and there is this one problem with sublime and the idle

#

the indentation blocks are not the same

bold nacelle
#

huh

low shadow
#

Sublime will take 1 tab as 4 spaces
but when u open the same file using idle, the tabs will be doubled

#

i used to get such errors a lott

#

then i had to set up sublime so that such errors dont occur

#

the pissing off part is ud have to re-indent the entire code so that it works again
and it takes forever

#

send the code in anyways tho

bold nacelle
#

from ursina import *

class Test_cube(Entity):
def init(self):
super().init(
model = 'cube',
color = color.blue,
texture = 'white_cube',
rotation = Vec3(45,45,45)
)

class Test_button(Button):
def init(self):
super().init(
parent = scene,
model = 'cube',
texture = 'brick',
color = color.green,
highlight_color = color.red
)

def update():
if held_keys['w']:
test_square.y += 4 * time.dt
if held_keys['s']:
test_square.y -= 4 * time.dt
if held_keys['a']:
test_square.x -= 4 * time.dt
if held_keys['d']:
test_square.x += 4 * time.dt

app = Ursina()

test_square = Entity(model = 'quad', color = color.red, scale = (2,1), position = (3,4))

pp = load_texture('assets/Sans.png')
sans = Entity(model = 'quad', texture = pp)

test_cube = Test_button()

app.run()

low shadow
#

lmao next time u paste code, use the dicord pasting code format thing

bold nacelle
#

oh yeah

#

srryyy

low shadow
#

chill

#

@bold nacelle

bold nacelle
#

yeah it does- the prob is that i cant get the sans texture 😦

low shadow
#

kk ill check

#

send sans.png

bold nacelle
bold nacelle
low shadow
low shadow
valid crane
#

Hi I've a problem with my code..

    print('login Successful')
else:
    print('login fail,please try again')
    while True:
        entered_user_name = input("Please enter the user name:")
        entered_user_name.title()
        entered_password = input("please enter your password:")
        if entered_user_name == 'abc' and entered_password == '123':
            print('login Successful')```
#

Can someone explain to me why it does not print login successful?

low shadow
#

go to settings<preferences

#

2 windows will open
the left one will be the default
the right one will be the part u can edit

#
"translate_tabs_to_spaces": true
#

add that thing

bold nacelle
#

okk

low shadow
#

kinda like this

#

and it should work ig

bold nacelle
bold nacelle
low shadow
#

hmm too bad
i am not sure if i can help

#

sry man

bold nacelle
#

itsokk

#

thx for the help tho

tranquil girder
#

maybe you can try ctrl+f and search for space, just to see if everything's ok

#

and make sure it's all spaces

bold nacelle
#

yep

#

all spaces

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.

dawn quiver
#

Hello, I need help with a python program. The goal of the program is to give a match list (to make a tournament) according to the number of teams. Except I don't have a clue how to do it, could you help me?

low shadow
low shadow
gleaming zealot
#
Traceback (most recent call last):
  File "/Users//Desktop/UPPG2_.py", line 460, in <module>
    Poang()
  File "/Users//Desktop/UPPG2_.py", line 402, in Poang
    Rad(-100+100*i,150,-100+100*i,-150,"red")
  File "/Users//Desktop/UPPG2_.py", line 382, in Rad
    turtle.pu()
  File "<string>", line 5, in pu
turtle.Terminator
>>> 
#

anyone?

tender kraken
#

how to do anything with pygame?

frozen knoll
chilly coral
#

Hello

#

i need some help with the ursina game engine

cold storm
cold storm
dawn quiver
#

who needs help with anything?

modern marsh
bold nacelle
#

ok new problem..(ugh) i got an OS error now

wet folio
#

I want to create a noframe window but I need to move it around

jagged crown
#

Hi, this might be a silly one but I have a problem in Unity with a simple car racing game I'm trying to make.

The verticalInput is not responding with any key and basically the car is not moving (not accelerating). The front wheels are turning so the horizontalInput seems to be working and all 4 wheels are also not falling through terrain.

Would anyone have an idea if this would be a problem in the script or the colliders or something else entirely?

low shadow
#

@modern marsh yea I was trying to make games with unity before, but I ditched it pretty soon

modern marsh
#

yah

#

same

#

@low shadow

#

brackeys = game dev god

low shadow
#

too bad he stopped making vids tho

edit:spelling

#

plus the brackeys game jam is the biggest indie dev gamejam i think

modern marsh
#

yah

last moon
#

Is there a simple (ish) way to draw clouds using bezier curves?

low shadow
#

anyone seen @potent ice lately?

potent ice
#

I read the channel when I have time 😉

low shadow
#

i thought something happened to you man

exotic sparrow
#

Let's say I was making a clone of terraria as an example, is it more beneficial (performance or otherwise) to move the terrain around the player or the player (centered with moving camera) around the world?

severe saffron
#

well either way you're not moving anything physically

#

either way you only draw the bits of the terrain that you need to draw, from a performance perspective those two are exactly identical just with positive instead of negative numbers

royal hawk
#

I'm trying to make a standard srs implementation of Tetris

#

I tested line clearing by filling the grid with o cells, and seems like i fked up a little too much...

modern marsh
#

any game engine that uses python

slow aspen
#

you can use python in godot but godot is not optamized for python

modern marsh
#

ok

#

@slow aspen

fickle lion
#

I have try to use vectors and I want my ship to move parabolic with using keyboard but I couldn't it. I did it with using mouse coordinat

potent ice
boreal maple
#

alr so i use pygame, is there any way to make a button inside of the game which closes the game? if yes could you help me please, im stuck

hushed bear
# modern marsh any game engine that uses python

two most well-known "game engines" that use python are pygame and godot, but technically godot uses a seperate language called GDScript that is similar in syntax to python but is mostly different from what i've heard. but there's a lot more like kivy, arcade, and etc. check out pins if you're interested in those

potent ice
#

@hushed bear pygame is not really a game engine. It's a lower level graphics/media library.

#

When people say "game engine" it's not always easy to know what they mean

#

Outside of python a "game engine" or "game framework" is probably Unity, UE4, Godot etc, but that's often not what people are asking about in the context of python programming.

#

Might be better to say "high level" and "low level" game/media libraries

#

Low level libraries can for example be: pygame, pyglet, pySDL, OpenGL, Kivy

#

High level libraries can be : Panda3D, Ursina, Arcade, cocos2d, Wasbi2D, RenPy etc

crisp junco
boreal maple
#

ah, ok. thank you!

crisp junco
#

Check this out

potent ice
#

There are lots of examples related to buttons in pygame if you search a bit 🙂

dawn quiver
#

can anyone explain sprite

potent ice
#

It's really just an image

#

It's a name from 70s and 80s game systems

#

Just think of them as images with a size, position etc

#

It was mainly used in the past for player characters and enemies

#

What makes it a sprite is the additional functionality they provide. For example collision detection

iron cloak
#
import pygame
from pygame.locals import *

pygame.init()
#setup screen
screen_width = 1000
screen_height = 1000

screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('window')

#define game variables
tile_size = 200

#load images
sun_img = pygame.image.load('img/sun.png')
bg_img = pygame.image.load('img/sky.png')

def draw_grid():
    for line in range(0, 20):
        pygame.draw.line(screen, (255, 255, 255), (0, line * tile_size), (screen_width, line * tile_size))
        pygame.draw.line(screen, (255, 255, 255), (line * tile_size, 0), (line * tile_size, screen_height))


class world():
    def __init__(self, data):
        self.tile_list = []

        #load images
        dirt_img = pygame.image.load('img/dirt.png')

        

        row_count = 0
        for row in data:
            for tole in row:
                if tile == 1:
                    image = pygame.transform.scale(dirt_img, (tile_size, tile_size))
                    img_rect = image.get_rect()
                    image_rect.x = col_count = tile_size
                    image_rect.y = row_count = tile_size
                    tile = (img, image_rect)
                    self.title_list.append(title)
                col_count += 1
            row_count += 1



world_data = [
    [1, 1, 1, 1, 1], 
    [1, 0, 0, 0, 1], 
    [1, 0, 0, 0, 1], 
    [1, 0, 0, 0, 1], 
    [1, 1, 1, 1, 1], 
]
#game instance
run = True
while run:

    screen.blit(bg_img, (0, 0))
    screen.blit(sun_img, (0, 0))

    draw_grid()

    print(world.tile_list)

    #quit code
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    
    pygame.display.update()
pygame.quit()``` i am getting the error ```Traceback (most recent call last):
  File "game.py", line 65, in <module>
    print(world.tile_list)
AttributeError: type object 'world' has no attribute 'tile_list'```can anyone help
#

dw i got help

brave elm
#

I have a problem... Nothing moves unless I move my mouse or press any button, can someone tell me why?

#
import pygame
import time
import random

pygame.init()

screen = pygame.display.set_mode((1000, 1000))
clock = pygame.time.Clock()

gravity = 1
monkey_movement = 0

grass = pygame.image.load('D:\game\grass2.png')

monkey = pygame.image.load('D:\game\monkey.png')
monkey = pygame.transform.scale(monkey, (260, 400))

pygame.display.set_caption("Monke!")

floor_x_pos = 0

while True:
    for event in pygame.event.get():
        screen.fill((0, 150, 230))
        if event.type == pygame.QUIT:
            pygame.quit()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_w:
                print('kaka')

        monkey_movement += gravity
        screen.blit(grass,(floor_x_pos,1080-200))

        screen.blit(monkey,(0,monkey_movement))

        clock.tick(120)
        pygame.display.update()
        #10,255,110 best color
severe saffron
#

your for loop iterates over pygame.event.get()

#

so if it's empty, none of the code inside the for loop will run

#

you want all your movement and drawing code outside that for loop

#

@brave elm

crisp junco
# brave elm ``` import pygame import time import random pygame.init() screen = pygame.disp...

Indentation problem.
It should be

import pygame
import time
import random

pygame.init()

screen = pygame.display.set_mode((1000, 1000))
clock = pygame.time.Clock()

gravity = 1
monkey_movement = 0

grass = pygame.image.load('D:\game\grass2.png')

monkey = pygame.image.load('D:\game\monkey.png')
monkey = pygame.transform.scale(monkey, (260, 400))

pygame.display.set_caption("Monke!")

floor_x_pos = 0

while True:
    for event in pygame.event.get():
        screen.fill((0, 150, 230))
        if event.type == pygame.QUIT:
            pygame.quit()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_w:
                print('kaka')

    monkey_movement += gravity
    screen.blit(grass,(floor_x_pos,1080-200))

    screen.blit(monkey,(0,monkey_movement))

    clock.tick(120)
    pygame.display.update()
    #10,255,110 best color
#

This part of your code

    monkey_movement += gravity
    screen.blit(grass,(floor_x_pos,1080-200))

    screen.blit(monkey,(0,monkey_movement))

    clock.tick(120)
    pygame.display.update()

was getting executed only when you pressed a key or moved a mouse because it's indented inside the for event in pygame.event.get() loop. So whenever there's a event then only it's was going to execute

#

As rightly mentioned by @severe saffron

brave elm
#

@crisp junco Thanks bro, helped me

wheat spindle
#

is the turtle module good for game development as beginner?

tranquil girder
#

imo it's not good for game development regardless of experience
but for beginners it's not that important what you start with, just that you start developing

wheat spindle
#

thanks!

last moon
frozen knoll
#

Try Arcade: arcade.academy

dawn quiver
flint fulcrum
#

can someone review my monopoly game?

wet folio
#

Downloaded it and tried to run it

#

According to pycharm there are a lot of unresolved references

wise vine
#

Firsts thing first, why create an 800 line program?

#

Why not separate into different files?

potent ice
#

Can be easier to share I guess?

#

But yes. Would be better to share in a public git repository neatly split into several modules 🙂

low shadow
#

but it would be cooler if u could make it with gui
but that would take forever

potent ice
#

Not forever, but it would certainly take longer 🙂

dawn quiver
#

The monopoly game is awesome

earnest stirrup
#

here's my current structure for an action method

glass sonnet
#

anyone familiar with the tcod roguelike tutorial care to help me with something? should be fairly simple..

dawn quiver
#

ok?

glass sonnet
#

I want to get the player's x and y position as readable values into Main.py, but everything I've tried so far hasn't worked.

flint fulcrum
topaz sinew
glass sonnet
#

not pygame, tcod

topaz sinew
#

Oh

#

Then I don't think I can help. I'm really sorry

glass sonnet
#

hey no worries, thanks for the offer

polar latch
#

Any package recommendation to switch your py app into exe? I have tried a few (pyinstaller) but it seems windows defender always detects a threat and removes it

whole coyote
#

@polar latch this is an issue with using most software that turns python scripts into standalone executables.

wide smelt
#

hi guys

#

is there anyone who makes 3D games with Python?

#

i just wanna make some but i can't find how to

#

if you use any game engine, please tell me which one should i learn

valid seal
#

Godot it probably your best choice

#

Though I'm not entirely sure if it supports vanilla python

wide smelt
#

hmm

valid seal
#

what I do know is that it has its own language very similar to python

#

But I believe I saw something at some point about support for normal CPython

wide smelt
#

i actually found a engine that creates only 3D but it's not popular and this creates a problem

#

the engine called UPBGE

valid seal
#

Never heard of it

wide smelt
#

i want to use it but because it's not popular, it creates a problem for support

valid seal
wide smelt
#

what i mean is that if you had any problem it's hard to find solution bc there is so few people using it and they might not have seen this problem before

wide smelt
#

thx btw @valid seal

valid seal
#

Ok after a quick google search it doesn't seem that CPython is supported

#

but if you already know python

#

learning GDscript shouldn't be hard

wide smelt
#

thx

#

i heard about Panda3D

#

is it good?

#

i don't prefer only-script engines

#

because you gotta see another things

#

and make them with your hand i guess

#

so do you think Panda3D is good?

valid seal
#

I'm not familiar enough with it to know

potent ice
dawn quiver
#

currently im passing the instance of my class around to random sprites, and the only time theyre using the reference its to add to the main.all_sprites

#

would it be better to just make all_sprites a class variable

#

also the only videos i see on this stuff just put these as globals

#

i dont really want to do that cause it consfuses me is there like a good read on structuring game code

delicate beacon
#
    arr = [[0 for row in range(n)] for column in range(n)]
    for row in arr:
        print(" ".join(str(cell) for cell in row))
        print("")```
#

I was trying to make a minesweeper game , Can someone help me explain this code ?

proper peak
#

The second line is a listcomp to create an n*n nested list of zeros.

#

Then it gets printed (using a generator expression on the fourth line).

hollow kernel
#

My pygame.draw.rect is not working, it always shows: pygame.draw.rect(screen, RED, (player_pos[0], player_pos[1], player_size, player_size))
TypeError: rect argument is invalid.... help

My code:
import pygame
import sys

pygame.init()

#NESSESARY NEEDS
WIDTH = 800
HEIGHT = 600
player_pos = [400, 30]
player_size = [50]

#COLORS:
RED = (255,0,0)

screen = pygame.display.set_mode((800, 600))

game_over = False

while not game_over:

for event in pygame.event.get():

  if event.type == pygame.QUIT:
     sys.exit()

  if event.type == pygame.K_DOWN:
    x = player_pos[0]
    y = player_pos[1]

  if event.type == pygame.K_LEFT:
    x -= player_size
  elif event.type == pygame.K_RIGHT:
    x += player_size

    player_pos = [x,y]

screen.fill((0,0,0))
pygame.draw.rect(screen, RED, (player_pos[0], player_pos[1], player_size, player_size))

pygame.display.update()

low shadow
#
import pygame
import sys

pygame.init()

#NESSESARY NEEDS
WIDTH = 800
HEIGHT = 600
player_pos = [400, 30]
player_size = [50]

#COLORS:
RED = (255,0,0)

screen = pygame.display.set_mode((800, 600))

game_over = False 

while not game_over:

  for event in pygame.event.get():

      if event.type == pygame.QUIT:
         sys.exit()
 
      if event.type == pygame.K_DOWN:
        x = player_pos[0]
        y = player_pos[1]

      if event.type == pygame.K_LEFT:
        x -= player_size
      elif event.type == pygame.K_RIGHT:
        x += player_size

        player_pos = [x,y]

  screen.fill((0,0,0))
  pygame.draw.rect(screen, RED, (player_pos[0], player_pos[1], player_size), player_size)
 
  pygame.display.update()
frank fieldBOT
#

Hey @sinful wyvern!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

sinful wyvern
#

):>(

low shadow
dawn quiver
#

which website can i use to make a game?

#

a 3 in a row game

low shadow
dawn quiver
#

ye or app

#

idk

low shadow
#

u mean like an engine?

#

u can use unity or unreal or godot
godot if u want python
unity and unreal is diff language

dawn quiver
#

thx!

#

do you have the code?

#

for the game?

#

i am stuck

#

and which version should i get?

hollow kernel
#

64

#

depends on your laptop

#

/device

dawn quiver
#

oh ok

sinful wyvern
#

¯_(ツ)_/¯

dawn quiver
#

hi

scarlet coral
#

Guys, help, who knows how to do it. I have a SWF file from the game, I run it through the flash and play. Is it possible to upload it to the server so that it works on a permanent basis?

boreal arrow
nimble nebula
#

Why do so many people say Python is only for data science?

nimble nebula
#

Wdym?

#

I mean, clearly there are ways to make games with python (with all the game engines mentioned in the description)

nimble nebula
low shadow
woeful brook
#

any C# dev here to help me

#

dm me if there is

potent ice
#

@woeful brook This is a python discord and help in DMs is not a good thing.

potent ice
# nimble nebula Wdym?

Yes. It's a huge misconception that python is too slow for games. It really infuriates me at times.

#

Should you make cutting edge AAA games with python? Probably not.

#

.. but there is a lot of area between a simple "pong" game and a cutting edge AAA game python can cover

#

Will it be harder than using a game engine with UI? Most likely.

#

Would you sometimes have to be a bit creative to make things run fast? Most likely.

#

.. but there is so much to learn from python game dev

potent ice
#

I think a lot of people start out with pygame and judge python game development from that experience alone

#

There are other options out there. Pygame is awesome for what it was built for. If you need more performance or use the gpu more efficiently there are lots of other options.

nimble nebula
#

Oh I see

potent ice
#

I don't blame pygame or people for this. It's just how it is. People make assumptions 😉

vernal ridge
#

So i'm not at all sure if this is the correct channel to post this in but here goes. So I am trying to make a bot that moves the character’s viewpoint in a first person game but when I use the pyautogui or the mouse modules they don't move my viewpoint but the modules do work on a normal cursor that is not locked to a window any help is greatly appreciated.

jolly arrow
#

Hello can i ask it is possible to code good game in pygame?

whole coyote
#

yes

restive kelp
#

@dawn quiver ask here

potent ice
grim abyss
#

HI! I'm new to Python and Programming Concepts. I wanna make games. Help a guy out!?

#

Just kidding!

#

learn the basics first folks....

#

games are complex systems interacting with each other!

silver tinsel
severe saffron
#

is this an image you got from the internet

silver tinsel
#
# importing tkinter
from tkinter import *

# main
window = Tk()
window.title("Flashie - A Simple Flashcard App")
window.configure(bg="#B1DDC6")

# canvas for flashcard portion
canvas = Canvas(width=800, height=526)
flashcard_img = PhotoImage(file='../flash-card-project-start/images/card_front.png')
canvas.create_image(400, 265, image=flashcard_img)
canvas.grid(columnspan=2, padx=50, pady=50)

# run window
window.mainloop()
severe saffron
#

also which grey color

silver tinsel
#

is it just because its a canvas?

severe saffron
#

which grey color

#

do you want to get rid of what's black in that image

silver tinsel
#

yes

#

that black is only bc its a png

severe saffron
#

i think a canvas can't be transparent in tkinter, not sure

silver tinsel
severe saffron
#

actually

#

hmm

#

apparently you can draw images with trransparency onto a canvas

#

ah but

#

if the canvas background is white

#

then it will show up as white not green

silver tinsel
#

oh i think theres a fill paramter

#

or something

#

oh wait thats for text nvm

#

that grey still bothers me

#

ok this is the closest i got it

#

and its by setting the canvas bg that color as well

#
# importing tkinter
from tkinter import *

# main
window = Tk()
window.title("Flashie - A Simple Flashcard App")
window.configure(bg="#B1DDC6")

# canvas for flashcard portion
canvas = Canvas(width=800, height=526, bg="#B1DDC6")

# canvas img
flashcard_img = PhotoImage(file='../flash-card-project-start/images/card_front.png')
canvas.create_image(400, 265, image=flashcard_img)
canvas.grid(columnspan=2, padx=50, pady=50)

# canvas text objects
title = canvas.create_text(400,150, text='Title', font=('Ariel','40', 'italic'), justify='center')
word = canvas.create_text(400,263, text='Word', font=('Ariel','60', 'bold'), justify='center')

# run main
window.mainloop()
severe saffron
#

Looks like it has a border as well

#

Which is extremely weird

silver tinsel
#

def

severe saffron
#

Looks good

#

You can disable the relief and borser

#

Border

silver tinsel
#

how?

lunar venture
#

you can just make the canvas the same color as its background widget

silver tinsel
#

yeah it is

#

i think its just scuff like that

potent ice
#

Might need to alter the image a bit?

cinder widget
#

hello

#

anyone might help me with pygame

#

I want to draw a circle inside a rect

#

cuz drawing a circle is way too problematic

#

nevermind ellipse is better

last moon
#

Circles are just symmetrical ellipses

#

How does OpenGL render curves?

#

Ik there’s some math involved but anyone know what it is?

potent ice
#

Depends what kind of curves

#

and what method.

#

Can calculate a curve in python writing to a buffer and/or calculate curve in shader

fathom ivy
#

Wanna build a text life sim game... Not sure how to go about it

misty shell
#

what is this and why here?

potent ice
#

@last moon pre-calculating the curve in python vs having a shader do it realtime

#

Can be translated to python of course 🙂

#

There are simpler curves as well. Points with tangents.

#

Then you have Catmull-Rom splines (easier)

last moon
#

oh so you'd iterate through that to get your line?

potent ice
#

Iterate through what?

last moon
#

the bezier function you just sent

potent ice
#

As long as you have an extra start and end point 🙂

#

With splines you normally calculate p1 -> p2 when passing in p0, p1, p2, p3

#

They needs the info from neighbors

last moon
#

so does a spline interpolate the rest of the pixels based on the start & end point + 2 other points on the curve?

#

my understanding of a bezier curve was that it uses the start & end but 2 control points that aren't on the curve

potent ice
#

Pretty much, but not pixels. points/vertices

#

yes

last moon
#

vectors smil

potent ice
#

Well. points unless they are tangents I guess 😄

#

Unless you like them moving in squares (depends on style)

last moon
#

ill take a look at it later, that's too much math rn 😄

potent ice
#

You can find the simplified formula elsewhere 😉

#

Cheap in 2D!

#

It's all about picking the right type of curves/splines for the use case

last moon
#

I was trying to draw a square

#

how do you mess up a square?

potent ice
#

That is GL?

last moon
#

ya

potent ice
#

show the vertices

last moon
#

oh I've got 10 instead of 100 nvm

potent ice
#

ah 🙂

#

pyopengl?

last moon
#

actualllly funny story this isn't python

potent ice
#

Using vbos or glBegin stuff?

last moon
#

im using Processing for a computer creativity course im taking

potent ice
#

ah right. Not using GL directly then?

last moon
#

I thought it was?

potent ice
#

Paste a snippet?

#

Just the drawing of the quad part

last moon
#
sprite = createShape();
sprite.beginShape();
    
sprite.fill(255);
    
sprite.vertex(x, y);
sprite.vertex(x+100, y);
sprite.vertex(x+100, y+100);
sprite.vertex(x, y+100);
sprite.vertex(x, y);```
potent ice
#

ah. That is a bit higher level.

last moon
#

I kinda figured considering it's a 100 course

potent ice
#

You still have to define the geometry. That is the important part 😉

#

The rest is just syntax differences I guess

#

I think processing is doing the rendering based on opengl version.

last moon
#

im pretty sure it is but the docs don't get too specific about it

potent ice
#

Still close enough!

last moon
#

ya idk im having fun with it and it's helping a lot of concepts that I've heard about/seen here click for me

#

I thought you literally told sprites to move, not that 'moving' was redrawing them

potent ice
#

Yeah you have to redraw everything per frame

#

Each frame starts with a blank screen

#

Usually the underlying graphics driver is exposing a double or triple buffered surface

#

You draw in the hidden surface and it's swapped to the front when ready

#

The previous surface is hidden and cleared ready for a new frame

#

Speed today relates to how much you can batch draw first an foremost

#

You have about 1000 draw calls per frame before it starts to become sluggish. Sprite systems will in most cases collect all the data and batch draw it all in the end.

pallid trail
#

how do i access the subclass of a class,

#

specifiaclly i want to access the specific class in a sprite group

#

when i itterate through a spritegroup, it only gives me the sprites, not the class im wanting to refer to

digital monolith
#

guys i wanted to start learning pygame
can i get some suggestions of how to start?

faint dome
#

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
#

This one is gooder👀

topaz raft
#

how is ursina?

potent ice
#

Pretty nice, but that is subjective like anything else

#

Take a look at the api and examples I guess

tall vine
#

hello everyone

#

so im making a simple game using pygame

#

so my problem is with the coordinates

#

is there some graph that could help with the coordinates of the display?

#

i cant tell where is point(0,0) where is point (125,300) for example

low shadow
#

the top left side is 0,0

#

the y axis is inverted
the bottom left is 0,500 - or whatever screen size u have

tall vine
#

So i cant really tell where is for exmaple the point (300,25) ?

#

Is there some sort of app to help me with it?

#

Like where i would put a screen size and move my cursor wherever in the screen and it would show up the coordinates?

potent ice
#

Just print out the mouse position?

#

I'm pretty sure 0,0 is upper left corner both for mouse coordinates and pixel coordinates

dawn quiver
#

does anyone know how to fix this?

#

I tried to make my game executable

tall vine
low shadow
#

its a function

pallid trail
#
# This function will kill each square on the grid
def kill():
    for _ in square_group.sprites():
        pygame.sprite.Sprite.kill(_)

would this be able to kill all sprites in a sprite group

#

wait no that works

#
    def set_fields(self):
        for _ in square_list:
            coord = _.coord  # stores the values returned
            if _.click:
                if self.placement[coord[0]][coord[1]] == 0:
                    self.placement[coord[0]][coord[1]] = 1
                else:
                    self.placement[coord[0]][coord[1]] = 0

i want this to replace 1 element in a 2d array, but it replaces an entire column

last moon
potent ice
#

The official docs is where you want to look

hearty widget
#

what's the 1st step to learn game development ?

#

i'd like to learn about it

#

i'd appreciate any suggestions about where to start

potent ice
potent ice
hearty widget
#

i want to learn

#

and idk from where

potent ice
#

Simple 2D games?

hearty widget
#

well, where should a beginner start?

potent ice
#

Also python beginner?

hearty widget
#

i am codding with python for nearly a year

#

although i only know the basics and a bit more

potent ice
#

I can assume you wanted to play around with simple 2D games?

hearty widget
#

well, i can start with that

#

so yeah

potent ice
hearty widget
#

oh

potent ice
#

Two free book. One for arcade and one for pygame

hearty widget
#

cool, thx a lot

potent ice
#

Arcade is a bit a bit higher level, so maybe that is a good start

hearty widget
#

okay, i appreciate it

potent ice
#

A lot of things translates well between 2D game libraries anyway

hearty widget
#

nice

potent ice
#

shapes, sprites, collision etc etc

hearty widget
last moon
potent ice
# last moon neat thanks ill have to look into it more

If we're talking about simple sprite systems on the cpu it will of course be somewhat different. Moving all the sprite logic to gpu is not always that easy. You can still update data to gfx memory every time something changes. Stil.. most sprites will probably be rendered in one more more batches 🙂

#

You might have a buffer for sprite positions (xy)

#

Maybe a few more attributes like rotation/color or whatnot

#

.. but all that data is at least at some point synced up to gfx memory for drawing 🙂

#

A huge tilemap that doesn't change stays in gfx memory and are easy to just draw

#

Moving players and enemies is something completely different

#

In a 3D scene the cpu is often calculating rotations and translations, but the geometry is already ready on the gpu

#

There are ways to transform data on the gpu as well. Lots of techniques to solve common problems.

jolly arrow
#

hello can i ask something, is here some1?

potent ice
#

You just ask. That's it

jolly arrow
#

oh ok

potent ice
#

Never ask to ask 🙂

last moon
potent ice
#

Might make sense in the future 🙂

last moon
#

Hopefully..

jolly arrow
#

i just want to ask why the console says:

#

line 28, in normal_cursor
screen.blit()
TypeError: function missing required argument 'source' (pos 1)

potent ice
#

pygame?

jolly arrow
#

yep

#

do u need see the code?

last moon
potent ice
#

Always good to look up and fully understand each function in the official docs

jolly arrow
#

k thank you !

potent ice
#

it means faster progress 🙂

tall vine
#

Hope that helps

#

You have to put it in a while loop or it would appear for 1 second and dissappear

jolly arrow
#

thank you!

#

but now it types

#

TypeError: argument 1 must be pygame.Surface, not str

tall vine
#

Hmm

#

Wait a second

#

Do this

#

Lets say

#

Monkeyimg=pygame.image.load("monkey.png")
Then do
Screen.blit(Monkeyimg)

#

@jolly arrow

#

See if that works?

jolly arrow
#

i go try it

tall vine
#

I dont remember the sytnax exactly

#

I forgot a " in the ("monkey.png")

jolly arrow
#

so i shouldnt give that in def?

tall vine
#

I think no

#

Unless u r going to use it multiple times for multiple images

#

@jolly arrow oh i forgot

#

You need to give the x and y coordinates for the picture

jolly arrow
#

like for both of them?

tall vine
#

screen.blit(monkeyimg,x,y)

jolly arrow
#

oh ty

#

!!

tall vine
#

It works now

#

?

jolly arrow
#

yep

tall vine
#

Np ❤️

jolly arrow
#

thank you!!

ancient surge
#

Game dev is mostly C#

#

but idk

potent ice
#

@ancient surge It's available to most languages. Why mostly C#?

dawn quiver
#

can someone help me with pygame?

dusk anvil
#

post your code and your issues

dawn quiver
#

`import pygame
import random
BLUE_COLOR = (0, 64, 255)
WHITE_COLOR = (255, 255, 255)

WIDTH = 150
HEIGHT = 200
KADOR_SIZE = 10

class Kador:
def init(self):
self.x = 0
self.y = 0
self.move_x = 0
self.move_y = 0

def create_kador():
kador = Kador
kador.x = random.randrange(KADOR_SIZE,)
kador.y = random.randrange(KADOR_SIZE,)
kador.move_x = random.randrange(-2, 3)
kador.move_y = random.randrange(-2, 3)
return kador

def main():
pygame.init()
pygame.display.set_caption("")
size = [WIDTH, HEIGHT]
screen = pygame.display.set_mode(size)

kadorim = []
kador = create_kador()
kadorim.append(kador)

bye= False
while not bye:
for event in pygame.event.get():
if event.type == pygame.QUIT:
bye = True
elif event.type == pygame.KEYDOR:
kadorim.append(create_kador)

for kador in kadorim:
kador.x += kador.move_x
kador.y += kador.move_y

if kador.y > HEIGHT - KADOR_SIZE
    or kador.y < KADOR_SIZE
    kador.move_y *= -1
if kador.x > WISTH - KADOR_SIZE
    or kador.x < KADOR_SIZE
    kador.move_x *= -1

screen.fill(WHITE_COLOR)
for kador in kadorim:
pygame.draw.circle(screen, BLUE)

pygame.display.flip()

pygame.wait()

if name == 'main':
main()`

#

i am new to this sry

#

this is my first game

dusk anvil
#

Could you run the code and paste the error message from the terminal?

dawn quiver
#

idk what is it

#

maybe cause i reinstalled it wait a sec

dusk anvil
#

Well for starters, you have some syntax errors in your code. There are some typos, wrong indentations and you're missing semicolons

dusk anvil
dawn quiver
#

OK ty

timber briar
#

i want to do AI

tall vine
#

any python programmer here?
so im making a rocket to fire when i press the space button
but here is the problem
i assigned the location of the rocket to be the same as the player location
for example
PlayerY=300
#then i made a code that changes the playerY value when you press any arrow
GunY=PlayerY
but the gunY dosent update when playerY is changed

waxen mica
last token
#

is ursina game engine good?

potent ice
rich willow
#

im a game dev ( i know unreal(not ver much ) , Unity(very much experienced) , pygame and im happy to learn other langs or API as well
Im looking for a team or to put it in simple words .... I WANNA WORK ON A PROJECT AND COMPLETE IT .
DM ME)

frozen knoll
#

Nice!

tall vine
#

so im trying to make multiple enemies

#

but only one enemy moves

potent ice
last token
#

do you know anywhere good to learn video based?

#

@potent ice

potent ice
#

No idea. I just looked at the examples I linked above

last token
#

ok, thanks

solemn bridge
#

Guys I has question

#

Is the new pygame2 hardware accelerated? 👀

last moon
#

iirc yes?

#

or at least SDL2 is

solemn bridge
#

Well I know SDL2 is (I've used it with C++) but I was just wondering if it was doing that software rendering thing again 👀

#

I suppose it's okay if it's not, I shouldn't be doing anything too crazy.....yet

potent ice
#

I think some things may be hw accelerated in pygame 2, but for the most part it's cpu rendering. Still the new sdl2 module opens for a lot of interesting things.

potent ice
#

I'm guessing the big win is when you can batch draw things with sdl2

#

Can probably get a bit closer to the performance of Arcade's SpriteList.draw() this way

tall vine
#

Py game.

#

So i made a func that renders a font in the screen

#

If the player and the enemy collisions

#

But the problem is it only happens during the collision

#

And dosent stay after the collision ends

#

Is there a way to make it appear for a specific amount of time?

dawn quiver
#

Anyone know how to add a menu in pygame

potent ice
tall vine
#

I did something else

#

Just assigned a variable to True or false

#

When collision happens it is true

#

When the player presses r it is false

#

Then added if variable=="True"
It will run the function

#

Anyways thanks for the help einraf

#

❤️

potent ice
#

No problem.

dawn quiver
#

Hello all!

covert yoke
#

My assets vs my results...not sure why convert_alpha() isn't working, last time I tried it I got clean results

#

I'm taking from a large sheet and cutting and blitting, no idea where the black comes from

#

I convert_alpha() when I import the image, IDK

covert yoke
#

Found it! I wasn't using thepygame.SRCALPHA param in when chopping and splicing and merging

dawn quiver
#

ok

white vector
#

y'all making 2D games, I wanna make 4D minesweeper

dawn quiver
#

I want to make a survival games, but I think for now I'll focus on just getting my simple games to work lol

dawn quiver
#

Wait, how would you even make 4D games?

foggy python
#

Not quite gamedev, but the channel topic says "and frameworks". Made this partially using Pygame:
https://youtu.be/tOBOBIaO4VE

I hacked up the example script for face-api.js to forward the data to my Python/Pygame script. Then I did some trig and other math things to get a very rough estimate of facial rotation based on facial landmarks (from face-api.js) so that I could map it to a cube. \o/

(face-api.js uses machine learning to place facial landmarks)

⭐ Kite is a ...

▶ Play video
scenic spindle
low shadow
white vector
#

and the cells coordinates require (w,x,y,z)

#

you could use a single integer but it'd essentially be something like interpreting this binary:
0101111000000111
as opposed to (0101, 1110, 0000, 0111)

dense mango
#

Im confused how ecs improves performance by working with the cache, can somone pls explain?

dense mango
#

Would duplicating data across components to satisfy the cache be okay?

thick vapor
#

hi, what should i do if my fivem liveries aren't dropping into open iv

coral anvil
#

is python actually useful for game making?

#

or i should learn other languange

tall vine
#
def collision(x,y,X2,Y2,distance1):
    distance=math.sqrt((math.pow(x-X2,2))+ (math.pow(y-Y2,2)))
    if distance<distance1:
        return True
    else:
        return False


        collison2= collision(enemyX[i],enemyY[i],gunX,gunY,30)
        if collison2:
            if score_value==score_highest:
                score_highest+=1
            gun_state="Ready"
            score_value+=1
            enemyX[i]=random.randint(0,736)
            enemyY[i]=random.randint(0,150)
            explosion_sound=mixer.Sound("explosion.wav")
            explosion_sound.play() 
#

(The indentedation here is stupid but is it is perfect in the code)

#

i still dont understand why is there collision happening when the bullets dont hit them

tall vine
#

Learn C++

coral anvil
#

yeah ok

tranquil girder
#

Try ursina or panda3d

coral anvil
#

oh ok

tall vine
#

That is why most 3d games r made in C++

#

Python is good for data science AI and web development

#

Python isnt made for games

tall vine
# coral anvil oh ok

Python is good for data science AI and web development.
If you are into game development. I recommend C++ pokepetter dosent know what he is talking about. Most popular 3d games r made with C++ using Unreal engine or Unity. Which works with C++ and not python.

potent ice
#

This is the python discord. We like doing things with python 🙂

desert warren
potent ice
#

@tall vine The thing is that for example Panda3D is written in C/C++, but the api is python

#

The same goes for moderngl. It's a python api written in C++ for performance

#

Even the same situation with numpy

#

It's a huge misconception that python is only good for data science, ai and web development. There is a lot you can learn from making games in python

#

Will it be easier than usingUnity or UE4? Probably not. Will you learn new things? Definitely.

coral anvil
#

thank you both

#

i actually asked if its efficent only to know.
i dont think you should say other people doesnt know what they are saying

#

to both of you

potent ice
#

Yes, there are probably better ways.

#

But .. @tall vine is kind of arguing with the creator of Ursina here.

tranquil girder
#

Yeah, sorry

#

I was a, bit rude

potent ice
#

I do understand the frustration. Both me and pokepetter are developers on opensource game engine / graphics libraries for python.

potent ice
dawn quiver
#

Hello guys i would be happy if anyone could recommend a good tutorial to learn pygame(Excluding videos)

potent ice
ripe basin
pliant inlet
#

Guys Are There Game Engine Using Python?

ripe basin
pliant inlet
ripe basin
ripe basin
tranquil girder
#

There's a fork called UPBGE now

#

So it's not really dead

pliant inlet
ripe basin
tranquil girder
#

But even with ursina I use Blender as a level editor for 3d games

ripe basin
#

@tranquil girder do u use UPBGE ?

tranquil girder
#

And it's always a good idea to make a custom editor if you want to be productive. With unity for example, there's always a lot of work put into making tools anyway

tranquil girder
#

But they post some updates on the development here sometimes

ripe basin
#

so should i use it?

#

@tranquil girder

tranquil girder
#

I don't know, I haven't used it

#

It has good graphics, but I'm not sure about how it is to program for it. There's also the licensing issue

tranquil girder
#

It's GPL

ripe basin
#

ok

solemn bridge
#

So guys, I been messing with pygame now for about 2 days, and I have built a 2D camera, scaling, and can basically load tilemaps up to 1500x1500 tiles from Tiled before Tiled whines and almost crashes 😅

#

All while getting around 180 fps with a core i5

#

I'd say pygame is pretty suitable for 2D games in such case. I mean 1500x1500 is kind of overkill, it was just a test. 😄

#

I know people say "For 2D games" but that isn't really self-explanatory. Something like Starbound is 2D and requires a decent PC to play, and it's even C++.

#

I think pygame+python is capable of doing something like Starbound but you'd definitely need to do some optimizations.

potent ice
#

It can definitely perform well. I'm not sure how well it would handle doing lights, but there might be some tricks.

frozen knoll
#

Do you render the tiles to a surface, then display? You don't draw 2.2 million tiles every 1/60 of a second, do you? Or is that sparsely populated?

potent ice
#

I assumed it was organized in chunks

potent ice
#

@solemn bridge right? 🙂

dawn quiver
#

you guys know how to use ursina? i just found out about it

solemn bridge
#

@frozen knoll @potent ice Kind of. I only render and process within a set tile radius around the player.

potent ice
#

ah ok, so it can be done faster by rendering to surfaces I guess.

#

Usually 4 surfaces each containing a chunk

#

Separate animating tiles drawing them manually etc

mystic lodge
#

@tranquil girder arent you the guy who coded ursina?

tranquil girder
#

Yep

compact jackal
#

Does anyone know how to make a sprite face/ look at another sprite in pygame(2d)

potent ice
#

Do you know how to rotate them?

eager bobcat
#

hello, I am making a somewhat game/assignment for my python class this semester, I have made it fully with turtle

#

But I cant seem to find out how I can stop a program when it hits the bin

#

this is the assignment

#

turtle.bgcolor("grey")

# Bin #
turtle.penup()
turtle.goto(200,-300)
turtle.pendown()
turtle.begin_fill()

for i in range(2):
    turtle.forward(100)
    turtle.right(90)
    turtle.forward(20)
    turtle.right(90)
turtle.end_fill()

# Bouncing Ball #
turtle.penup()
turtle.goto(0,0)
turtle.shape("circle")
turtle.penup()
x, y = 0, 0
xdir, ydir = 3, 3
xlimit, ylimit = turtle.window_width() / 2, turtle.window_height() / 2

while True:
    x = x + xdir
    y = y + ydir

    if not -xlimit < x < xlimit:
        xdir = -xdir
    if not -ylimit < y < ylimit:
        ydir = -ydir

    turtle.goto(x, y)

turtle.mainloop()
#

Here is my code

#

I asked to use pygame, yet the professor didnt want me to use it

dawn quiver
#

Wish I could get pygame running....

eager bobcat
#

whats wrong with it @dawn quiver

dawn quiver
#

Every time I use cmd prompt it sends me to Windows Store to install python 3.9 and I've already installed in with python installer.

eager bobcat
#

Have you added it to your path?

dawn quiver
#

I thought I had but I'm not sure. I don't recall checking the box before installing.

eager bobcat
#

Uninstall it and reinstall it and hit the checkbox

#

see if you can run then, if not ill do research

dawn quiver
#

Yeah, I should try that.

eager bobcat
#

or wait

#

before you uninstall

dawn quiver
#

Yes?

#

I installed the windows store version as well an it seems to work now. But I'm not sure if that is going to cause any confliction.

eager bobcat
#

just try uninstalling and reinstalling

dawn quiver
#

10-4

eager bobcat
#

then try restarting pc after you install

#

then try it

dawn quiver
#

I will give that a try

eager bobcat
#

can you do pip --V in the cmd?

dawn quiver
#

I just done that an the result was 'no such option --V'

#

No it doesn't work

dense mango
#

what about pip --version

#

@dawn quiver ^

#

im not familiar with windows though

#

are you sure the python your running is in your path variable?

#

sorry nevermind

fiery nova
#

im trying to learn oop

#

like if i want to make a quest system

#

do i make a base quest class

#

and then created each quest as an object

cerulean sierra
junior pine
#

Hi

slim sky
#

Hi

junior pine
#

How to download pygame module in python idle 3.9 version?

dawn quiver
junior pine
dawn quiver
#

you dont have pip installed

#

i think you may need to reinstall python..

slim sky
junior pine
junior pine
dawn quiver
#

bruh

#

i cant open my Ursina window help?

snow hearth
lofty viper
#

Who uses Python Turtle Grahpics?

eager bobcat
#

@lofty viper I’ve created 2 programs from it, whats up

lofty viper
eager bobcat
#

It’s was a simple house and mountain code and now it’s a bouncing ball game

lofty viper
eager bobcat
#

Nice

exotic sparrow
#

is this classified as a 2d or 3d game:

potent ice
#

That would be 2D. It's an isometric tile map.

exotic sparrow
#

thank you

potent ice
#

Each tile has the same size. There is actually no perspective here

exotic sparrow
#

what would it be called if the tiles are straight on the vertical axis but still at that angle?

#

liek this:

#

but not exactly that

#

so the tiles are straight down but still at an angle

potent ice
#

still here are no perspective here.

potent ice
#

Because the points further away from the eye does not get "warped by space"

worldly flare
#

hi, @foggy python how did u created those waves in your one of the platformer?

potent ice
#

@worldly flare There's quite a bit of info in videos already https://www.youtube.com/watch?v=QXVu6xhcpVQ

This is the second devlog in my new Python/Pygame gamedev project. I had a lot of fun with this one. New GFX elements are always interesting to implement. In this case, water, wind, and grass physics may not be as difficult to simulate as you may think.

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The...

▶ Play video
potent ice
#

Somewhat related: I think this is a great video getting people in the right frame of mind when programming anything really : https://www.youtube.com/watch?v=h1o5UzKfZcQ

There's a basic process that you'll need to use to code most things, but it's rarely taught. It comes down to breaking down the complex feature you want into tiny logical chunks until it's almost pseudocode. At that point, you convert it into actual code.

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. T...

▶ Play video
#

I always have a notebook and a pen. Worst case I fill two notebooks in a month.

#

But people are different of course. I find it useful to visualize things.. or at the very least break down complex problems into smaller ones.

hushed garnet
#

is there anyway to keep this clean

#

i tried making a credit card system

#

for example there are vip card, vip+ card, vip++ card, mvp card, mvp+ card, mvp+++ card, god card
i created 1 class for each card and at last a total of about 15 classes were made as they all have totally different features

#

is this how oop works im still learning

proper peak
#

That's for what, a random int in some range?

#

If that's in seconds, you might want to check out numpy.random - it's faster if you need a lot of random numbers:

import random
for N in (10**i for i in range(0,5)):
    %timeit [random.randrange(100) for i in range(N)]

Results:

1.14 µs ± 63.4 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
6.58 µs ± 539 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
57.4 µs ± 979 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
626 µs ± 46.6 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
5.86 ms ± 308 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

With numpy's random:

import random,numpy as np
for N in (10**i for i in range(0,5)):
    %timeit np.random.randint(0,100,N)
# starts off pretty slow:
18.3 µs ± 450 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
19.8 µs ± 1.69 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
# overtakes random at 100 elements:
18.8 µs ± 966 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
27.3 µs ± 360 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
# is 52 times faster at 10000 element:
112 µs ± 2.92 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
#

for 1 million, random takes 622ms and numpy.random 10.2ms.

remote island
#

hi so I'm pretty much of a noob just finished a bootcamp and some other tutorials and was wondering whether a battleship game (with no GUI - just printing the board) is a realistic first on-my-own project. I already done some basic game projects like tic-tac-toe, war and blackjack (with classes and all) but not sure if a battleship project isn't a bit of a deep-water for beginners. what do y'all think?

normal silo
dawn quiver
#

self.image, self.rect = load_png('ball.png')

#

what is happening in the code

#

(dx,dy) = (z*math.cos(angle), z*math.sin(angle)) this is tuple unpacking ...ikr

dawn quiver
dawn quiver
#

nvm i used pycharm to go to the function {load_png} implementation and discovered it returns two values img and rect.... and i totally forgot tuple unpacking can be done without without parenthesis.... i left python for long went creating apps with java lol

wooden hearth
#

Hey, I am trying pygame, and this script is causing an error.

win.fill((12, 24, 36))

The Error Is IndentationError: uindent does not mach any outer indentation level. exit status 1

Does Any1 Know how to fix this?

potent ice
#

@wooden hearth wrong indentation aka wrong number of spaces from the margin

wooden hearth
void glacier
#
game_board_pos = [(2.0, 198.0), (202.0, 198.0), (402.0, 198.0), (2.0, 398.0), (202.0, 398.0), (402.0, 398.0), (2.0, 598.0), (202.0, 598.0), (402.0, 598.0)]
    for p in range( len( game_board_pos ) ):
        px, py = game_board_pos[ p ]
        if px < x < px + 198 and py > y > py - 198: # if mouse in is box and display X shape in the box @game_board_pos to get box area
            pygame.draw.line( screen, red, [ px, py ], [ py, px ] ) # trying to make a X shape
            pygame.draw.line( screen, red, [ px, px ], [ py, py ] )
                        print(f"Mouse pos: {x},{y} in current box pos: {px}, {py}")
#Mouse pos: 143,358 in current box pos: 2.0, 398.0

How can I fix my code to properly display an x in the box my mouse is currently in
line(surface, color, start_pos, end_pos, width)

void glacier
#

Got it fixed

humble iris
#

Not much of Game Dev (outside of building the game from scratch but its not the most challenging) but the generation AI got no talk in #data-science-and-ml so I decided to share my AI here

potent ice
#

@void glacier Maybe use the modulo % operator on the mouse coordinates to figure out what box you are in? Then it should be a simple enough formula to find the center of each box.

crisp junco
#

To play music in loop just do pygame.mixer.music.play(-1)

#

So, the final code should be:

pygame.mixer.init()
pygame.mixer.music.set_endevent()
 
def play():
    playlist = ["teso_main_theme.mp3", "teso_elsweyr.mp3",              "teso_greymoor.mp3", "teso_morrowind.mp3",                        "teso_dovahkiin_metal.mp3"]
    choice = random.choice(playlist)
    
    pygame.mixer.music.load(choice)
    pygame.mixer.music.play()
    end_of_song = pygame.mixer.music.get_endevent()
    if end_of_song:
        pygame.mixer.music.load(choice)
        pygame.mixer.music.play(-1) #Plays the music in loop
dawn quiver
#

The exe compiled by pyinstaller is considered to be a Trojan by antivirus software. anyone know how to fix?

crisp junco
#

ain't you?

dawn quiver
crisp junco
# dawn quiver Yep 😦

Try not using it, windows defender and any other antivirus software detects those files as trojans

#

Quite irritating though