#game-development

1 messages · Page 108 of 1

rustic valve
#

i cant make heads nor tails of this

vagrant saddle
#

create your event with pygame.event.custom_type()

#

await the word and send the event

rustic valve
#

like that?

vagrant saddle
#

more like ```py
NEWWORD_EVENT = pygame.event.custom_type()

async coroutine():
global CURRENT_WORD
while more_words:
CURRENT_WORD = await get_word()
pygame.event.post( pygame.event.Event(NEWWORD_EVENT) )

loop.create_task(coroutine())

#

and in event loop test for if event.type == NEWWORD_EVENT:

rustic valve
#

and where should i put loop.create_task(coroutine())

#

also thats missing the def lol

#

can i nest an event (e.g.) ```py
if event.type == MOUSEBUTTONDOWN:
if event.type == NEWWORD_EVENT:
pass

vagrant saddle
plucky estuary
#

how doable would it be to make a game in python that runs on my console?

dawn quiver
#

Do I really need a database to store information for a website or can I use my pc as database?

dawn quiver
rustic valve
#

like mongodb

#

i think sql is free aswell

dawn quiver
#

Oh and is it possible to add images with python?

rustic valve
plucky estuary
rustic valve
#

im not sure, but you can edit images in python

rustic valve
dawn quiver
# rustic valve to your console?

No to a website for example. I just started with python but my idea was to make a website with python and html that shows shelfs with books. And you can like add your own book to it. But I need to know if it’s possible to add those book images to it.

plucky estuary
rustic valve
dawn quiver
rustic valve
#

no

plucky estuary
#

or is that the wrong route

rustic valve
rustic valve
#

you'd have to research yourself or get someone more competent than me

#

to help you

plucky estuary
#

well how do you get python program on xbox

#

from like app store?

rustic valve
#

🤷‍♂️ all i know is that its possible

plucky estuary
#

alright

#

thank you

rustic valve
#

yw

#

whoops

vagrant saddle
#

pff

rustic valve
#

what just happened

vagrant saddle
#

i sent you a discord invite to pygame community it was removed

rustic valve
#

ah

vagrant saddle
#

sent in pm

rustic valve
#

dm me it

#

thank

vagrant saddle
#

i don't use pygame myself, i just ported it to wasm so you'll get better answers there

sturdy sandal
#

i got the enemies to start moving as well as a beginning to a functional inventory and index on the game

#

i also added a floor level system, so you can climb down stairs to go to new, more difficult floors (this also reduces lag when reseting the map)

brisk wing
#

I wanna know who came here with question regarding GMTK game jam

sturdy flint
#

whats the best ide for python using macOS

brisk wing
idle mural
#

does anyone here use sublime

lean cosmos
sturdy sandal
next iris
#
obj = {}

def reg(name, cl):
    obj[name] = cl

def get(name):
    if name not in obj.keys(): return

    return obj[name]


class A:
    def __init__(self, x, y):
        self.x = x
        self.y = y

reg("test", A)

class B(A):
    def __init__(self, x, y):
        super().__init__(*args)

    def foo(self, a: int):
        self.x += a

reg("test2", B)


args = (100, 200)

b = get("test2")(*args)
print(b.y)

b.foo(100)

print(b.x)

Class register like in source

#

Wait

#

Asinio in pygame

#

Wow

#

So asincio can optimizate the pygame game?

vagrant saddle
next iris
#

Ok

#

What if i use threading for game

vagrant saddle
#

threading is an Os thing, not a python thing

hardy lotus
#

anyone know how to make a rectangle in pygame?

exotic niche
#

The Pygame Summer Jam was an awesome experience
Thanks to everyone who helped and gave their feedback
Enjoy the journey of making of Alien Dimension

https://youtu.be/sa97mqWMoMk

Get Alien Dimension here !
https://quantum-hg.itch.io/alien-dimension

Join me On Discord for Gamedev, physics, simulations and pygame talks and programming!!!
https://discord.gg/rGuseq6HpX

Made Using Pygame !!

Get all of my games here :-
https://quantum-hg.itch.io/

#games
#gamejam
#pygame
#programming
#python
#gamedev

▶ Play video
hybrid burrow
#

Btw, have anyone of you ever used Blender Game Engine?

hardy lotus
#

pygame.draw.rect ya ik but it wont wokr

#

the site is just not made for pygame i htink

hybrid burrow
#

There is an option for pygame

hardy lotus
#

ik but its relatively new and its very buggy

#

but my coding teachers want me to use it

#

¯_(ツ)_/¯

hybrid burrow
#

Ok

#

If you will need any help with problems, write me on priv

hybrid burrow
#

I mean private message

#

Sorry, it wasn't too clear

hardy lotus
#

npnp

hybrid burrow
hardy lotus
#

heard of it

dawn quiver
#

I know an entire animating studios that uses blender

#

Should I send a link

hybrid burrow
#

No, thanks. I was thinking about trying making games in it with python, so I asked to know if you have tried it and what is your opinion about it? Blender Game Engine / Unity / Panda3d?

random roost
#

What's the best library for mobile dev?

#

Like making mobile games in python

snow hill
warped widget
warped widget
#

because you can make both 2d and 3d directly

#

but you can prefer 2d pygame or 3d ursina

snow hill
gusty mirage
#

yo does anyone need a tutorial on requests and webscraping

vagrant saddle
hardy lotus
#

hi

#

i am trying to add an obstacle to my code in pygame

#

i have a moving sprite

#

and i want another sprite

#

to appear on the window

#

here is my code:

frank fieldBOT
#

Hey @hardy lotus!

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

hardy lotus
#

oop

hardy lotus
main parcel
#

How much python should i learn before i start learning pygame? I currently have the basics like variables, conditionals, loops, functions, but i havent learned oop yet.

sterile violet
#

You'd do well to learn oop. Almost everything that I'm doing right now in pygame needs classes. I say needs as in - it would be incredibly difficult to create a decent complex game without knowledge of oop.

snow hill
#

death to oop 🔥

silent bear
#

i made a game, a little Guess the number game but its only a code how do i give it a display, an interface, how to just convert the game code into a game

vagrant saddle
#

but if not using pygame for a game ( eg someting like nodezator ), oop is usefull

vagrant saddle
dawn quiver
#

I don't think one should jump into ECS right off the bat. Especially not by trying to write their own ECS architecture rather than using existing tools like Esper or PECS, which also requires considerable knowledge with classes and such.

OOP is a fine choice when starting out, but dont even think about the paradigm you are using when doing so, as Tim Peters once implied, you would be better off creating a class to contain your functioanality where it is appropriate, and a function where it makes more sense.

Also, I think the advice a little above implied "OOP" just meaning that they throw some class definitions around, rather than structuring your entire game to use it, by utilizing its features.

Regardless of whether or not you want to structure your codebase to use OOP, you should definitely learn how objects and types work in Python, as everything in Python is an object, and modules extend functionality to you by letting you use them. Understanding how they work can be largely beneficial.

silent bear
vagrant saddle
vagrant saddle
#

python classes are very versatile you can use them with inheritance (oop/c++/java) or composition(ECS/C) it's up to your design choices, you can even do polymorphism and mutations if you want to mess things up 😄

dawn quiver
#

Is there a way to render images with transparent canvas with Pygame?

#

I can't find much information on the subject...

sturdy sandal
#

game update

  • things
  • stuff
    more
scenic shoal
#

Hello guys I've been using pygame for almost 2 years now but I want to switch to 3d what do you recommend ursina or panda3d?

warped widget
#

or simpler abstractions

scenic shoal
warped widget
#

panda3d

#

use panda3d

scenic shoal
#

Thanx man :)

dawn quiver
#

Is there a way to render images with transparent canvas in Pygame?

vagrant saddle
#

for me canvas is something you draw "on" not "with"

dawn quiver
dawn quiver
#

https://pastebin.com/f2A16a1V I have the code in here, for some reason when I try to move a paddle, it actually increases size instead of moving, I have tried finding the issue but I can't find it....

wet pewter
#
    right_paddle = Paddle(PADDLE_HEIGHT, PADDLE_WIDTH, WINDOW_WIDTH - 10 - PADDLE_WIDTH, WINDOW_HEIGHT//2 - PADDLE_HEIGHT//2)
    left_paddle = Paddle(PADDLE_HEIGHT, PADDLE_WIDTH, 10, WINDOW_HEIGHT//2 - PADDLE_HEIGHT//2)
``` @dawn quiver
dawn quiver
#

Ahhh nothing is working, i dont get why 😭

potent ice
burnt plaza
#

Can anyone give me ideas to code

keen phoenix
#

Hey, does anyone know any good libraries to acces the JoyCon's gyro and accelerometer?

#

I only want the world position and rotation of the joycon

austere kraken
#
Traceback (most recent call last):
  File "d:/VSC/Pygame/Spaceships #1/main.py", line 184, in <module>
    main()
  File "d:/VSC/Pygame/Spaceships #1/main.py", line 181, in main
    main()
  File "d:/VSC/Pygame/Spaceships #1/main.py", line 181, in main
    main()
  File "d:/VSC/Pygame/Spaceships #1/main.py", line 181, in main
    main()
  [Previous line repeated 1 more time]
  File "d:/VSC/Pygame/Spaceships #1/main.py", line 170, in main
    draw_winner(winner_text)
  File "d:/VSC/Pygame/Spaceships #1/main.py", line 115, in draw_winner
    draw_text = WINNER_FONT.render(text, 1, WHITE)
pygame.error: Library not initialized```
#

I want my game to restart once the game has announced a winner, however it seems to freeze/lag once the game is over

#

Any ideas on the issue or whether this is pygame related?

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.

native trellis
austere kraken
#

It still doesn't work with and without, i'm pretty confused

slow stag
#

What are people's thoughts on pygame vs pyglet, in terms of beginner-friendliness?

#

(for simple game dev)

native trellis
#

It doesn't quit your program, but it's uninitializing all pygame modules, so, when you try to draw, it will raise an error

austere kraken
#

Just did that and now I literally can't close the pygame window, help

native trellis
native trellis
austere kraken
#

I can't run the code without that

#

Dw I closed it in TM

austere kraken
native trellis
austere kraken
#

Yes

#

To repeat it

#

Otherwise, the programme will end after 5000ms

#

But clearly it isnt repeating

native trellis
austere kraken
#

I set it like that

native trellis
#

That should happen only if you have a winner

austere kraken
#

Thats what I meant

#

The winner text displays for 5000ms

#

But how do I restart it?

native trellis
#

If you have a winner, before breaking out of the loop, call the main function again

#

Oh, you also need to reset the HP for both players @austere kraken

proud axle
#

@austere kraken I would also remove all your game code outside the main loop and use the main loop to only control when and if the game runs. Like, create a func "StartGame" and put your events and all that in that function. Then when there is a winner have that function finish and give control back to the main loop, where you could prompt the user to play again ('restart') and if not, quit the program.

dawn quiver
#

is there a way i could switch glRotate to a camera rotation function ?