#game-development

1 messages ยท Page 65 of 1

jade owl
#

Does anyone know of any good way to implement dragging code?

#

I'm working on making a solitaire game in python

#

Is it just handling the MOUSEUP and MOUSEDOWN events?

ionic depot
#

I think so

frozen knoll
somber bramble
#

hey guys, how are you doing?

Hey, check this out:

I'm creating a web based game, I'll need to have some kind of map, but it's not a common map, its like a galaxy map, a good example is stellaris maps, how can i do something like that in js?

#

something like this

#

i dont need that lines and symbols, just a big galaxy generated with data that I've created

#

with some very basic interaction, like: click a galaxy and zoom in to the planets

dawn quiver
#

hello i am using pygame how can i make my movements smooth?

ionic depot
#

What do you mean smooth

#

You added the speed?

#

@dawn quiver

dawn quiver
#

no

#

not yet

#

how?

ionic depot
#

You should

dawn quiver
#

how?

ionic depot
#

clock = pygame.time.Clock ()

dawn quiver
#

oh

#

no i already added that

ionic depot
#

Between the first lines

#

Okay

dawn quiver
#

my movement is still choppy

ionic depot
#

And clock.tick ()?

dawn quiver
#

yep

ionic depot
#

How much have you put

dawn quiver
#

60

ionic depot
#

Put 100

dawn quiver
#

ok

#

its still a bit choppy

ionic depot
#

A bit

#

How much did you put on width and height?

dawn quiver
#

100

#

100

#

@ionic depot

ionic depot
#

That's not much

#

Send the code

dawn quiver
#

import pygame, sys
pygame.init()

win = pygame.display.set_mode((500,500))
pygame.display.set_caption('BoxBoxTriangle')
clock = pygame.time.Clock()

player = pygame.image.load('assets/player.png')

x = 100
y = 100
width = 50
height = 50
vel = 2

while True:
for event in pygame.event.get():
if pygame.event == pygame.QUIT:
pygame.quit()
sys.exit()
keys = pygame.key.get_pressed()

if keys[pygame.K_RIGHT] and x <500 - width - vel:
x += vel
if keys[pygame.K_LEFT] and x > - vel:
x -= vel
if keys[pygame.K_DOWN] and y <500 - width - vel:
y += vel
if keys[pygame.K_UP]and y > - vel:
y -= vel

win.fill((192, 192, 192))
win.blit(player,(x,y))
pygame.display.update()
clock.tick(100)

#

@ionic depot

ionic depot
#

Put 1000 , 700 at pygame.dsiplay.set_mode ()

#

And then add more at clock.tick

#

For me it moves smoothly

#

When I added more' speed'

#

Or just make the player smaller

#

Idk if it works that way

#

@dawn quiver

dawn quiver
#

@ionic depot thx

ionic depot
#

So , it works?

dawn quiver
#

no

#

@ionic depot

ionic depot
#

Lmao

#

Okay

lusty oyster
#
import pygame, time
pygame.init()

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

textCol = (255, 255, 255)
textFont = pygame.font.Font('freesansbold.ttf', 32)

def drawMenu():
    global rect
    rect = ((50, 50, 50), (400 - 34, 100, 80, 30))
    rect = pygame.draw.rect(win, rect[0], rect[1])
    text = textFont.render("Start", True, textCol)
    textPos = (400 - 32, 100)
    win.blit(text, textPos)

def drawBack():
    global windowRGB
    winRGB = (0, 0, 0)
    win.fill((winRGB))
    time.sleep(1)
    winRGB += 1, 1, 1

drawBack()
drawMenu()
pygame.display.update()
#

So I have this but the background never changes colour.

sacred trout
#

You are indeed drawing it only once. You need to put all this in a loop so that it is drawn every frame

lusty oyster
#

Oh yeah, thanks so much

#

now it is saying
`Traceback (most recent call last):
File "C:/Users/olive/Downloads/Wenrex/Menu.py", line 24, in <module>
while winRGB != (255, 255, 255):
NameError: name 'winRGB' is not defined

`

#

but it is

#

oh i see nvm

lusty oyster
#
def drawSecret():
    global secretRect
    if secretButtonPressed:
        textCol = (255, 255, 255)
        textFont = pygame.font.Font('freesansbold.ttf', 96)
        text = textFont.render("SECRET FOUND!", True, textCol)
        textPos = (0, 300 - 96 // 2)
        win.blit(text, textPos)
        pygame.time.delay(100)
        textCol = (0, 0, 0)
        pygame.time.delay(100)
    secretRect = ((80, 80, 80), (429, 114, 4, 10))
    secretRect = pygame.draw.rect(win ,secretRect[0], secretRect[1])
#

I have this

#

and this is in while true loop

#

drawSecret()

#

but the text doesnt change colour

mental zinc
#

Hello

lusty oyster
#

:3

dawn quiver
#

how do you make code repeat 60 times per second?

#

put it on loop

#

yeah but how do you make it 60

#

do tick.clock(60)

#

but you need to make an var

#

clock = pygame.time.clock()

#

in using tkinter

#

og

#

ok

rotund talon
#

I started studying pygame through school, and theres a question here I got stuck on.
I need to draw 100 lines from the center of the screen, all in the length of 350, to create a "circular" shape from all the end points.
I'll send an image as an example

#

my issue here is purely mathematical, I know how to draw lines its just I have no idea how to perform the movement to achieve this shape

#

I assume its something to do with trigonometry

sacred trout
#

all the endpoints are of the form center + radius * (cos(angle), sin(angle)) idk if this helps

#

the reason is that cos and sin are the projections on the x and y axis of a unit vector of a given angle, so you can get the (x, y) coordinates of a vector with a given angle this way

#

then scale it radius * ... and shift everything so the center (0, 0) become center so center + ...

rotund talon
#

I'll try this, thank you

#

Okay, it comes out pretty close to the end result

#

where my code is like this:

#
    for i in range(100):
        pygame.draw.line(screen, (255, 0, 0), [350,230], [350 + 250*math.cos(i), 230 + 250*math.sin(i)], 1)
        pygame.display.flip()
#

So I wonder what im doing wrong

#

the center point here isn't (0,0), its worth mentioning that

#

its 350,230

#

240*

sacred trout
#

cos and sin want angles in radians, so between 0 and 2*pi. If you want equally spaced rays, you will want the angles to be equidistant in [0, 2*pi]

#

With n rays, it the distance between two angles is 2*pi/n so the i'th angle is i * 2 * pi / n

rotund talon
#

ah okay that worked

#

thanks!

fiery shale
#

Is there a python project game called guess the blocks?

lusty oyster
#
while True:
    event = pg.event.get()
    if event[pg.MOUSEMOTION]:
        print("Moved")
#

not working please help

sacred trout
#

while True:
event = pg.event.get()
if event.type == pg.MOUSEMOTION:
print("Moved")

lusty oyster
#

ok

#

AttributeError: 'list' object has no attribute 'type'

#

So I have an importable script

#

on my scripts

dawn quiver
#

@spare phoenix did u have the invitation by kermit

#

?????

signal root
#

Hello, Im working with Pygame, and Im trying to create a collision system where when my player runs into a rect, its velocity will be reversed (i think thats how it works) so that the player cannot move into the object/rect. I have been looking for a while and Ive not found much. Ive tried a few methods and none have working. Here is my code: https://gist.github.com/ethanedits/391c2e655ce637e655b37d6a736cee09

Gist

GitHub Gist: instantly share code, notes, and snippets.

#

any help would be greatly appreciated

signal root
#

Also the speed is based on FPS which is annoying

jolly sigil
#

Hi, I'm not really sure if this counts as game development but in school we were assigned to create a Rubik's Cube Solver and I never coded before so I have no clue where to start. Can anyone just give me a good starting point or some IDE's that might be useful? Thanks in advance! ๐Ÿ˜„

signal root
#

visual studio code for an IDE, and do u mean create a game or a robot that solves a rubiks cube

jolly sigil
#

Create a game, where you can scramble the cube and it finds the fasters route to solve it

dawn quiver
#

can anyone help me with a socket io game im working on

glossy gust
#

@jolly sigil download Pygame ๐Ÿ˜Ž

dawn quiver
#

lmao i hate pygame now after making a platformer a year ago

sacred trout
#

@jolly sigil download Pygame ๐Ÿ˜Ž
@glossy gust You don't need graphics to do this... you need to 1) learn python 2) write down precisely what the movement of the cube are 3) implement how you would solve the cube by hand

#

And 4) if you are very good, learn how good algorithms work to solve it in a few movements (they are quite complicated and interesting)

jolly sigil
#

Thanks guys, I've downloaded all the programs now and I'm starting to decompose the problem. Fingers crossed it all works out ๐Ÿ˜„

glossy gust
#

@sacred trout my bad I thought he needed graphics to show what the cube looks like

#

like colors

jolly sigil
#

@sacred trout my bad I thought he needed graphics to show what the cube looks like
Yeah, i wanted to have a 3D simulator of what the cube looks like so that the user can rotate it and have a look at it. I don't know if that's too ambitious though...

sacred trout
#

Your whole project is ambitious, but doable ๐Ÿ˜‰

#

It is a bit more than a one weekend project if you've never coded though

jolly sigil
#

Yeah I agree.. it's going to be pretty hard. We have the whole academic year to finish it though so I think I have time to learn ๐Ÿ˜„

glossy gust
#

O coool

#

lol

sacred trout
#

That's cool !

#

Then you just need to start by learning python. First objective could be to code a "guess my number" game in python after learning about loops and conditions

silver coral
#

hey i am currently trying to make a text based game in python becuase i wanted to try something else after doing it in C++

#

i made a prototype for it in C++ and it was a good prototype, it was a turn based rock paper scissors rpg type of game. and i balanced a lot of it for melee combat but i have no idea how to balance it if the player wants to used ranged attacks

#

the way it works is each there are three types of melee attacks and defenses, each count the same attack and defense. aka pierce attacks are countered by parries. and if the same attack hits each other they get into a bind, if two defenses hit nothing happens.

#

if you block an attack you get a pot shot in as well. but i cant seem to find a way to make bows and arrows/ranged magic fit into this system

#

there is melee magic

#

but not ranged. and i dont know what to do for it

#

i could make ranged spells and bows be a special move used once per turn

#

but idk

#

maybe that will be what will be done but idk

signal root
lusty oyster
#

@signal root What is the error

#

You could use if

if player.collidepoint(rect.collidepoint):
  touchingWall = True
#

Then in your walking thing

#
if touchingWall:
  return
#

before the rest of the code in that function

dawn quiver
#

how do i make games?

#

like minecraft

#

(i only know till if and else statements)

#

anybody?

steel geyser
#

There is a lot of work from just if/else to something like minecraft. @dawn quiver

#

Do you know about OOP ? Classes, methods, functions ?

#

Loops (while/for) ? Lists ?

#

If not, you should learn basic python stuff before trying to make such a big game.

#

There are good resources listed here :

#

!resource

frank fieldBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

dawn quiver
#

k cries

frozen knoll
signal root
#

@lusty oyster I apologize for not giving you an error, the previous methods ive tried did not give me an error, I just didnt get the collision. And for the code you provided. i would put ```python
if player.collidepoint(rect.collidepoint):
touchingWall = True

lusty oyster
#

Ok

#

so

#

if player.collidepoint(rect):

#

remove collidepoint on the rect

#

should work

#

@signal root

signal root
#

remove collidepoint on the rect
@lusty oyster what do you mean by this?

lusty oyster
#
if player.collidepoint(rect)
#

just use that

signal root
#

where

#

i get that, this is where i would stop my player, reverse velocity etc

#

but where would i put this if statement? It needs to be constantly run to check if a collision happens

#

So would i just throw it in an infinite loop?

#

@lusty oyster

lusty oyster
#

no

#

put it in your keydown event

signal root
#
keys = pygame.key.get_pressed()

    if keys[pygame.K_a] and man.x > man.vel:
        man.x -= man.vel
        man.left = True
        man.right = False
    elif keys[pygame.K_d] and man.x < scrWidth - man.width - man.vel:
        man.x += man.vel
        man.right = True
        man.left = False
    elif keys[pygame.K_w] and man.y > man.vel:
        man.y -= man.vel
        man.left = False
        man.right = False
    elif keys[pygame.K_s] and man.y < scrHeight - man.height - man.vel:
        man.y += man.vel
        man.left = False
        man.right = False
    else:
        man.right = False
        man.left = False
        man.walkCount = 0
    if player.collidepoint(rect):
        print("Collision!")

    redrawGameWindow()
#

like that

#

@lusty oyster (should i ping u or no?)

lusty oyster
#

its fine

#

just put it in your loop

#

main

signal root
#

I moved it above the keys bit, and below the for event loop. Now im getting an error: 'player' object has no attribute 'collidepoint'

#

@lusty oyster

lusty oyster
#

hm

signal root
#

would you like me to put my code in a pastebin or something

ionic depot
#

What are you trying to make?

#

@signal root

signal root
#

collision detection in pygame

ionic depot
#

Have you watched this vid?

signal root
#

yes

ionic depot
#

And?

signal root
#

@lusty oyster so what do you think is the solution

#

it didnt work @ionic depot

lusty oyster
#

colliderect

ionic depot
#

Wow

lusty oyster
#

try that

frank fieldBOT
#

Hey @signal root!

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

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

signal root
#

bruh

frank fieldBOT
signal root
#

brudda

#

y u bully

small hull
#

I have a super weird problem

#

my if statement

#

I first print it (it prints False)

#

wait nvm I got an idea

signal root
#

@ionic depot can u help me out with the collision detection

ionic depot
#

@signal root Idk how can I help you

#

If that vid didn't help you

signal root
#

do you know how to do collisions

ionic depot
#

No

#

But it says in the vid

icy steppe
#

hey all

#

does anyone have any recommendations for 3d physics engines to implement in an existing engine?

#

have been looking at pybullet but I'm not sure what's out there or what's best for the job

#

my only requirement is that i can apply arbitrary forces to objects (i'm trying to make a fancy boid simulation)

#

thought this might be the best place to ask ^^

signal root
#

I dont have any suggestions for a physics engine, but are you creating a 3d engine in python?

#

@icy steppe

icy steppe
#

I dont have any suggestions for a physics engine, but are you creating a 3d engine in python?
@signal root not a full engine, just a harness for running some simulations I've gotta run

#

I was rolling my own physics engine up until now, but it's become too much work than it's worth

signal root
#

cool

#

are you doing raycasting? or full 3D

#

im just curious

icy steppe
#

๐Ÿ™‚ no problem

#

it's something for my work so I can't divulge too much info but I can talk about it a little bit

signal root
#

alright

icy steppe
#

(removed because i'm sure that this was probably personally identifiable info)

#

and it doesn't display realtime actually, it renders out to a few different filetypes

#

the main one I use is SVG, and I just did a lot of cheap tricks with translate3d to get that to work hehe

#

it's not as solid as it should be to be honest but it works really well for our use-case

signal root
#

sounds interesting. I dont have much experience in the 3D physics world, so i cant give you any useful info, but good luck!

ionic depot
#

Ask a professional ...

icy steppe
#

lol

ionic depot
#

:))

icy steppe
#

I am a professional ahaha
I've just never had to write physics simulation code this complex

ionic depot
#

Yeah

icy steppe
#

usually I write in Ruby! this gig is new to me

#

so I'm real unfamiliar with the python ecosystem

ionic depot
#

Eh

#

You will get used to it

#

It's not that hard

icy steppe
#

thanks!

dawn quiver
#

@Dp_dontmiss Pls accept the invitation of kermit

ionic depot
#

Lmao

#

Who's this guy

#

@icy steppe how many years of experience do you have?

icy steppe
#

@ionic depot with Python? or with writing code in general?

#

ion know I walked into an interview lol

ionic depot
#

Writing code In general

#

With any programming language

icy steppe
#

5-6 yrs professionally, I'd say 11 years as a hobby
would have to check my linkedin to be sure

ionic depot
#

Wo

#

A lot

icy steppe
#

ion know that i walked into an interview lmao

ionic depot
#

Have you build an AI till now?

icy steppe
#

never studied ML

#

been to a few ML workshops though, which were fun

ionic depot
#

Oh , okay

#

Cause I want to build an AI

icy steppe
#

oh yeah? What for?

ionic depot
#

For a game

#

Nothing special

#

Just for fun:))

icy steppe
#

very cool

ionic depot
#

Yeah

icy steppe
ionic depot
#

Thank you!

icy steppe
#

no problem

signal root
#

Hello, ive been workign with pygame trying to do a collision system. and ive been having issues with my code. Basically I have a player class, and inside that player class there is a self.rect which is equal to pygame.Rect blah blah blah. thats all well and good, and I can see that rect is working because I drew it, and it displays the correct size and all that. Now my main issue is when I try to detect collisions with other rects. I tried doing python if player.rect.colliderect(rect): print("Collision!") and I just get an error saying type object player has no attribute rect even though i assigned it self.rect. I dont know why this isnt working. Here is my full code:https://gist.github.com/ethanedits/c9d0eaa5bf90a7a9a8085fae86a0bcfa

Gist

GitHub Gist: instantly share code, notes, and snippets.

tranquil girder
#

I think you meant man.rect, not player.rect
This is why it's a good idea to capitalize class names

signal root
#

ill try that out

paper birch
#

what's the difference between community pycharm and pro

tough coral
#

community pycharm is pycharm pro, but a version that's about 6 months old, iirc. It should be fine for pretty much 100% of users.

fast moth
#

is coding hard?

tough coral
#

at times, yes. At other times, also yes. But practice makes it easier.

signal root
#

@tranquil girder i did that, same error

tranquil girder
#

You haven't defined rectanywhere. The one you're trying to colliderect with

#
line 86, in <module>
    if man.rect.colliderect(rect):
NameError: name 'rect' is not defined
signal root
#

Ok, so i tried doing this instead: ```python
if man.rect.colliderect(wall.rect):
print("Collision!")

#

@tranquil girder

#

Ok, so how would i reference it if its from pygame?

tranquil girder
#

False

#

But again, you're referencing the class and not the instance

#

the instance is called collider1

#

Yeah, the rects don't update either, so they will never collide

signal root
#

ok

#

so instead of rects i should be using sprites?

#

What if I want a invisible collider

#

@tranquil girder

tranquil girder
#

I don't know much pygame, sorry

signal root
#

oof ok

cinder nacelle
#

I can't seem to animate pygame movement properly despite having all the files needed...

silver coral
#

i think general is a bit busy so ill try here because my code is a game

#

i think its simple but i dont know why it doesnt do what i need it to do

#

basically

#

when a player types in an attack a bool goes true

#

when the enemy then reacts to that then selects an attack another bool goes ttrue

#

when both are true it prints that i got that far

#

but it doesnt

signal root
#

@cinder nacelle I will be happy to help you out later tomorrow. I apologize if you need assistance earlier than that, but just dm me or ping me tomorrow (Iโ€™m EST time) and Iโ€™ll help you out ๐Ÿ™‚

cinder nacelle
#

Thanks

lusty oyster
#
import pygame as pg
pg.init()

display = pg.display
MODE = pg.RESIZABLE
win = display.set_mode((400, 300), MODE)

image = pg.image
transform = pg.transform

class Player:
    def __init__(self, sprite, size, pos):
        self.sprite = image.load("Llama.png")
        self.size = (200, 200)
        self.pos = (200, 100)
        self.sprite = transform.scale(self.sprite, self.size)

        player = Player()

win.blit(player.sprite, player.pos)
#

How do I fix this?

#

I get

#
Traceback (most recent call last):
  File "C:/Users/olive/Downloads/main.py", line 20, in <module>
    win.blit(player.sprite, player.pos)
NameError: name 'player' is not defined
>>> ```
#
import pygame as pg
pg.init()

display = pg.display
MODE = pg.RESIZABLE
win = display.set_mode((400, 300), MODE)

image = pg.image
transform = pg.transform

class Player:
    def __init__(self, sprite, size, pos):
        self.sprite = image.load("Llama.png")
        self.size = (200, 200)
        self.pos = (200, 100)
        self.sprite = transform.scale(self.sprite, self.size)

        player = Player()

win.blit(player.sprite, player.pos)

I get

Traceback (most recent call last):
  File "C:/Users/olive/Downloads/main.py", line 20, in <module>
    win.blit(player.sprite, player.pos)
NameError: name 'player' is not defined
>>> 
frank fieldBOT
#

:incoming_envelope: :ok_hand: applied mute to @lusty oyster until 2020-09-30 06:30 (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

pale schooner
#

!unmute 413916672001441793

frank fieldBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @lusty oyster.

pale schooner
#

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

ionic depot
#

@signal root can you help me with sprites?

pale schooner
#

please use this thanks

dawn quiver
#

oops

#

so you can't create a new object of same class inside __init__

lusty oyster
#

wdydmddwdyam

#
import pygame as pg
pg.init()

display = pg.display
MODE = pg.RESIZABLE
win = display.set_mode((400, 300), MODE)

image = pg.image
transform = pg.transform

class Player:
    def __init__(self, sprite, size, pos):
        self.sprite = image.load("Llama.png")
        self.size = (200, 200)
        self.pos = (200, 100)
        self.sprite = transform.scale(self.sprite, self.size)

player = Player()

win.blit(player.sprite, player.pos)
dawn quiver
#

yes

lusty oyster
#
Traceback (most recent call last):
  File "C:/Users/olive/Downloads/main.py", line 18, in <module>
    player = Player()
TypeError: __init__() missing 3 required positional arguments: 'sprite', 'size', and 'pos'
>>> 
dawn quiver
#

yeah you need to give 3 args to Player()

lusty oyster
#

so waht do i give it

dawn quiver
#

what you defined in __init__

#

sprite, size, pos

lusty oyster
#

class Player:
    def __init__(self, sprite, size, pos):
        self.sprite = image.load("Llama.png")
        self.size = (200, 200)
        self.pos = (200, 100)
        self.sprite = transform.scale(self.sprite, self.size)

player = Player(sprite, size, pos)

win.blit(player.sprite, player.pos)
#

not work

#
Traceback (most recent call last):
  File "C:/Users/olive/Downloads/main.py", line 18, in <module>
    player = Player(sprite, size, pos)
NameError: name 'sprite' is not defined
>>> 
dawn quiver
#

okay wait

lusty oyster
#

coding is a pain in the fing ass

dawn quiver
#
class Player:
    def __init__(self):
        self.sprite = image.load("Llama.png")
        self.size = (200, 200)
        self.pos = (200, 100)
        self.sprite = transform.scale(self.sprite, self.size)
#

this should be the class

lusty oyster
#

still same error

dawn quiver
#

you don't need to specify sprite, size, pos in the init because you are creating those inside init

lusty oyster
#

doesnt work

#

srptie is not define

#

sprite8

dawn quiver
#

now change back player = Player()

lusty oyster
#

ssprte*

#

tanks

lusty oyster
#

is it better to have a different class for each sprite, or one class for all sprites

#

@dawn quiver

dawn quiver
#

uhh you are creating a sprite as an attribute to each player

lusty oyster
#

?

#

what does that mean

#
pg.draw.rect(win (0, 0, 0), (player.pos, player.size))
#
Traceback (most recent call last):
  File "C:/Users/olive/Downloads/main.py", line 44, in <module>
    pg.draw.rect(win (0, 0, 0), (player.pos, player.size))
TypeError: 'pygame.Surface' object is not callable
>>> 
tough coral
#

you're missing a comma after win

lusty oyster
#

ah yes thank you

hasty sand
#

hello dear pythonians, i need some help.๐Ÿ™ i am trying to install questionary (https://github.com/tmbo/questionary), but the install fails spectaculary (i am on windows unfortunately, my editor is VSCode)... i have no experience with this error as of yet

hasty sand
#

hello dear pythonians, i need some help.๐Ÿ™ i am trying to install questionary (https://github.com/tmbo/questionary), but the install fails spectaculary (i am on windows unfortunately, my editor is VSCode)... i have no experience with this error as of yet
@hasty sand i solved this problem with some help from the roguelikedev community, thanks HexDecimal over there. usin py -3 -m pip install questionary worked...

cinder nacelle
#

@signal root or anyone available... I can't seem to register the left movement

signal root
#

Hey, I can help in a few hrs (sorry) I have a class rn

lusty oyster
#

@cinder nacelle

#

i can help

#

does right work

cinder nacelle
#

yes

#

I just came back from dinner

#

are you alright with looking at it from a stream perspective?

#

@lusty oyster

lusty oyster
#

ok

cinder nacelle
#

oh

#

nvm

#

no stream option

lusty oyster
#

damn

cinder nacelle
#

hmm

lusty oyster
#

call?

cinder nacelle
#

alright

ionic depot
#

Weird

dawn quiver
#

import pygame, sys
pygame.init()

#screen
win = pygame.display.set_mode((500,500))
pygame.display.set_caption('BoxBoxTriangle')
clock = pygame.time.Clock()

#player
player = pygame.image.load('assets/player.png')
player1 = player = pygame.transform.scale2x(player)

x = 50
y = 60
width = 100
height = 100
vel = 5

#tornadoe
tornadoe = pygame.image.load('assets/tornadoe.png')
tornadoe = pygame.transform.scale2x(tornadoe)

tx = 50
ty = 64
twidth = 100
theight = 100

#earthquake
earthquake = pygame.image.load('assets/earthquake.png')
earthquake = pygame.transform.scale2x(earthquake)

ex = 50
ey = 64
ewidth = 100
eheight = 100

#main loop
while True:
for event in pygame.event.get():
if pygame.event == pygame.QUIT:
pygame.quit()
sys.exit()

#playermovementkeys
players = player.copy()
keys = pygame.key.get_pressed()

if keys[pygame.K_RIGHT] and x <500 - width - vel:
x += vel
if keys[pygame.K_LEFT] and x > - vel:
pygame.transform.flip(player, True, False)
x -= vel
if keys[pygame.K_DOWN] and y <500 - width -vel:
y += vel
if keys[pygame.K_UP]and y > - vel:
y -= vel

win.fill((199, 199, 199))
win.blit(player,(x,y))
pygame.display.update()
pygame.time.delay(60)
clock.tick(100)

i am trying to flip an image

#

how can i do it

#

i am trying to do it by if the player presses left arrow key

#

the image flips to the left

#

but it doesnt seem to work

#

any help

jolly palm
#

hey guys can you recommend any tutorial series to code a python jump and run game?

dawn quiver
#

watch tech with tim

#

or watch learn pygame by making flappy bird

#

begginer myself but after 3 days

#

i already know how to make an screen make an image move using keyboard
movement

#

ietc

#

etc

jolly palm
#

ok thx

ionic depot
#

@dawn quiver what image

#

Background image?

dawn quiver
#

player image @ionic depot

ionic depot
#

What exactly are you trying to make?

dawn quiver
#

when the player presses left arrow key the player image flips

#

to the left

ionic depot
#

You should add sprites for it

#

Have you done this?

dawn quiver
#

yes

#

@ionic depot

ionic depot
#

And?

dawn quiver
#

doesnt work

#

i only added one sprite

#

i wanted that one sprite

ionic depot
#

You should add more

dawn quiver
#

to flip to the left

#

when left key is pressed

ionic depot
#

Sprites to the left and right

dawn quiver
#

i tried to add more

#

it didint work

ionic depot
#

How

#

walkright = pygame.image.load (...)... ?

dawn quiver
#

i ended up with diferent sprites

#

so when i move left

#

the sprite for left moves

#

left

#

but the sprite for the right

ionic depot
#

You followed the tutorial provided by tim?

dawn quiver
#

still stays

#

no

ionic depot
#

You should

dawn quiver
#

i dont watch him anymore

ionic depot
#

Why?

dawn quiver
#

i dont need the animated sprites

ionic depot
#

He has some good vids

dawn quiver
#

i still watch his other vids

ionic depot
#

Anyways

#

You should watch that vid

dawn quiver
#

i said the fix for the flip lol

vital gull
#

Is there such a thing as 'erasing a shape from another shape' in pygame (e.g. removing a small circle from a big circle to form a ring shape that is drawn by pygame)

dawn quiver
ionic depot
#

Oh , I understand now

#

You have just 1 image

#

Right?

dawn quiver
#

yes

ionic depot
#

Okay

#

You should find a list of images for player's movement

#

Go and search on Google

dawn quiver
#

i just need to fricking flip the fricking image!!!!!!!1

ionic depot
#

You can't

#

I've never heard of such thing

dawn quiver
#

well actualy you can

ionic depot
#

How

dawn quiver
#

using pygame.transform.flip(player, True, False)

#

it will flip the image

#

the player is an variable

#

player = pygame.image.load('assets/player.png')

ionic depot
#

Okay

#

If you say so

dawn quiver
#

please Dp_dontmiss accept the inviation

#

plzzzzzzzzzzzzzzzzzzz

#

who like rainbow six here

cinder nacelle
#

dying

#

inside

#

slowly

dreamy swan
#

@dawn quiver This is for game development, not asking about games you play.

dawn quiver
#

yes

#

its true

#

it s just a question

#

@spare phoenix accept the invitation of kermit pls

unique dragon
#

!warn 735559934619549879 posting random gifs in #game-development and begging another user repeatedly for accept an invitation

frank fieldBOT
#

:incoming_envelope: :ok_hand: applied warning to @dawn quiver.

dawn quiver
#

i don t post random gifs

unique dragon
#

!tempban 735559934619549879 7d You were warned and you insisted on continuing. You are welcome to comeback if you actually want to be a part of the server

frank fieldBOT
#

:incoming_envelope: :ok_hand: applied ban to @south sinew until 2020-10-07 14:01 (6 days and 23 hours).

ionic depot
#

Good

#

Come on

#

Don't be shy

cinder nacelle
#

?

ionic depot
#

:))

cinder nacelle
#

pygame has no init member

ionic depot
#

???

cinder nacelle
#

Module 'pygame' has no 'init' member pylint (no-member)

#

it's not running because it keeps saying that something called mkl service isnt installed

ionic depot
#

Right

#

Send the code

frank fieldBOT
unique dragon
#

pylint is just a warning that maybe something is wrong. Do you get an actual error message when running the code?

ionic depot
#

Yes , he does

cinder nacelle
ionic depot
#

At the end

#

Put pygame.quit ()

cinder nacelle
#

pylint is just a warning that maybe something is wrong. Do you get an actual error message when running the code?
@unique dragon Please install mkl-service package

ionic depot
#

And then quit ()

unique dragon
#

Can you screen shot that error message if pygame.quit() doesn't fix it?

ionic depot
#

There are missing a lot of things in your code

unique dragon
#

Actually, quit is already being used so I don't think that's needed again

ionic depot
#

Yeah , maybe

#

So , @cinder nacelle

cinder nacelle
ionic depot
#

Huh?

unique dragon
#

That's just a warning message, your actual error is just below it

ionic depot
#

You forgot about pygame.K_RiGHT

#

And so on

unique dragon
#

You are using QUIT but Python doesn't know where QUIT is coming from

ionic depot
#

You forgot a lot of stuffs

#

Dude

unique dragon
#

If you see the red lines in your code, VS Code is showing that is doesn't know what the variables are

ionic depot
#

And pygame.KEYUP

#

You have to specify

unique dragon
#

@ionic depot Dial down a bit thanks, no need to come across like that

ionic depot
#

:))

#

Okay boss

#

I will calm down
@unique dragon

cinder nacelle
#

thanks @ionic depot

ionic depot
#

??

cinder nacelle
#

its working now

ionic depot
#

Nice

#

;)

cinder nacelle
#

i added "pygame." on everything

ionic depot
#

Good job

spark citrus
#

@stable lodge
how to host a anitispam bot like mee6 24/7

cinder nacelle
#

What music formats does pygame support?

signal root
#

MP3 I know for certain

#

Not sure about wav

#

@cinder nacelle

frozen knoll
dawn quiver
#

Ohh I just used that

gilded grove
#

do yiu guys help w pygame

#

you*

dawn quiver
#

yes

gilded grove
#

ok great

#

do you guys use any resources for pygame?

#

like is there a tutorial to get me started anywhere

#

i have an idea i want to make it's a ninja star throwing game

ionic depot
#

@frozen knoll cool

#

@gilded grove hmm

#

Have you done any project so far?

gilded grove
#

no i figured I would start with a project

ionic depot
#

A simple game?

gilded grove
#

yeah

#

the ninja star throwing one

#

so i can have something for my resume

ionic depot
#

Hmm

#

Start with simple games

#

And then build the game from what you've learned

#

@gilded grove

gilded grove
#

it would basically just be like a reflex game

#

you have your character and some other person running at you and you have to throw a shuriken

ionic depot
#

Idk what to say

gilded grove
#

i'll watch some videos to teach myself and then get back here

ionic depot
#

If you are new to pygame , you should start with small things

gilded grove
#

like what

ionic depot
#

An example

#

Snake game

#

Or chess game

#

Any game from what you can learn stuffs

#

In order to make a game by yourself

gilded grove
#

ok

ionic depot
#

Good luck

gilded grove
#

thank you

ionic depot
#

@gilded grove another good example of game could be flappy bird

gilded grove
#

i'll try following some videos first before making games

ionic depot
#

Yeah

#

Go ahead

#

One more thing , don't just follow others code

gilded grove
#

do you think the ninja star throwing game is too difficult for a beginner

ionic depot
#

Understand them

#

What is that ... why is it there ... how does it work ...

#

Ask yourself

#

I really don't know

#

It depends

gilded grove
#

guess I'll find out

ionic depot
#

Yeah

stuck stone
#

Not sure I understand

#

but at first glance, iterating through a dict seems like something that can be done faster

#

I see

#

First of all, it's more convenient to iterate over only the dict values

#

with myDict.values()

#

another thing you can do, is to approximate math.hypot

#

by adding the numbers instead of doing math.hypot for example

#

then you can at least filter out most of the foods

#

also, min probably needs to run its own loop

#

so it's better to have that be part of your main loop

#

instead of math.hypot(a,b) then abs(a) + abc(b)

#

@prime juniper
it also depends on what on the rest of the code

#

like...

#

if you're running this on every frame

#

you know that nothing changed between two frames

#

they spawn every frame?

#

yeah! that's probably the best

gilded grove
#
import pygame
#initalize the pygame
pygame.init()

#create the screen
screen = pygame.display.set_mode((800,600))
running = True
while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False
#

um i don't know why my window isn't popping up on repl.it

stuck stone
#

pygame decided to sue repl, so then repl blocked them

gilded grove
#

wait fr

#

say sike rn

#

so none of pygame works on repl?

#

when did this happen?

gilded grove
#

I canโ€™t find anything saying it got banned

stuck stone
#

Messing with you

cinder nacelle
#

anyone knows where to download sprite sheets?

dawn quiver
tulip topaz
#

Any solid reson to code game on python? Am planning but people suggest me C++ no hates tho......

#

help
@dawn quiver which IDE is this?

dawn quiver
tulip topaz
#

oh thnx ๐Ÿ™‚

dawn quiver
#

np

cinder nacelle
#

send help what is "variable referenced before assignment"

coarse hill
#

@cinder nacelle which variable is the error referring to?

cinder nacelle
#

oh whoops

#

thanks

#

i solved it

ionic depot
#

@stuck stone lmao

cinder nacelle
#

yea

#

i tried a few times

terse reef
#

Yeah

#

I recommend, if you can, to download Python and pygame on your pc

ionic depot
#

That's not necessarily

terse reef
#

But repl.it is really REALLY bad with sharing graphics.

#

Normal terminal programs work well, but when you go to video, it is bad.

#

The framerate is bad and the compression is bad.

#

It could also be a region problem

dawn quiver
#

help

cinder nacelle
#

use this @dawn quiver

dawn quiver
#

@cinder nacelle i dont care what ide you use i am happy with my ide i am asking for help on my error not you're opinion on my ide
so pls stop wasting my time

cinder nacelle
#

oh

#

my bad

void spade
#

@dawn quiver well your sprite is a Surface object not a Rect object, so your probably mixed up what you assign sprite as

dawn quiver
#

so how do fix that

void spade
#

show you code relating to the sprite object?

dawn quiver
#

import pygame, sys
pygame.init()

#screen
win = pygame.display.set_mode((500,500))
pygame.display.set_caption('BoxBoxTriangle')
clock = pygame.time.Clock()
running = True

#variables

#player
player = pygame.image.load('assets/player.png')
player1 = pygame.transform.scale2x(player)

x = 150
y = 150
width = 100
height = 100
vel = 5

#tornadoe
tornadoe = pygame.image.load('assets/tornadoe.png')
tornadoe1 = pygame.transform.scale2x(tornadoe)

tx = 50
ty = 64
twidth = 100
theight = 100

#earthquake
earthquake = pygame.image.load('assets/earthquake .png')
earthquake1 = pygame.transform.scale2x(earthquake)

ex = 50
ey = 64
ewidth = 100
eheight = 100

#bullets
bullet = pygame.image.load('assets/bullet.png')

Bx = 40
by = 64
bwidth = 100
bheight = 100

#end of variables

#functions
#if collide with another sprite
hits = pygame.sprite.spritecollide(player, tornadoe, False)
if hits:
running = False

#main loop
while running:
for event in pygame.event.get():
if pygame.event == pygame.QUIT:
pygame.quit()
sys.exit()

#playermovementkeys

keys = pygame.key.get_pressed()

if keys[pygame.K_RIGHT] and x <500 - width - vel:
x += vel
if keys[pygame.K_LEFT] and x > vel:
x -= vel
if keys[pygame.K_DOWN] and y <500 - width -vel:
y += vel
if keys[pygame.K_UP] and y > vel:
y -= vel

win.fill((199, 199, 190))
win.blit(player, (x,y))
win.blit(tornadoe, (tx,ty))
pygame.display.update()
pygame.time.delay(60)
clock.tick(100)

#

@void spade

void spade
#

!code

frank fieldBOT
#

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:

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

Note:
โ€ข These are backticks, not quotes. Backticks can usually be found on the tilde key.
โ€ข You can also use py as the language instead of python
โ€ข The language must be on the first line next to the backticks with no space between them

This will result in the following:

print('Hello world!')
dawn quiver
#

i know that

#

i just forgot

void spade
#

lol

dawn quiver
#

so any fix

proven vault
#

@dawn quiver addon starting and end of the text

dawn quiver
#

i fucking know that

#

stop wasting my time @dawn quiversimp

#

i just said i forgot

void spade
#

well i wonder who is asking for help

proven vault
#

@dawn quiver shut up

dawn quiver
#

he keeps sayingg
i should add

#

i know that

#

i just forgot

void spade
#

player needs to be a sprite object

proven vault
#

why did you forgot?

dawn quiver
#

how

void spade
#

and you can edit messages btw

dawn quiver
#

i know

#

just tell me how i can make a sprite object

proven vault
#

i know

#

but i wont tell you

dawn quiver
#

cares

void spade
#

randomly ping ppl lmaoo

proven vault
#

first learn how to spell kid@dawn quiver

dawn quiver
#

i accidently pressed @

#

just tell me the fix

void spade
#

you need to learn how to create a sprite object

dawn quiver
#

ok

proven vault
#

ok

void spade
#

and if you havent learn classes then Good Luck

proven vault
#


def run_game():
    pygame.init()
    pygame.display.set_mode((800, 600))
    pygame.display.set_caption("tattie")
    run = True

    while run:
        for event in pygame.event.get ():
            run_game()
            pygame.display.flip ()
            if pygame.event.type == pygame.QUIT:
                run = False```
#

its not opening the window

#

its runs successfully but the game window is not opened.

#

@void spade

void spade
#

@proven vault you are running run_game() in run_game() function

#

probably the nesting of function is causign issue

#

also there is a weird space here flip ()

#

and you need to add pygame.time.Clock().tick(60) 60 being the framerate

#

put it in your while run loop

potent ice
void spade
#

lol he is probably too piss to get any help

proven vault
#

i fixed it

placid oxide
#

you need to declare screen before you can use it

proven vault
#


def run_game():
    pygame.init ()
    pygame.display.set_mode ((800, 600))
    screen = pygame.display.set_caption ("tattie")
    colour = (0, 250, 0)
    run = True

    while run:
        for event in pygame.event.get():
         
         pygame.time.Clock().tick(60)
        pygame.display.flip()
        if event.type == pygame.QUIT:
                run = False
run_game()``` but im getting another error ```screen.fill(colour)
AttributeError: 'NoneType' object has no attribute 'fill'```
#

@placid oxide

void spade
#

screen need to be assign to the set_mode() method

#

Not the set_caption()

proven vault
#

i didnt noticed that

#

but thanks for the help

cinder nacelle
#

is there any way to keep a randomizer running in the bg?

#

like what I have rn is owo = True while owo: clock.tick(1000) r1 = random.randint(1,4) update(r1)

#

but i think im doing this update thing wrong

#

display.update is for screens while this update is for dictionaries i think

ionic depot
#

What are you trying to make?

#

@cinder nacelle

cinder nacelle
#

dino run game

#

just making a random mob spawning machine rn

#

@ionic depot any idea?

ionic depot
#

Not really

cinder nacelle
#

yeet

#

now im having class manipulation errors

#

cuz i wanted to be more organized and look where this got me

#

it destroyed my character animation function

dawn quiver
#

Python is nice to game dev?

cinder nacelle
#

no

ionic depot
#

@dawn quiver kind of

dawn quiver
#

no
@cinder nacelle why?

#

@dawn quiver kind of
@ionic depot its possible create 3d game?

ionic depot
#

@dawn quiver with blender, yes

dawn quiver
#

oh cool

#

thank you men

quartz elbow
#

How would you make a pygame white background?

Also I just started learning Python 1 month ago..

fast moth
#

hi

cinder nacelle
#

How would you make a pygame white background?

Also I just started learning Python 1 month ago..
@quartz elbow screen.fill((255,255,255))

ionic depot
#

Lol

cinder nacelle
#

Lol, indeed

#

my code broke

fiery shale
gilded grove
#

what does this error mean

#

File "main.py", line 17, in <module>
mixer.music.load("background.wav")
pygame.error: mixer not initialized

#

exit status 1??

#

there's the github link I pulled the files from

olive parcel
#

You're missing a call to initialize the library.

gilded grove
#

how do you do that

#

i'm new to pygame

olive parcel
#

pygame.mixer.init()

gilded grove
#

File "main.py", line 6, in <module>
pygame.mixer.init()
pygame.error: No available audio device

#

all of this just to see how a game works

#

oh playing audio doesn't work

#

i got it to work

#

is the framerate on pygame always this terrible

dawn quiver
#

is there any module for 3d games?

olive parcel
gilded grove
#

what is that for

#

will pygame not work if you use a jpeg instead of a png

ionic depot
#

Probably

gilded grove
#

@ionic depot I'm going ahead with my ninja star throwing game

#

I have my files set up and now i'm getting my background stuff set up too

#
pygame.display.set_caption("Space Invader")
icon = pygame.image.load('ufo.png')
pygame.display.set_icon(icon)
#

can anyone tell me what that's supposed to do

gilded grove
#

I read the doc and I'm still confusion

ionic depot
#

And the result of your code? @gilded grove

gilded grove
#

it's not my code I got it from github

#

I'm going piece by piece and trying to reconstruct it into the ninja star throwing game

#

if that makes any sense

ionic depot
#

Yes

#

But I'm interested in your code

#

What have you done so far?

gilded grove
#

other than making the screen size and setting the background nothing

ionic depot
#

Continue with the players movement

gilded grove
#

got it

dawn quiver
#

If Iโ€™m making a button class should I put it in another file for ease of use?

wind smelt
#

Do you have any good ideas on like a level based game to create?

#

i am so uncreative xD

untold shoal
#

Is a colour changing background possible with pygame?
I made a strobe effect but it makes the window unresponsive.
Any ideas?

gilded grove
#

@wind smelt make among us but pygame

ionic depot
#

@gilded grove lmao

gilded grove
#

i'm struggling but it's ok

ionic depot
#

@gilded grove with what

gilded grove
#

making the ninja star throwing game

#

what does pygame.keydown mean

#

i looked it up on the doc

#

File "main.py", line 38, in <module>
screen.blit(background(0,0))
TypeError: 'pygame.Surface' object is not callable

#
import math
import random

import pygame

#Intialize pygame

pygame.init()

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

#background
background = pygame.image.load("Background.png")

#player ninja
playerImg = pygame.image.load("player.png")
playerX = 370
playerY = 480
playerX_change = 0
playerY_change = 0

#enemy ninja
enemyImg = []
enemyX = []
enemyY = []
enemyX_change = []
enemyY_change = []
num_of_enemies = 6


#game loop
running = True
while running:
  #RGB
  screen.fill((0,0,0))
  #background image
  screen.blit(background(0,0))
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False
    
    if event.type == pygame.KEYDOWN:
      if event.key == pygame.K_LEFT:
        playerX_change == -5
      if event.key == pygame.K_RIGHT:
        playerX_change = 5
#

what does that error mean

gilded grove
#

i just want to have my background set up

gilded grove
#

i don't know what's wrong with it

gilded grove
#

do you guys know whatโ€™s wrong with it?

tranquil girder
#

There's an error on line 38
What arguments are you passing to the function?

gilded grove
#

idek i just got this from a youtube tutorial and tried to make it work on code for another game

#

blit()
draw one image onto another
blit(source, dest, area=None, special_flags=0) -> Rect
that's what it says in the doc

tranquil girder
#

make sure you're not missing a comma

gilded grove
#

i don't see a missing comma with the 0,0,0

#

i'm mad confused

tranquil girder
#

This line, 38:

screen.blit(background(0,0))
gilded grove
#

i added an extra comma after the second zero

tranquil girder
#

How many arguments are you passing to blit()?

gilded grove
#

2

tranquil girder
#

Are you sure?

gilded grove
#

is it 3

tranquil girder
#

No, only one

gilded grove
#

๐Ÿ˜…

#

uhhhhh

#

yeah i don't know how pygame works

tranquil girder
#

not, pygame specific
python
you're just missing a comma

gilded grove
#

oh is it after background

tranquil girder
#

yes

gilded grove
#

my oh my

#

i'm big dumb

#

sorry

tranquil girder
#

sometimes you just have to double check you didn't have a typo
or you can try rewriting it to make sure it's correct

gilded grove
#

can you explain what .blit does

tranquil girder
#

in simple terms it just means to draw it on the screen

gilded grove
#

oh ok

fiery shale
#

Hey may someone help me Iโ€™m trying to make a game called guess the blocks where thereโ€™s three blocks and there are the colors red, blue, yellow, orange, purple, and green. If the user guess block 1 correct then they move on two block 2, if they guess block 2 correct they move on to block 3, if they guess block 3 correct the game will end and tell them the number of tries they had. So itโ€™ll also count the correct and incorrect tries. I just donโ€™t know how to get started.

#

I have the text and stuff set up

#

I want the user to be able to enter answers in the guess here box and they can click text

#

Check*

#

Currently if I click check itโ€™ll close the program

dawn quiver
#

Am new to game development

#

How to change the search box type

pale fiber
#

hey guys is pygames on 3.8.5?

dawn quiver
#

Search box

dawn quiver
#

hey im pretty new to python i want to develop games so im getting a head start for when im ready what will i need?

pale fiber
#

hey does pygames work on 3.8.5?

#

this chat is sooo dry

gilded grove
#

hey i'm here asking questions it's not dead yet

#

it's more spicy in the general section

void spade
#

@pale fiber yes

#

@dawn quiver 1. design, 2. game theory, 3. coding (donโ€™t have to be python)

#

for general game dev ^

#

@dawn quiver not sure what you mean but i have the day the screenshot are unreadable

pale fiber
#

@void spade how do i install it then? plz teach me

void spade
silver coral
#

hey so i wanted to ask how to go about coding some game stuff in python

#

idk if i missed the party

#

but ill type here anyway

cinder nacelle
#

:0

dawn quiver
#

@dawn quiver not sure what you mean but i have the day the screenshot are unreadable
@void spade got it

cinder nacelle
#

@dawn quiver try using simpledialog

flint edge
#

has anyone used Python to create png images before?
I want to create a program that automates the creation of text images
Basically I need to select font, placement, resolution of image, and set background as transparent with python and output .png images

merry echo
#

You could use the pillow (PIL) package for that

finite mantle
#

hello guys

#

it is someone who has experiences in pyglet?

finite mantle
#

pyglet??? asteroids

jolly palm
#

hey guys do you have any nice tutorials for making a map with pygame?

finite mantle
#

eh

#

Asteroids help me,?

spare cloak
#

Hello. If anyone would like to contribute to a open-source game project for an organization and be it's Lead Developer, please drop me a message.

#

You can either make from scratch or use an existing open-source project, no worries about that.

gilded grove
#

idk @spare cloak if i'd be the lead i'm still very new to game dev

#

what language would you be using

ionic depot
#

C++ and/or python

#

Or both

#

@gilded grove

#

Most likely

spare cloak
#

@gilded grove You're at freedom to choose that. Basically I'm the Founder of the crypto currency Xolentum, and the Devs will be working on the core itself which needs lots of fixes and stabilization.

#

So we're looking for a separate set of developers to work on a game that will use our crypto currency.

#

Integrating the payment system won't be very difficult, you just need to setup a good game with a payment system, into which we will integrate Xolentum payments.

#

You can use any language you want to make it from scratch or use an existing project from GitHub, we don't have any issues with that. ๐Ÿ™‚

gilded grove
#

it would look good on my resume but I think I want to stick with my shuriken throwing game

#

it's more basic and a good introduction to pygame

spare cloak
#

It's your choice, the one who joins in first will be the lead Developer and maintainer of the game, so a good opportunity just waiting to be filled. ๐Ÿ˜„

gilded grove
#

yeah plus i have school so that's a F

spare cloak
#

Same here.

ionic depot
#

Damn

spare cloak
#

How old are you unless you mind sharing that?

gilded grove
#

19

spare cloak
#

I'm 17. ๐Ÿ˜„

ionic depot
#

Leader from the start

#

Sounds cool

gilded grove
#

wow cryptocurrency founder at 17

ionic depot
#

:))

gilded grove
#

sounds great

spare cloak
#

Yeah

gilded grove
#

your resume must be stacked

spare cloak
#

Yeah I contribute to lots but don't put up everything on my resume.

#

Just a few

ionic depot
#

The best of them

spare cloak
ionic depot
#

Right?

spare cloak
#

Yeah

ionic depot
#

Nice

gilded grove
#

well done

spare cloak
#

In case anyone wants to join the project, with helping with the game or anything else, just drop me a DM, I'll reply as soon as possible. ๐Ÿ™‚

gilded grove
#

i'm willing to give credit to people on github for the ninja star throwing game

#

if you want that on your resume idk

spare cloak
#

Well, I'm mostly juggling between school and my existing projects, that's the primary reason of outsourcing the game because I don't have time for it, but a much needed entity for the project's success.

gilded grove
#

i see

#

best of luck man

spare cloak
#

Thanks ๐Ÿ‘

gilded grove
#

i'm new to pygame so i'm trying to create a basic one haha

spare cloak
#

Yeah no issues.

#

Can I have a look at your repository for the game?

ionic depot
#

@gilded grove

gilded grove
#

um

#

i don't know github so well tbh

#

i tried watching some tutorials

#

do you create a repository every single time you have a new project?

ionic depot
#

Idk actually:))

spare cloak
#

do you create a repository every single time you have a new project?
@gilded grove Yep

#

And if it's just a code snippet that you'd like to share with the world you use GitHub Gists

gilded grove
#

me a clown bc i did this thing where i coded a spongebob mocking meme function where it turns stuff like bug into bUg

#

it was just one function and i shared it as a repository

#

LMAO

ionic depot
#

@gilded grove lmfao

gilded grove
#

oh ok good you can delete the repository happy

ionic depot
#

@gilded grove you want to create the game as 2d or 3d

gilded grove
#

2d

ionic depot
#

First person perspective

#

Or third

gilded grove
#

third

#

so the spaceship/ninja would now be on the left side of the screen and the aliens/ninjas on the right

ionic depot
#

I understand

#

Hmm

#

Sounds interesting

gilded grove
#

yeah so far i'm trying to get it to have a background but that's not working

spare cloak
#

@gilded grove I checked your repo. Probably you're new to GitHub so .. anyway, you don't upload zip archives to GitHub.

gilded grove
#

@spare cloak oh

#

noob

spare cloak
#

No issues take your first step at learning Git

#

That's how the files should be, and to do that, you need to either upload each file individually or use the CLI tool git to push the files all at once.

gilded grove
#

alright i'll change it

#

thanks

spare cloak
#

๐Ÿ‘

ionic depot
#

@gilded grove how many lines of code does your game has so far?

gilded grove
#

around 45

#

45 incorrect lines of code bc i still can't see a background

#

what's the difference between .keyup and .keydown

#

both control what you hit on the arrow keys

ionic depot
#

Key down is when you press the button

#

And key up ...

#

Do you understand?

#

It's the opposite

#

If you need help with the game

#

Or with the main parts

#

Tell me

gilded grove
#

should i just DM you instead of blowing up this section

ionic depot
#

As you wish

#

@gilded grove btw , I'm a beginner too

#

But I learned a lot of stuffs from what I've made so far

#

And still learning

gilded grove
#

Thatโ€™s good

#

Iโ€™ve been trying to learn pygame for a while now but I never built up a good understanding of it

#

But I want stuff on my resume and projects are like the only way

gritty mango
#

anyone know how to make this work?

celest iron
cinder nacelle
#

nice

soft oar
#

c# better to devlop games or python ???

gilded grove
#

whatever you like more tbh

#
import math
import random

import pygame

#Intialize pygame

pygame.init()

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

#background
background = pygame.image.load("Background.png")

#player ninja
playerImg = pygame.image.load("player.png")
playerX = 370
playerY = 480
playerX_change = 0
playerY_change = 0

#enemy ninja
enemyImg = []
enemyX = []
enemyY = []
enemyX_change = []
enemyY_change = []
num_of_enemies = 6


#game loop
running = True
while running:
  #RGB
  screen.fill((0,0,0))
  #background image
  screen.blit(background,(0,0))
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False
    
    if event.type == pygame.KEYDOWN:
      if event.key == pygame.K_LEFT:
        playerX_change == -5
      if event.key == pygame.K_RIGHT:
        playerX_change = 5
    if event.key == pygame.K_SPACE:
      bulletX = playerX
      #fire_bullet(bulletX, bulletY)
#

File "main.py", line 48, in <module>
if event.key == pygame.K_SPACE:
AttributeError: 'Event' object has no attribute 'key'

#

i fixed it but now whenever I run it I don't see a background at all

#

@ionic depot any ideas

#

they're all png files i swear

merry echo
#

Youโ€™re using == instead of = in playerX_change == -5

gilded grove
#

Thanks @merry echo

gilded grove
#

that didn't fix anything tho while it was definitely an error

merry echo
#

Oh the line where the error happens is indented wrong, should be aligned with the other two if statements. I didn't see it cause I was in mobile lol
@gilded grove

void spade
#

and you also need pygame.time.Clock().tick(60)

gilded grove
#

File "main.py", line 9, in <module>
pygame.clock.Clock().tick(60)
AttributeError: module 'pygame' has no attribute 'clock'

#

OMG GUYS

#

IT WORKS I CAN SEE A BACKGROUND

#

so under the while running

void spade
#

yep

merry echo
#

Nice

topaz solstice
#

hello, may i get an opinion ... is it better to write a card game in pygame or tkinter?

dawn quiver
#

can anyone teach me how to use class

celest iron
#

class is a blueprint, collection of fields and methods

#

from it you instantiate object

#

class Car ...

car = Car()

dawn quiver
#

how can i make an sprite collide

#

hits = pygame.sprite.spritecollide(player, tornadoe, False)
if hits:
running = False

#

when i run it

#

it says no rect

#

how can i make an sprite have an rect

celest iron
#

you must add to it bounding rect

dawn quiver
#

how/

#

@celest iron \

celest iron
#

didn't use pygame

dawn quiver
#

ok

celest iron
#

hmm draw rect

#

Draws a rectangle on the given surface.
so you have rect on the sprite

#

and then spritecollide

#

hmm you don't need to draw rect

#

just get the rect from image

#

self.rect = load_image('head.jpg', -1)

#

in this way if you use class way

#

if you extends your class with Sprite

#

for example

class Head(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self) 
        self.image, self.rect = load_image('head.jpg', -1)```
dawn quiver
#

i dont use class

celest iron
#

or self.rect = self.image.get_rect()

dawn quiver
#

how can i do it without class

celest iron
#

sprite.rect =

#

but the sprite must be object

#

pygame.sprite is object?

dawn quiver
#

ok how?

celest iron
#

ok this is module

#

sprite = pygame.sprite.Sprite()

#

sprite.image = # here image
sprite.rect = sprite.image.get_rect()

dawn quiver
#

ok @celest iron

celest iron
#

should work

dawn quiver
#

import pygame, sys
pygame.init()

#screen
win = pygame.display.set_mode((500,500))
pygame.display.set_caption('BoxBoxTriangle')
clock = pygame.time.Clock()
running = True

#variables

#player
player = pygame.image.load('assets/player.png')
player = pygame.transform.scale2x(player)

x = 150
y = 150
width = 100
height = 100
vel = 5

#tornadoe
tornadoe = pygame.image.load('assets/tornadoe.png')
tornadoe1 = pygame.transform.scale2x(tornadoe)

tx = 50
ty = 64
twidth = 100
theight = 100

#earthquake
earthquake = pygame.image.load('assets/earthquake .png')
earthquake1 = pygame.transform.scale2x(earthquake)

ex = 50
ey = 64
ewidth = 100
eheight = 100

#bullets

#end of variables

down = False
up = False

#functions
#if collide with another sprite

#main loop
while running:
for event in pygame.event.get():
if pygame.event == pygame.QUIT:
pygame.quit()
sys.exit()

#playermovementkeys

keys = pygame.key.get_pressed()

if keys[pygame.K_DOWN]:
down = True
up = False
if keys[pygame.K_UP]:
up = True
down = False
if down == True:
y += vel
if up == True and y <500 - width - vel:
y -= vel

win.fill((199, 199, 190))
win.blit(player, (x,y))
win.blit(tornadoe, (tx,ty))
pygame.display.update()
pygame.time.delay(60)
clock.tick(100)

#

this is my code

#

so what i have to do is

celest iron
#

ok so image should be from ?

dawn quiver
#

sprite = pygame.sprite.sprite()
sprite.image = 'assets/player.png'
sprite.rect = sprite.image.get_rect()

#

@celest iron

celest iron
#

sprite = pygame.sprite.Sprite()

#

Sprite not sprite

dawn quiver
#

S?

celest iron
#

yes

#

uppercase

dawn quiver
#

where should i put it

#

in the event?

celest iron
#

sprite = pygame.sprite.sprite()
the 2nd way:
sprite = pygame.sprite.Sprite()

dawn quiver
#

the 2nd wa