#game-development

1 messages Ā· Page 99 of 1

raw shadow
#

pdx and pdy are player delta x and y

#

if the player which si the gun is moving left, then ```py
def degToRad(self,player_angle):
return self.player_angle * math.pi / 180

def fixAngle(self,player_angle):
    if self.player_angle > 359:
        self.player_angle -= 360
    if self.player_angle < 0 :
        self.player_angle += 360
    return self.player_angle
#
if keys_pressed[pygame.K_a]:
            ray.player_angle += 5
            ray.player_angle =  ray.fixAngle(ray.player_angle)
            ray.pdx =  math.cos(ray.degToRad(ray.player_angle)) * 5
            ray.pdy = -math.sin(ray.degToRad(ray.player_angle)) * 5
            
        if keys_pressed[pygame.K_s]:
            ray.player_x  -= ray.pdx
            ray.player_y  -= ray.pdy

        if keys_pressed[pygame.K_d]:
            ray.player_angle -= 5
            ray.player_angle =  ray.fixAngle(ray.player_angle)
            ray.pdx =  math.cos(ray.degToRad(ray.player_angle)) * 5
            ray.pdy = -math.sin(ray.degToRad(ray.player_angle)) * 5
#

im sorry, i couldnt be fucked explaining it

tawny smelt
#

Thats alright, this helps

#

thank you very much!

raw shadow
#

but if your mouse moves left then you plus the player angle and then you use that fix angle function which makes sure the angle is a valid integer for being a angle

#

and then you calculate your pdx and pdy

vivid bone
#

is it just me or is there some weird indentation of the 2nd and 3rd blocks in that code?

raw shadow
#

yeah its from a class

#

i just rpped it out cos its a external use method

#

bro there's also a pygame.rect.rotate

tawny smelt
raw shadow
#

player.image = pygame.transform.rotate(player.image, 45)

#

thats like such a better solution xD

#

im stupid

tawny smelt
#

XD, nah mate, at least you know how to code unlike me

raw shadow
#

if you run that code that i have, its a ray caster, its a totally different thingo.

#

but nah you should stick to the simpler things, they are done so you worry about the main part, the creativity

vivid bone
#

im a bit confused about the idea here

#

i mean the gun is a png, not a model, yeah?

raw shadow
#

its a sprite

vivid bone
#

if the png is just being rotated clockwise or counter clockwise it may look a bit silly

raw shadow
#

its a tilt

#

im sure the gun is gonna move left and right

#

but the tilt is gonna be like offsetted to like .5 degree per x offset from the center of the screen

tawny smelt
raw shadow
#

tilting is rotating

#

you can rotate it in a small amount so that it gives a tilting look

tawny smelt
#

i see

#

that could work yeah

vivid bone
#

i think i see it, like it just rotates to accommodate for vertical movement?

raw shadow
#

horizontal

vivid bone
#

šŸ¤·ā€ā™€ļø i would have to see this in action i think

#

to understand

#

i can imagine sliding the sprite back and forth for horizontal crosshair movement and rotating it for vertical crosshair movement

raw shadow
#

left offset is width/2 and right offset is width

vivid bone
#

i just can't imagine how you can rotate a gun sprite to account for horizontal crosshair movement without making more sprites?

#

idk, it's not my project lmao doesnt really matter

raw shadow
#

seems like you've never made a game with pygame

vivid bone
#

by that i just meant i don't gotta bug you about it

raw shadow
#

sdl2 is amazing and pythons simplicity has made it insanely easy to just create a plethora of builtins for pygame

#

there's alot you can do

vivid bone
#

wild

#

i've used pygame a lot but not for any "3d" stuff

raw shadow
#

this isnt 3d, its 2d, altought, he could map left, middle and right sectors of the screen to certain sprites so that the images tilt accordance to thier corrdinates but the images change to show the perspective

#

the middle is a stright back of the gun, the left and right are left and right tilted views of the gun

vivid bone
#

see that makes sense to me, changing the sprite

#

but the builtin you're talking about using is altering a sprite on the fly to make it look like it's turning left and right?

#

im gonna go make coffee

raw shadow
vivid bone
#

yup

#

that sounds great, but also im sorry

#

ive been trying to get off caffeine for like 10 years but it always pulls me back in

#

anyway

raw shadow
#

when i had my finals like 4 months go, i was popping about 400-600 mgs of caffine....

dawn quiver
#

Hello everyone! How can i run some code when my app finishes loading? (like on start of application) in kivy

#

I wanna some animation playing after application starts

raw shadow
#

that wouldnt be this channel

dawn quiver
#

Note: I have an Screen widget with this label

dawn quiver
#

its kivy related

raw shadow
#

i think that would be user-interfaces

#

or software design

#

eh, who am i to judge what a graphics library is being used for

dawn quiver
dawn quiver
raw shadow
#

yeah but none of the above can run natively on android

#

also kivy is a graphics library.

raw shadow
#

maybe

#

googling helps

dawn quiver
#

i know how to make an animation, i just need to run it on some kind of event

#

i tried it on_start and on_enter

raw shadow
#

im not familiar with kivy

#

how does a application run persay

#

what command makes it run

dawn quiver
#

wdym

raw shadow
#

whats the main function

#

can you show me

dawn quiver
#
class TelepatMessengerApp(App):
    def build(self):
        return kv

if __name__ == '__main__':
    TelepatMessengerApp().run()
#

kv is the UI

raw shadow
#

okay, so from the moment telepatMessengerApp().run() is executed

dawn quiver
#

yes

raw shadow
#

which im assuming build function runs

#

you could start a clock which is the amount of time your animation takes

#

you can figure out where things start to get rendered and sneak your loading animation in before any of the components load

#

start a clock for the time it takes for your animation ot run

#

and then continue with rendering your landing page or whatever it is you're rendering

#

does that make sense or would that not work with kivy

dawn quiver
#

I wanna some animation playing **after **application starts

dawn quiver
raw shadow
#

well, in principle thats how i would imagine a load up animation would work

acoustic herald
#

How can I possibly make animations in PyGame?

dawn quiver
#

helper duck needs help

acoustic herald
#

YeS

raw shadow
#

all you have to do is understand your issue. hypothise how it would work

#

understand the resources you have and thier abilities

#

map the resources and your solution together

tawny smelt
#

yo @raw shadow so i found a better way to kinda achieve the effect i wanted

#

instead of trying to move a 2d image on the 3rd dimension (which now that i think about is completely retared), i just decided to move the gun itself

raw shadow
#

thats what i was saying that whole time

tawny smelt
#

thanks for the help mate

raw shadow
#

btw i didnt hint at any 3d stuff xD

#

nah its all goodie

vivid bone
# acoustic herald How can I possibly make animations in PyGame?

animation with nothing else going on:
load all the images of the animation, put them all in a list, iterate through the list and display.

animation with other stuff going on:
use a thread to toggle animation state variables, change given sprite's current image based on that variable

#

that's how i did it

acoustic herald
vivid bone
#

see "animation with other stuff going on"

acoustic herald
#

Oh wait

vivid bone
#

i represent the player, npcs, animted objects in general as instances of classes, with "current image" attributes that can be changed according to a global "animation state" variable

#

i change the state variable in a thread so it can run at all times

#

this is for like, idle animations

#

surely not the best method but that's the one i came up with for my stuff at the time

safe spade
#

Hi

#

I don't know if somebody remember me

#

but for the people who forgot or aren't award

#

i'm currently working on a video game engine

#

and i have publish an update who introduce

#

basic networking for creating multiplayer game

frigid plover
#

I'm developping my own little rpg and how would you guys pass the MyBoss class into the Bite skill, so I can do actions with the Bite skill while accessing Myboss attributes?

#bosses.py
class MyBoss(Boss):
    def __init__(self):
        self.skills = [skills.Bite(),]

#skills.py
class Bite(Boss_skill):
    def __init__(self,<<<MyBoss>>>)
        self.source = <<<MyBoss>>>
    def action(self):
        # Do stuff with MyBoss class through self.source

vivid bone
#

hmm

#

i don't see a reason to pass the Boss to the skill?

#

Just let the boss have Bite as one of its skills

#

seems like you're referencing them both to each other? you only have to do it in one direction

frigid plover
#

lets say my bite skill changes boss attributes, how do I make Bite() access them?

vivid bone
#

i would give each skill certain numbers, like say, the damage it does

#

then write a function that takes the skill's damage and subtracts it from the boss's health

#

does that answer the question?

#

here's the spell class i wrote for my rpg

#
# spell.py
# Define spell class for use in Goblin Hero
# Author: Jackie P, aka TheDataElemental

# Spells to be cast by player
# Spell_type = heal, attack, status...
# Value = amount of damage, health, etc
class Spell:
    def __init__(self, name, spell_type, value, animation, mana_cost, \
        element):
        self.name = name
        self.spell_type = spell_type
        self.value = value
        self.animation = animation
        self.mana_cost = mana_cost
        self.element = element
        self.target = None

    # Carry out effects of spell
    def effect(self, target):
        self.target = target
        
        if self.spell_type == 'Heal':
            self.target.hp += self.value
            
        elif self.spell_type == 'Attack':
            # Check for elemental advantage
            if target.elemental_type == self.element.advantage:
                # Deal advantage damage
                damage_dealt = self.value * 2
                self.target.hp -= damage_dealt
            
            # If no advantage, deal standard damage
            else:
                damage_dealt = self.value
                self.target.hp -= damage_dealt    

        return damage_dealt
frigid plover
#

Is this good practice?

#bosses.py
class MyBoss(Boss):
    def __init__(self):
        self.skills = [skills.Bite(self.__class__),]
        self.hp = 100 # for example purposes

#skills.py
class Bite(Boss_skill):
    def __init__(self,boss_class)
        self.source = boss_class
    def action(self):
        self.source.hp += 50 # Bite heals skill owner
vivid bone
#

ah so i was thinking you were attacking the boss maybe

#

i made a basic example

#
class Enemy:
    def __init__(self, hp):
        self.hp = hp

class Attack:
    def __init__(self, damage):
        self.damage = damage


def deal_damage(enemy, attack):
    print("HP before attack:", enemy.hp)
    enemy.hp -= attack.damage
    print("HP after attack:", enemy.hp)


tackle = Attack(3)
monster = Enemy(10)

deal_damage(monster, tackle)
#

i don't 100% understand what's going on w your code but it seems unnecessarily complicated maybe

#

let me adjust my example now that i know the skill belongs to the boss

#

ah so it looks like,

#

you're making a special kind of attack, that has a special effect (life steal)

#

what you can do is have each skill have a "type" attribute, and dictate behavior based on that

#

okay here

#
class Character:
    def __init__(self, name, hp, skills):
        self.name = name
        self.hp = hp
        self.skills = skills

class Skill:
    def __init__(self, damage, skill_type):
        self.damage = damage
        self.skill_type = skill_type


def attack(user, target, skill):
    print(user.name, "HP:", user.hp)
    print(target.name, "HP:", target.hp)
    print(user.name, "attacks", target.name, "for", skill.damage, "damage")
    
    target.hp -= skill.damage
    if skill.skill_type == "life steal":
        user.hp += skill.damage  # todo: add code to divide by 2 and round
        
    print(user.name, "HP:", user.hp)
    print(target.name, "HP:", target.hp)

# Make skills
bite = Skill(3, 'life steal')
stab = Skill(5, 'standard')

# Make characters
player = Character('Player', 12, [stab])
boss = Character('Boss', 10, [bite])

# Boss attacks player (example)
attack(boss, player, bite)
#

this should have the effect you want

#

does that make sense?

acoustic herald
#

Should I use classes while making a game or global variables?

frigid plover
#

update: it worked šŸ™‚

vivid bone
vivid bone
frigid plover
#
self.__class__
#
self.__class__
vivid bone
#

i wouldnt make a different class for every enemy or skill though

#

that's a mistake i made myself early on

acoustic herald
#

Is classes faster than global?

vivid bone
#

having a ton of global variables is generally a bad practice to avoid as much as possible

#

you wanna keep your stuff in neat little boxes when you can

frigid plover
vivid bone
#

best to generalize your code as much as possible but that might be too advanced for right now

#

keep on coding, you'll get there

acoustic herald
vivid bone
#

I guess it depends on what you’re trying to achieve

#

Are you planning on having multiple different types of loops with different attributes? Then use a class

#

Are lvl1 and lvl2 one-time values you don’t plan to ever change? Then i guess define them once as global variables and move on

acoustic herald
#

If i want them to be deciding the game loops. Like: ```py
while lvl1:
pass

#

And also a second question. How can I improve the performance of PyGame?

vivid bone
acoustic herald
#

I am asking these questions to get the best performance in my game.

vivid bone
#

I don’t think performance should really be an issue but here

acoustic herald
#

And how can I possibly make the games so that every player would move in the same speed without it depending on the performance of the computer.

vivid bone
#

probably this is a matter of choosing a framerate and updating the screen based on that

#

set an fps constant to 30 or 60 or whatever, then add a line to your game loop to wait for the clock to tick

acoustic herald
#

Okay.

vivid bone
#

i mean this is for normalizing game speed on one local machine

#

if you mean online multiplayer, idk anything about that

acoustic herald
#

Local

safe spade
#

if you want you can use my basic system of server/client

surreal ibex
#

would it be possible to make a Gameboy Advance game in python and then crosscompile to ARM Assembly? I read something saying as long as you can compile/convert it to ARM Assembly you can make a GBA game in almost any language

safe spade
#

Not sure

#

The assembly that use your computer is not same that a gameboy use

#

I think it’s more likely that you wouldn’t be able to traduce it using program

#

Just by the fact that your computer use an assembly that has function who doesn’t exist in a gameboy

#

Also it wouldn’t be very optimized if it’s possible

muted spoke
vivid bone
#

pygame tetris work in progress

muted spoke
#

Well I did a similar

vivid bone
#

nice

vivid bone
#

update

flat aurora
#

Most GBA development is done with C, there’s probably some kind of way to use Rust or something, but even still performance tuning generally needs manually done with assembly

flat aurora
#

In some instances, it can actually be easier to build an emulator for a retro console than to build the games themselves

#

And that can definitely be done in Python(though it’s not the most performant choice for that)

surreal ibex
safe spade
#

Normal, your gb use an assembly in format 8 bits and python use an assembly 64 bits

vivid bone
#

That’s why i’m making a ā€œnes styleā€ game instead. Didn’t feel like learning assembly

dusty bay
#

has anyone tried to use wgpu in pyodide? Does it work?

I managed to micropip.install() it from wheel in the REPL (https://pyodide.org/en/stable/console.html). I can import wgpu but

from wgpu.gui.auto import WgpuCanvas, run

both fail

edit: nvm I think I found the answer - https://github.com/pyodide/pyodide/issues/1911

GitHub

As an example: TensorFlow.js supports a variety of platforms and backends, including: TensorFlow.js CPU Backend, pure-JS backend for Node.js and the browser. TensorFlow.js WebGL Backend, WebGL back...

thick egret
#

Has anyone used Godot with "python runtime support" by chance?

bitter mist
#

is there any engine for python

bitter mist
#

i thought it supports gd script, visual script and c#

flat aurora
#

I believe there are some level of third party runtimes which add varying levels of support for Python, but it isn’t an officially supported language as far as I’m aware

#

For Python there’s Arcade or Pygame for 2D, and Ursina is popular for 3D. There’s also Pyglet but that tends to be a bit lower level(more like a multimedia framework than a game engine)

bitter mist
#

wait godot has a module for python

granite lichen
#

@vivid bone this game me so many fun ideas for practice thanks for posting

vivid bone
#

Oh ty!

thick egret
# bitter mist does godot supports python?

I heard it can but I'm not sure if it completely replaces gdscript. People just keep telling me to learn gdscript instead of python but the only reason I even consider godot is for python practice.

bitter mist
#

I am goinf to learn gd script instead of using python in godot

gusty path
#

Im new programming python things

#

here is an ez and boring pong game

frank fieldBOT
gusty path
frigid plover
# vivid bone ```python class Character: def __init__(self, name, hp, skills): sel...

The thing with this implementation is that i will have LOTS of different boss skills, with some characteristics that are specific to that skill, like dots, hots, passives, actives which means that eventually, i will have lots of "skill_types" which will need its specific block:

if skill.skill_type == "life steal":
    user.hp += skill.damage
#

altough i like the idea of having my skills being made like this:

# Make skills
bite = Skill(3, 'life steal')
stab = Skill(5, 'standard')
vivid bone
#

for sure, yeah that's the idea, having a block of if statements, one for each unique skill type

#

i'm sure there's a better way of doing it, but i feel that's still better than having a new class for each type of skill?

#

the if statements would take up less space

frigid plover
#

right now i have a Boss_skill() class that has methods like resolve_skill() that triggers the skill effect and find_priority_target(), and all my boss skills inherit from Boss_skill()

#

with ALL my skills that any boss would use

#

with all bosses having a list of whatever skill class they use

vivid bone
#

either way you'll have to dictate that behavior for each skill type somewhere, yeah

#

if you have a system that works then that's good

#

worry about optimization later maybe

frigid plover
#
class Bite(Boss_skill):
    def __init__(self, boss: Boss, targets: list[Player]) -> None:
        super().__init__(boss, targets)        
        self.name = "Bite"
        self.cast_time = 2
        self.spell_power = 1.2
        self.description = r"Life Steals 20% damage of damage done"
        self.targeting_type = 'tank'
        self.current_target = self.find_taget(self.targeting_type)
        
    
    def effect(self):        
        dmg = calc_tick_dmg(self.source.attack,self.current_target.defense,self.spell_power)
        self.current_target.take_damage(dmg)
        self.source.heal(0.2 * dmg)

#

here's how it looks

#

but now that i talked with you i think that it would be better to pass stuff like cast_time and spell_power as a parameter into the Bite class, so that different Bosses can have different values on a Bite skill

#

it's great to have someone else to share ideas, thanks a lot!

vivid bone
#

oh ty, yeah it's def helpful for me too to discuss code w people

dawn quiver
#

Hello everyone, is it a way to create a rpg in a browser with python? I heard about pyjs

severe wedge
#

Yo what kinda code would i do to see if a player has a certain role or not

#

Like

#
For role in msg.author.roles:
     If role == ā€œvipā€:
     . . .```
lunar venture
severe wedge
#

Ye

#

Idk what imma supposed to use

vivid bone
dawn quiver
#

Yes it's javascript, but Im not going to learn Javascript when I already know Python šŸ™‚ I'm sure in the future we could convert any programming langage in another , Pyjamas is a Python converter to javascript for this use, I was asking if some of you knew another way or if some people already tried pyjs for making a game

safe spade
#

question : anybody know how to open file with a custom format for extract value

safe spade
#

can you give more context?

severe wedge
safe spade
#

a

safe spade
#

no

#

i would like to get value from it using a special format

#

but for your question i advise to ask it i the discord-bot channel

severe wedge
safe spade
#

nono

severe wedge
safe spade
#

i use a special a format to read it

#

.py is a type of format

#

.pdf also

severe wedge
#

Oh wait do u wanna have a file with a variable that nobody can see?

safe spade
#

do you know how format work?

severe wedge
#

Sorta

#

🤷

safe spade
#

ah

#

a format is a way to read a file

severe wedge
#

Ohhhh

safe spade
#

for example with pdf the programs made for this format would scann the file for find the things he is schearching

#

wait

gentle falcon
#

I am learning pygame and till now I have successfully added a backgroung image to the game window. Now I want to add the player image but it is too large in size. How can I crop it?

#

NVM guys I got it

crisp gust
meager osprey
#

`def checkCollision():
for pipe in pipe_list:
if square.colliderect(pipe):#Problem
print("collide")

if square.bottom >= 900 or square.top <= -100:#This works fine
    print("Collide")`

Collision is even detected between two bodies when they are not touching. Please help.

dawn quiver
#

Use euclidean distance

dawn quiver
crisp gust
dawn quiver
#

You can even use it for cyber security

proper peak
#

You can use it to create Linux drivers, you can use it to control levels of computer hardware that would be harder with high level languages, you can even use it to create efficient apps and games
that's quite a lot of extremely niche stuff šŸ˜›

crisp gust
dawn quiver
proper peak
#

not sure about cybersecurity, even. If you mean high-performance cryptography algorithms, sure, if you mean writing safe software - something like Rust might be nicer

dawn quiver
proper peak
dawn quiver
crisp gust
#

it's what it's designed for

dawn quiver
#

i know

#

C++ is just a high level and object oriented programming version of C

crisp gust
#

but it has the same downsides as C.

dawn quiver
#

like what

#

most AAA games including are coded in C++

crisp gust
#

just generally harder to write than a lot of newer languages

dawn quiver
crisp gust
dawn quiver
crisp gust
#

yes

#

it has a high level API that doesn't require you to go low level like C.

dawn quiver
#

it does not use C

crisp gust
#

i never said it did

dawn quiver
#

C++ is high level in general

crisp gust
#

ok i'm not arguing

#

ask anyone and they will say newer languages are easier to write than C

dawn quiver
crisp gust
#

if you know C then great but telling someone to learn a language they most likely will never use and forget after a month of not using it isn't the right thing to do.

dawn quiver
#

If I would tell someone which language to learn first, I would just say Python

dawn quiver
vivid bone
#

I’ve been using python for a year but might jump to js just bc i hear there are more jobs for it

dawn quiver
#

do what you love best as long as there are good outcomes out of it

vivid bone
#

I like python fine and feel like i’m decent at it now but still can’t find work with it

#

So i’ll shift to web stuff ig

#

I’d still like to finish my python rpg since i worked on it for like… nine months

dapper moat
#

I have a turtle object which is appearing behind another turtle object, and I want it first one to be visible on top of the second one, can anybody help me out?

flint trail
#

My skills in game development end at creating a platformer game

safe spade
#

personnaly i dont even know how to use turtle for video game

devout rover
#

Can i get help implementing online player collisions for my game. i have collisions between the players and the map but not between the players

tranquil girder
#

How is collision between players different from collision with the map?

vivid bone
#

you can use absolute value and subtraction to calculate distance

vivid bone
#

for my game, i have a list of current entities in the scene, iterate through them and blit them to the screen one at a time

#

if entities are stacking in the wrong order, you can just rearrange their position in the list

#

whatever image is blitted to the screen last will appear on top

#

hope that helps

normal silo
#

C is the lingua franca of the programming world, it is what it is. Learn C, C++, Python, JS, and C#. The more of them you learn, the faster you can learn a new one.

#

(A lot of the new ones you learn are just a variation of what you already know)

vivid bone
#

I’d like to do more C stuff for sure

normal silo
#

(C++ is C with more tools but a couple of downsides that are subtle, it's still good though)

#

(Also don't forget that there are many other options now, like Rust, D (D has improved a lot over time), Zig, Odin, etc)

vivid bone
#

I like programming but it would be nice if someone would pay me for it lmao

normal silo
#

(But C will be around for a very very long time, because the OSs use it and every language uses it to communicate with the OSs and each other, etc)

vivid bone
#

I might shift from python to js and eventually to c

#

Just for funsies

normal silo
#

Seems fine, a scripting language, a web language, and a systems programming language.

vivid bone
#

neither js or c look particularly intimidating after working with python for a year

normal silo
#

JS is a lot better than it used to be. C is still C, but slightly nicer over time (C11 latest, they don't like to change a lot / keep it simple).

vivid bone
#

i messed with js a little and a lot of my python experience seemed to port over

normal silo
#

Yeah, Python will set you up for success with many other languages (because it's straight forward and not esoteric really).

vivid bone
#

it's all just code with some quirks here and there huh

normal silo
#

Yeah, some new languages are trying to minimize those quirks.

#

Smooth out the edges.

#

Which new versions of JS have for example.

vivid bone
#

i heard good things about typescript

#

heard it helps to avoid errors

normal silo
#

Yes, but I think it makes more sense after learning JS.

vivid bone
#

makes sense

normal silo
#

Kind of how Rust makes more sense if you know C++ (you understand the intent behind the design).

vivid bone
#

foundations first, then variations

potent ice
#

Starting directly on TS can be confusing šŸ˜„

normal silo
#

If you learn JS first you will understand and appreciate typescript and why it does what it does (what problem was it trying to solve in JS).

#

Same with C++ and Rust.

next estuary
#

I'm using Ursina / PIL

tired aspen
#

IM making a 2d game

#

i wan a menu for customizations

#

so i use tkinter for that??

granite lichen
#

pygame seems to be really useful ? @tired aspen

tired aspen
#

Im new to it

vivid bone
#

Pygame mostly is just a couple functions for stuff like displaying an image at a given location, making a screen object and refreshing it

#

There’s like a time delay function

#

Even w pygame you have to build all the features of your game yourself

#

Even low level stuff like scrolling text or menu navigation, you gotta build that

#

Good code practice tho

tired aspen
#

So that i can give some buttons and all

#

Im not able to get the layout of things

vivid bone
#

I havent used tkinter myself

tired aspen
#

So how do u ad buttons to your games

#

??

vivid bone
#

I don’t use the mouse, it’s all arrow keys like a console game

tired aspen
#

Hmm

#

Anyone else hv any idea

safe spade
#

@tired aspen Me

#

I’m creating a video game library and I use tkinter for displaying. I have recently implemented basic ui. The button and the label

#

Here it’s the project

tired aspen
#

k thx

safe spade
#

@tired aspen wait i would post a example of 2d game

safe spade
#

with a system of multiplayer

pearl panther
#

is it possible to rotate shapes when you draw them in pygame? So perhaps something like pyg.draw.rect(screen, color, (left, top, x, y), angle = 50)?

#

or maybe

rect = pyg.draw.rect(screen, color, (left, top, x, y))
pyg.transform.rotate(rect, angle)
frozen knoll
#

You need to use a transform I think.

#

The former works with the arcade library, but not pygame.

vivid echo
#

i am just starting

#

i am using pygame 0

vivid bone
#

Congrats! Start small.

viscid solstice
#

Does anyone know how to change a arcade window name?

#

I thought this would do it but it didn't.

flat aurora
#

You need to pass the screen title to the window constructor, there's a few ways but depends on how you're starting a window. If you are subclassing window then pass that SCREEN_TITLE variable into the constructor like super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)

potent ice
#

only the first two parameters are positional

viscid solstice
#

Okay thank you.

orchid sage
#

I'm having trouble installing pygame on a Raspberry Pi. I've updated to Python 3.8, upgraded pip, but when I try to install pygame I get ERROR: Command errored out with exit status 1: python setup.py egg_info

hazy cliff
#

Do you guys know how to make builds from the game, if I have it as a PyCharm project, using images, json files, and multiple codes? (pygame game)

hazy cliff
#

Buildozer can barely do anything - You can't even use it on windows, let alone the fact it can't even build for windows

acoustic herald
#

@light jacinth How can I make your code so that it stops when it collides with the ground? I'm the guy you helped in #help-dumpling.

#

Please help me.

light jacinth
#

the if self.y > 400 was the check for whether we hit the ground

#

so you can change that to work with other surfaces ig

#

maybe have a list of collideable objects and check for each one

acoustic herald
#

I did it but when the player falls it goes through the ground.

light jacinth
#

hmm

acoustic herald
#

Like thispy def model_grav(self): dt = time.time() - startdt acc = 3000 #if self.y > 400: for event in pygame.event.get(): if self.p.colliderect(ground.g): acc = min(acc,0) self.vel = min(self.vel,0) self.y = 400 self.isjump = False self.vel += acc*dt self.y += self.vel*dt

light jacinth
#

you wouldnt want to set y to 400 then

#

or actually nah that would be fine since its still the same position

acoustic herald
#

because i want that i have multiple platforms on the screen

#

@light jacinth ||sorry for pinging||

light jacinth
#

i guess i have something working

#

but im reinventing the wheel each time

acoustic herald
#

k

light jacinth
#

because i havent done game dev in ages

acoustic herald
#

k

light jacinth
#
        self.model_grav()

    def model_grav(self):
        dt = time.time() - startdt
        acc = 3000
        if self.on_ground():
            acc = min(acc,0)
            self.vel = min(self.vel,0)
        self.vel += acc*dt
        self.y += self.vel*dt
    
    def on_ground(self):
        if self.y > 400:
            self.y =  min(self.y,400)
            return True

        for x1,x2,h in platforms:
            if x1<=self.x<x2 and abs(self.y - h) <10:
                self.y = min(self.y,h)
                return True
        
        return False

platforms = [(0,100,300)]
``` here's what i did
#

but like, doesnt sound very pygame to me

acoustic herald
#

uhm

#

this wont work with pygame..

#

.

light jacinth
#

its working for me but ill admit there are definitely better ways of doing it

acoustic herald
#

okay

light jacinth
#

might wanna wait for someone from here to help because this isnt my territory

acoustic herald
#

okay

#

@light jacinth I fixed it. Thanks.

light jacinth
#

for fun i made a few visible platforms, but the hacky way i wrote platform collision isnt helping

#

rn if i walk off a platform and immediately go back i end up half under the platform 🤷

#

intended game design ofc

lyric nacelle
#

how can i get started with pygame and will i need to used other programmming languages\

potent ice
#

There is a "getting started" section

lilac hawk
#

Hey just a general question out of interest but are there more efficient ways to program a game-bot except making use of openCV and pyautoGUI because there arent much resources available on youtube and the internet has the tendency to not explain certain mechanisms ...thx in advance (Bot is meant for a PvE-Game and some experience in automation )

daring yacht
#

Anyone here know pygame proficiently dm me

torpid matrix
#

Does Anyone Know How To Game Devolopment In Pygame?

potent ice
#

There are so many resources on pygame out there

#

Free videos, books, tutorials etc etc

lunar mantle
#

In my 2022 list of stuffs I want to learn game development is one of it. Somehow please recommend me from where to start ?

dawn quiver
#

monogame c#

safe spade
acoustic herald
formal basin
#

can anyone help me pls? im new to pygame and for some reason my background image not showing in pygame window

acoustic herald
#

What is your code?

granite lichen
#

@vast hedge did you create a display surface? Once that object i.e. screen is created you can blit something on it.

vast hedge
#

Not me haha

snow hill
#

and happy new year everyone !!!! šŸ™‚

trail dome
lunar venture
round obsidian
potent ice
#

It's definitely super hard if pure python, but we do have C extensions so we can hook into neat stuff šŸ˜„

hollow dock
#

sickkk

peak mountain
#

can someone please help with this problem

potent ice
#

gd scripts are not really something we can help with here I think

peak mountain
#

oh ok

wanton needle
#

hey some one have a 32x32 pixels or more tileset with grass, stones and water???

potent ice
wanton needle
#

thanks!!!!

west pollen
#

I am new to python and pygame and I am having a problem making leader board in pygame can anyone help me ?

snow hill
west pollen
#

thank you

potent ice
#

Also, smaller very specific problems are easier to deal with here. If you have a larger problem you are better off breaking things down into smaller parts.

west pollen
#

noted

potent ice
#

I think this applies pretty much anywhere

acoustic herald
heavy cedar
#

Hello just another lost soul stumbling into game dev. I just wanna make a console text based game with single key input without pressing "Enter" but i also need to get string input sometime like names and so on. How should i get do it? is it right place to ask questions like that or shld i go to help channels? Thank you in advance.

pearl panther
dawn quiver
tranquil girder
#

It's Godot

frozen knoll
#

New demo video for the Arcade library, in celebration of its 6th birthday!

scarlet rock
#

very cool! was angry birds really made using this?

granite lichen
# west pollen thank you

Clearer Code, a YouTuber has a really good pygame introduction on his channel. It's about 4 hours long, but after the 1-2 hours you should be able to make the leaderboard.

dawn quiver
#

Is there anyway to make a character move on the terminal. Im trying to create a rpg text game that runs in a terminal

rich barn
#

Anyone familiar with openvr here?

#

I'm trying to call the PollNextEvent function within Python using the Python openvr package

#

But I can't since I don't know what parameter to put in there

proper peak
# rich barn

Looking at the usage of that function in the library itself, it's used like this:

event = openvr.VREvent_t()
has_events = self.hmd.pollNextEvent(event)
#

so you create an empty event and pass it to pollNextEvent to be filled.

rich barn
#

Oh wow thank you so much

proper peak
#

This is the way you do a lot of things in C, and it's a bit of a yikes that this wrapper does it the same way as the upstream library, instead of a more pythonic way.

rich barn
#

From where did you find this code?

#

In the openvr library itself?

proper peak
frank fieldBOT
#

src/samples/glfw/hellovr_glfw.py line 402

has_events = self.hmd.pollNextEvent(event)```
rich barn
#

Thanks. Didn't expect to get help this fast!

rich barn
proper peak
#

yeah, I'm afraid with a thin wrapper like that you'll have to keep one eye at the docs of the original library, and the other at the bindings' source code 🄓

#

they didn't even bother autogenerating some docs, even though they totally could have

rich barn
#

Thanks again. Really saved my day.

#

šŸ’™

snow hill
rich barn
#

I'm currently working with the API directly because it's a non-game project and can't use game engines šŸ™‚

snow hill
#

Interesting

#

Is that a legal issue ?

#

What prevents you from using a game engine ?

rich barn
# snow hill What prevents you from using a game engine ?

I guess I can. It's just not super convenient. I'm making a tool that allows custom mapping from VR controllers to mouse/keyboard input, so that I can use my VR controllers to navigate my PC desktop when I get my PC connected to my living room TV. As you can imagine, sending direct calls to create mouse/keyboard actions within a game engine is either complex, or probably just impossible when the game window isn't in focus.

snow hill
#

You don’t even need a rendering window

rich barn
#

Yeah no

snow hill
#

Just the input system šŸ™‚

#

Ok, makes sense šŸ™‚

dawn quiver
#

šŸ™‚

wind birch
#

how do u create a game using python?

dawn quiver
#

ya do

dawn quiver
wind birch
#

ik but how like can i have some context

frozen knoll
west pollen
next estuary
#

Anybody have a good example of training bots to play games? I want to teach an AI to play the Catan clone I'm making

snow hill
dapper iris
#

where can i get help with pygame

#

i need a non judgemental person cause i made some weird sh*t

next estuary
#

Ursina

dawn quiver
dapper iris
#

lvl 100

#

tolerable but disturbing

dawn quiver
#

lol 18+?

dapper iris
#

not exactly child friendly

dawn quiver
#

lmfao

dapper iris
#

but not a sex game

dawn quiver
#

kk

#

im 14 so imma head out

dapper iris
#

damn

#

i'm 15 tho

#

its not porn

#

its just 16-rated meme culture sort of

#

nvm i found the solution

summer hatch
#

Hello I have a pygame question. I am trying to make asteroids and wanted to get the harder stuff out of the way first. How can I make a triangle (ship) point at where the mouse is on screen?

next estuary
#
from math import atan2, degrees, pi
dx = x2 - x1
dy = y2 - y1
rads = atan2(-dy,dx)
rads %= 2*pi
degs = degrees(rads)

This will let you calculate the angle between two points

quiet galleon
#

Can anyone please help me in pygame??

potent ice
next estuary
#

No prob! Good luck on your pythoning adventure

summer hatch
#

Thanks figured I could practice some solid OOP with asteroids and I enjoy pygame so I said why not

dawn quiver
#

Hi. Anyone there?

dawn quiver
vague panther
#

Hello guys, should i learn pygame or c++ for game development

mild escarp
#

Rn I'm doing pygame

frozen knoll
#

If you are just learning, I'd recommend something like pygame or Arcade to start. Then jump to unreal or unity. Godot is pretty good too.

spring shuttle
#

hey

#

whats wrong with this code, why is it throwing errors-

what is the error in this C code -

include<stdio.h>

include<stdlib.h>

int main(){
//2d arrays
int nums[3][2] = {
{1,2},
{3,4},
{5,6},

                    };
 int i, j;
 for (i= 0, i<3, i++){
     for(j=0, j<2, j++){
         printf("%i", nums[i][j]);
     };
     printf("\n");
 };
return 0;
potent ice
severe wedge
#

If i do this as an example would the program basically stop until i return Lol?

Lol = hehelol(LOL)
Lol += 2
Print Lol

potent ice
snow hill
#

And there is a missing closing bracket in the end

#

But really the compiler should tell you that already:)

dawn quiver
honest coyote
#

can someone help me make a menu

stable pewter
#

I’m trying to write my first pygame game and having an issue loading a png and was hoping someone could help or point me in the right direction. I am using pygame.image.load(os.path.join(ā€˜graphics’,’Sky.png)) and every time I run my script it says ā€œpygame.error : File is not a Windows BMP fileā€ I have looked at the docs and I believe I am loading the png the right way

dawn quiver
#

Can I ask a question please? :))

#

I am learning pygame and I want a sprite move toward another, I have done a few search but no result. Thanks for all helps!

spare phoenix
spare phoenix
stable pewter
#

@spare phoenix thanks for the advice. That didn’t work either. Turns out when I installed pygame into a venv something got all messed up. Tried reinstalling it into an venv a couple times but it wasn’t seeing python3-dev packages so I ended up installing it globally and it all works now.

spare phoenix
latent sun
#

Question, so I want to make a python ai that is able to play TF2 and beat other bots (on my own server)

#

Any idea as to modules I can use. Would be cool if I could do similar sorta things with other games

dapper iris
#

can please with pygame collision detection

dapper iris
#

nevermind i solved it by myself

#

said every programmer ever

#

*never

robust wadi
#

because Idk why the hell my avatar isn't showing up, when I click the + it just says none and drag and drop doesn't work either

mossy moth
#

why isnt pygame movement working when in a class?

#

i have a function and everything but it wont move it

fast basalt
#

I'm fairly new to pygame and I'm trying to make a 2D plaformer but I don't know how to change the image of my character, any ideas?

proven iris
#

2D = sprite animation

burnt lodge
maiden crane
next estuary
#

Best python module for 3D games imo

robust wadi
broken acorn
#

Hi! I want to learn about pygame but I'm not quite sure where to start off, any suggestions?

gilded portal
#

realpython has a great starting course that I used to get the basis. Many other resources of course but this is simply the one I know
https://realpython.com/pygame-a-primer/#:~:text= Basic Game Design 1 Importing and,control gameplay. ... Every cycle... More

In this step-by-step tutorial, you'll learn how to use PyGame. This library allows you to create games and rich multimedia programs in Python. You'll learn how to draw items on your screen, implement collision detection, handle user input, and much more!

stuck parrot
#

hii

dapper iris
#

but if you want to learn the basics of pygame and or game devlopment then the freecodecamp on where i learned

wheat dawn
#

Making game with python šŸ’€

acoustic herald
#

Does anyone have tips for improving the performance of Pygame and Python? python

normal silo
#

Profile your game and then ask a question about the slow parts.

acoustic herald
#

A platformer.

#

Moving is slow.

#

It has animations and images and stuff.

normal silo
#

Moving is slow, as in your character controller does a lot of work?

acoustic herald
#

Yeah, i guess so.

normal silo
#

Let's not guess. Profile your game.

normal silo
#

A platformer should not be slow unless you have a lot of entities or particles or something like that.

acoustic herald
#

Well, i think that the animations are making it slow.

normal silo
#

The player's animations? All animations?

acoustic herald
#

Player animations.

maiden crane
#

hi

dawn quiver
dawn quiver
normal silo
maiden crane
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
#

@maiden crane ^^^

dawn quiver
maiden crane
#

looks cool

dawn quiver
#

did you notice this lil guy?

#

i drew him. hes from pikmin.

raw shadow
#

hey guys, so i want to make a game in js right, whats a js library that most resembles pygame such as its resemblance to the structure of pygame and the way things are done in a sense

dawn quiver
#

and are you zixtry?

raw shadow
#

i need to have the game on the web

raw shadow
dawn quiver
#

ok nevermind i guess not. your pfp looks similar to someone i know

acoustic herald
normal silo
#

Maybe a bug.

#

Need some code to be able to tell.

frank fieldBOT
#

@stiff bronze Per Rule 6, your invite link has been removed. If you believe this was a mistake, please let staff know!

Our server rules can be found here: https://pythondiscord.com/pages/rules

little dawn
#

hey, is there any lightweight game engine which uses python(insstead of commonly used c++) like unity, godot.... which can make both 2d and 3d games?

normal silo
little dawn
#

i-i mean pygame is only for 2d right?

normal silo
#

Pygame is for 2D games (though you can do 3D if you try really hard, but I don't recommend it).

little dawn
normal silo
normal silo
#

(Because 3D is complicated)

little dawn
#

yeah

#

i was asking similar to godot

#

if not can u suggest some sources where we can use python in godot

normal silo
#

If you mean beginner friendly, and has Python, then I recommend either Ursina or Godot (with Python extension, but you can also just do gd script since gd script is very Python-like).

little dawn
#

some youtube tutorials mabey

normal silo
# little dawn yeh yeh beginner friendly

Ursina is pretty straight forward, the community for it is very helpful. It lacks the giant community of something like Godot or Unity, but it gives the easiest, fastest access to making 3D games with Python.

little dawn
#

gotta check that out

gaunt mountain
#

Anyone wanna be my teammate for pygame??
I also want some experience so that's why too

dawn quiver
#

?

gaunt mountain
#

I jst want for a mini project and we gonna gelp each other too anytime

dawn quiver
gaunt mountain
#

Not full time

#

Like jst for help

#

Uk

dawn quiver
#

but still...feel free to ask-out for help...

dawn quiver
#

It takes less than an hour for learning gdscript it's damn easy, godot's your best shot :)

dawn quiver
#

im using SDL2. When running my game my texture blur together like in the image.

#

its hard to tell but on my screen its definitely there

#

im rendering to texture first then i render it to the screen.

fierce wraith
#

Make sure you set the texture mode to "nearest" if you don't want interpolation

dawn quiver
#

i tried setting it with a sdl2 hint

#

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");

graceful marsh
#

!warn 902273081744166953 Please don't post unrelated content in random channels

frank fieldBOT
#

:incoming_envelope: :ok_hand: applied warning to @sly topaz.

gaunt mountain
#

Hii
Anyone wanna be my teammate in makin games?

fair flax
#

no reply...

meager osprey
#

how i could import tilemap from a json file (exported from tiled) in pygame?

gaunt mountain
gaunt mountain
#

Pygame code
I am making a clicker game but when i press the key then it jst goes and goes and goes
https://paste.pythondiscord.com/hasetudaca.properties
I want to make a clicker game
So i don't want that
I want like
When i click or even hold w the playerYChange should only go up by 1
No matter how much time i hold it i gotta click it another time to get it to 2

random pasture
#

I'm surprised SVGs aren't used for hame development and PNGs are widely adopted

modest crow
#

if i pip install pygame
does that version of pygame has type annotations?

#

i am using pygame.font.SysFont() to display text.
name for the font can be None, but it seems like pyright doesn't like it,

#

it shows this
1. Argument of type "str | None" cannot be assigned to parameter "name" of type "str | bytes | Iterable[str | bytes]" in function "SysFont"

#

and SysFont signature seems to be

(function) SysFont: (name: str | bytes | Iterable[str | bytes], size: int, bold: Hashable = False, italic: Hashable = False) -> Font```
#

in the source code

def SysFont(name, size, bold=False, italic=False, constructor=None):
#

i can't find anyplace where types are written

#

am i missing something?

proper peak
#

search for a file with a pyi extension in the package

modest crow
#

YES!!!

#

thanks

#

found it

#

is it like a error or something?

proper peak
#

what do you mean?

modest crow
#

name can also be None plus others

proper peak
#

I don't see where in this type hint it says that name can be None.

modest crow
#

yes it doesn't

#

but if it is None it uses default font

#

but it isn't in the type annotation

proper peak
#

The font name can also be an iterable of font names, a string of comma-separated font names, or a bytes of comma-separated font names, in which case the set of names will be searched in order.
I don't see the docs mention it can be None either

#

so if it is the case, it's not documented

modest crow
#

should i open an issue or something?

proper peak
#

yeah, you can

#

how do you know it accepts None, by the way? From the code?

modest crow
#

yes

proper peak
#

then yeah, make an issue that this behaviour isn't documented nor reflected in the typehint

modest crow
#

okay, thanks for the help

dawn quiver
#

I made that for school and because I'm a complete no-life I'd like to share it with you, 100 times more experienced internet folks

safe spade
#

Suisse ou franƧais?

dawn quiver
#

suisse

#

why ?

safe spade
#

Your text is in french

dawn quiver
#

indeed

distant badge
#

hi

#

which languages are recommended for game development?

magic flare
#

which are good certificates for game devel, for employment specifically? I am doing CS degree rn. Thanks!

magic flare
torpid siren
#

This is Kal who has much experience in full stack & blockchain & game development

I implemented several P2E games on blockchain and Defi, marketplace and DAO projects.
If you are interested in, please feel free to DM me

Here are my skill sets.

[BLOCKCHAIN]
✪ NFT marketplace, Defi, Solidity, Web3.js, Ethers.js, Ethereum, Solana, Algorand
[FRONT END]
✪ React, Next, Vue, Nuxt, Tailwind CSS, Bootstrap, Material UI, Styled Component
[BACK END]
✪ Node.js, Express, Nest, Laravel, Python,
[DATABASE]
✪ MongoDB, MySQL, Firebase,

gaunt mountain
#

Pygame code
I am making a clicker game but when i press the key then it jst goes and goes and goes
https://paste.pythondiscord.com/hasetudaca.properties
I want to make a clicker game
So i don't want that
I want like
When i click or even hold w the playerYChange should only go up by 1
No matter how much time i hold it i gotta click it another time to get it to 2

fallow glade
stuck parrot
#

hwo should i start gam dev

timid mango
#

first tilemap system

tranquil girder
#

nice

dawn quiver
# timid mango

very cool. try to make it editable through your program.

strange gazelle
#

Hello I'm newher

#

here

potent ice
#

o/

fallow glade
#

Ola

grand whale
grand whale
grand whale
solar raven
#

Is it possible to learn python by coding in mobile? (With the Pydroid app)

#

Tag me for reply

grand whale
#

i learned it from that app

#

nostaglia

#

old days

#

when i doesnt have an computer

#

but lots problems will come with indentations

#

@solar raven

#

but then also u can learn

solar raven
grand whale
#

?

solar raven
grand whale
solar raven
#

How many lines of codes it took?

grand whale
grand whale
#

lines

fathom oxide
obsidian abyss
#

how is this guys

solar raven
vague panther
#

hello guys sorry to interrupt, just wanted to ask, if i wanna get into game dev, should i go for C# or python (pygame), or C++

vague panther
#

what should i start with?

normal silo
vague panther
#

okk

#

thankss

round obsidian
round obsidian
grand whale
obsidian abyss
#

?

#

i can show

grand whale
#

Yea

obsidian abyss
#

wait

grand whale
#

Btw you are Madara uchia the ghost uchia

#

are you reanimated again?

#

LOL

obsidian abyss
#

yea

#

@grand whale \

#

the output

grand whale
#

Ok

#

Oh cool

#

its prerry good

#

*pretty

obsidian abyss
#

thx

#

bye

#

i have work

grand whale
#

Bye

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
valid cosmos
#

Can anyone show the search bar in the exploxer file when it's hidden?

safe spade
west hamlet
#

thats almost as disgusting as using spaces

wise girder
#

Does this have to do with game-development or just your math homework?

west hamlet
#

ohh no wrong channel

wise girder
#

Ok

west hamlet
#

but to answer your question

#

yes

wise girder
#

I see

#

I can't help you tho. Goodbye

#

You could learn octave online

dawn quiver
#

is there a more concise way of writing this?

               int edge = MATCH_GEM_BOARD_EDGE_NONE;
                int index = gem - state;
                int left = 0, right = 0, top = 0, bottom = 0;
                if(index % columns == 0)
                {
                    left = 1;
                }
                if(index % columns == columns - 1)
                {
                    right = 1;
                }
                if(index / columns == 0)
                {
                    top = 1;
                }
                if(index / columns == rows - 1)
                {
                    bottom = 1;
                }

                if(top && left)
                    edge = MATCH_GEM_BOARD_EDGE_TOP_LEFT;
                else if(top && right)
                    edge = MATCH_GEM_BOARD_EDGE_TOP_RIGHT;
                else if(bottom && left)
                    edge = MATCH_GEM_BOARD_EDGE_BOTTOM_LEFT;
                else if(bottom && right)
                    edge = MATCH_GEM_BOARD_EDGE_BOTTOM_RIGHT;
                else if(top)
                    edge = MATCH_GEM_BOARD_EDGE_TOP;
                else if(bottom)
                    edge = MATCH_GEM_BOARD_EDGE_BOTTOM;
                else if(left)
                    edge = MATCH_GEM_BOARD_EDGE_LEFT;
                else if(right)
                    edge = MATCH_GEM_BOARD_EDGE_RIGHT;
                else
                    edge = MATCH_GEM_BOARD_EDGE_CENTER;
tranquil girder
#

you can do top = index / columns == 0for example, at least in python

dawn quiver
frank fieldBOT
mental sun
subtle monolith
#

Hi, I have some trouble with pygame so I need help. I don't know if i'm in the right channel sry. I think I have a beginner level. Sorry for my bad English, I'm french šŸ˜…

olive parcel
#

You should just ask your question, don't ask to ask

round obsidian
summer abyss
#

ooo love it

#

i'll reach your skill one day

round obsidian
round obsidian
summer abyss
#

im assuming you're in the job market

round obsidian
summer abyss
#

not even a student?

round obsidian
summer abyss
#

but not in tech

round obsidian
#

Not directly. I work for a company that publishes stuff for a tech audience

round obsidian
split wigeon
#

hihi I am trying to make a pygame

#

its basically a text based game

stone shadow
#

quit

covert lagoon
split wigeon
plush pebble
#

Whats the simplest way to get keybinds? Like if I press A to do something

covert lagoon
#

Using what library?

plush pebble
#

any

#

I prefferably one that works when the window isnt open

lunar venture
#

keyboard works

#

Just make it a pyw file so it doesn't get a console window

lunar venture
#

Well tkinter won't do the job (Minecraft's window takes priority in full screen mode)

#

I know that from experience

grand whale
#

use pygame_gui

#

for gui stuff

grand whale
#
import pygame_gui
from pygame_gui.elements import UITextBox


pygame.init()


pygame.display.set_caption('Multi-coloured Text')
window_surface = pygame.display.set_mode((800, 600))
manager = pygame_gui.UIManager((800, 600))

background = pygame.Surface((800, 600))
background.fill(manager.ui_theme.get_colour('dark_bg'))

text_block = UITextBox('<font size=5>Enjoy a '
                       '<effect id=spin>'
                       '<font color=#fc2847>R</font>'
                       '<font color=#ffa343>A</font>'
                       '<font color=#fdfc74>I</font>'
                       '<font color=#71bc78>N</font>'
                       '<font color=#0f4c81>B</font>'
                       '<font color=#7442c8>O</font>'
                       '<font color=#fb7efd>W</font></effect>'
                       ' of colours with Pygame GUI</font>',
                       pygame.Rect((275, 140), (250, 120)),
                       manager=manager)

text_block.set_active_effect(pygame_gui.TEXT_EFFECT_TILT, effect_tag='spin')

clock = pygame.time.Clock()
is_running = True

while is_running:
    time_delta = clock.tick(60)/1000.0
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_running = False

        manager.process_events(event)

    manager.update(time_delta)

    window_surface.blit(background, (0, 0))
    manager.draw_ui(window_surface)

    pygame.display.update()```
#

basic code of pygame_gui

#

hopefully this helps you

#

btw install the pacake

#

*pacage

#

pakcage

#

oh

#

yea

#

its very easy

#

are you new to game dev?

#

i can help you

#

are making minecraft title screen?

#

or smthing else?

#

can you send a image

#

sorry i didnt understand it

dawn quiver
#

is there a way to make a 3d game?

exotic niche
#

Ursina

sick eagle
#

hey i have idea for insane game but i am not skilled in programming, i need programmers to script game and i model game with blender

dawn quiver
#

try getting a pc asap

grand whale
dawn quiver
#

nah

grand whale
dawn quiver
#

I started learning on a pc, but ive tried coding on a phone and it isn't as bad as people make it to be

grand whale
#

Yea

#

I coded in mobile for 6 months

#

As a begginer

#

Pydroid

dawn quiver
#
def main():
    global game_speed
    run = True
    clock = pygame.time.Clock()
    dino = Dinosaur()
    cloud = Cloud()
    game_speed = 14

    while run:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
        
        SCREEN.fill((255, 255, 255))
        userInput = pygame.key.get_pressed()
        dino.draw(SCREEN)
        dino.update(userInput)
        cloud.draw(SCREEN)
        cloud.update(userInput)
        pygame.display.update()
        clock.tick(30)

it tell me that cloud.update() takes one input, but 2 where given

#

nvm

wheat ruin
#

i tried running it, is that all of it?

dawn quiver
#

sorry i fixed it

wheat ruin
#

i send u friend request

dawn quiver
#

turns out i forgot to put userInput in the cloud.update

wheat ruin
#

tbh i have no idea what that means

dawn quiver
#

ok so basically

#

i forgot to put an arg in the cloud.update function

wheat ruin
#

ok i tried running it again, and all that pops up is the python shell

dawn quiver
#

ill just send u the code

wheat ruin
#

thanks man, your really cool for doing thisšŸ‘

distant badge
#

What language is mostly used for game development?

#

C++ or C#?

#

thanks

normal silo
distant badge
#

really?

#

which one is being currently used?

normal silo
distant badge
#

ohh hahaha

#

alright

#

thank you!

wheat ruin
#

@dawn quiver

spare kestrel
dawn quiver
#

e

dawn quiver
serene patrol
#

Source code and explanation-

arctic hamlet
#

hey guys

#

i am on a gamejam

rocky kettle
#

Hi all, I just made this new text adventure! I'm really new to python so this is a really big step for me. I really want some feedback on how I can make this better.

potent ice
#

No one learns anything from this. Be more specific about your negative experiences with these libraries.

#

Ok. So you think it was too hard to learn.

#

I'm not quite following. You'll bump into difficult things regardless of language.

storm fog
#

Hi Guys

#

I am Bash, I have made a Project Using Computer Vision, and A.I, and i would like to show it to you.

potent ice
#

Is this game related?

storm fog
#

Yeah it's like an AI

#

app

#

and it has one game in it too which i will add

#

like that is a game which finds the distnace bwteeen your pc and your hands

#

THIS IS HOW THE UI of the app looks like

potent ice
#

I still don't see how this is fully game related šŸ˜„

storm fog
#

like you can see hand distance right

#

it is a game, it finds the disntace between ur hand and pc camera

#

at diffrent positions in the game

potent ice
#

Nice work. I guess at the very least we can say that these are tools that can be used in games. I think that is acceptable šŸ™‚

grand whale
#

??

#

yea

#

but not that hard bro

#

he used mediapipe to make it

#

it very easy libray

#

anyone can make it

#

its a childs play

#

chucky : childs play LOL

still wigeon
#

hey anyone has worked with Ren’Py

tranquil girder
#

why do you ask?

azure atlas
#

Hey, i have a very nice idea i want to share (still no development), if u wanna know more dm me

#

its a pretty cool project

potent ice
rocky kettle
#

what do you all think about this? its my first big project. and im fairly new to python

dark mango
#

hello i am syed
Age- prefer not to say
Hobbies- Games Art Collecting Money
Dislike- Bad words people not believieng me

candid cape
#

Hey PyGame folks - anyone know why when TensorFlow loads pygame keeps opening? I'm getting lots of

pygame 2.1.2 (SDL 2.0.18, Python 3.9.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
pygame 2.1.2 (SDL 2.0.18, Python 3.9.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
pygame 2.1.2 (SDL 2.0.18, Python 3.9.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
pygame 2.1.2 (SDL 2.0.18, Python 3.9.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
pygame 2.1.2 (SDL 2.0.18, Python 3.9.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
pygame 2.1.2 (SDL 2.0.18, Python 3.9.9)

I have my pygame init protected by a if __name__ == "__main__": check

tranquil girder
candid cape
candid cape
dawn quiver
#

guys why i get this error in my game loop? RecursionError: maximum recursion depth exceeded in comparison

#

i also get this error. RecursionError: maximum recursion depth exceeded while calling a Python object

grand whale
#

hmm its a game dev channel

dark mango
#

Can you

dawn quiver
#

@dark mango i don't believe you, lol

potent meteor
#

I was reading back out of sheer interest in what you guys are doing in gaming with Python and.. this is one of the most bizarre channels in this Discord server.

scenic dome
#

What are some game engines you use? I use Panda3D but I do not know how limited it is.

wintry jasper
#

How do I have an idea to make a 3d lol game you want too much memory from the server?
on web

autumn hazel
#

they are trying to make a 3d lol (league of legends) game and are wondering how much memory the servers should have

for a bit of context transferred from web-development channel

fading whale
#

@azure atlas If you're interested in working on a project with other people, please discuss the details here. We aren't too keen on members asking other members to DM them, as it puts our members at risk of scams and exploitation.

#

I've been fairly lenient so far in allow you to discuss this, as we do have rules against promotion and recruitment.

#

If it is an offer of a paid role, it is explicitly not allowed.

fading whale
#

Do you have a GitHub repo for this project? <- An example of information you could provide.

#

But I'm going to have to say no more "DM me for info" posts please.

azure atlas
potent ice
#

That project doesn't have a license. It basically means you have exclusive right to all the code.

#

That is a major red flag if this is supposed to be an open source project

#

I would suggest MIT or BSD license to make it simple šŸ™‚

novel relic
#

i need help ;c

leaden glacier
#

can someone explain the "invalid destination position for blit" error for pygame for me? I googled it and still don't understand /:

dense drift
#

can you add me on disc please :) @modern scarab

lunar siren
#

Hey I need help with pygame

#

here is my window. The bigger white box is a something like a hitbox I am making. I was wondering how I can get the player image in the center of the white box instead of in the corner.

arctic hamlet
#

R u using get_rect

polar fossil
#

is there a kind of code which sees if the first letter of the input of user is a certain letter ?

arctic hamlet
#

Yes u can

If text[0] == 'Letter':
     pass
pine plinth
#

s.startswith(c)

grand whale
#

do like this

#

screen.blit(image,(100,100))

#

@leaden glacier

leaden glacier
#

I figured it out lol, I was blitting them to list items as coordinates, but instead of doing 2 at a time, I was using every number in the list

grand whale
#

Howfully this helps you :)

leaden glacier
#

Thanks though!

leaden glacier
#

I'm used to Tkinter errors that say like "Expected 2 arguments, got 14" or something, which is much different than pygame

grand whale
#

Hmm its in a list thats why

#

Ig

snow hill
#

Flappy Bird-like in a zombie-ish world

#

all in Python :>

barren halo
#

Hello, I'm looking to make a Catan universe mock up, and was wondering if anyone in here could lead me in the right direction of which programming language or libraries I should use

#

It's a 2d board game.

next estuary
desert kernel
next estuary
desert kernel
#

This is even making me blind