MissingFable

u/MissingFable


r/pygame•

I am working on a top-down game. The player needs to be able to move in the direction they are facing, so I used to following code to allow this to happen:

import math
import pygame

class Player:
    sprite = pygame.image.load("player.png")
    
    def __init__(self, position:pygame.Vector2) -> None:
        self.image = Player.sprite
        
        self.rect = self.image.get_rect()
        self.rect.topleft = position
        
        self.angle = 0
        
    def move(self):
        keys = pygame.key.get_pressed()
        
        direction = pygame.Vector2(math.cos(math.radians(self.angle)), -math.sin(math.radi
72

r/redditdev•

I'm working on a project with PRAW. I'm getting post data (titles, comments, bodytext) and also taking screenshots of the different elements.

However, I've been having an issue when it comes to NSFW posts.

Whenever I try to screenshot a post, comment, or bodytext, I need to look for a certain html element. However, (and this is my assumption) whenever the bot follows the URL to the a Reddit post that's marked as NSFW, it gets blocked by the NSFW warning page. This means that the script I've written can't actually find the different parts of the site and just ends up timing out and giving me an error.

Is there a way that I can view these NSFW tagged posts or will I just have to avoid any

30



r/pygame•

So, I've been making a game that's a mixture of breakout and pong. The paddles are like the wall that you would see in breakout.

Point is, I needed a solution to do that and what I came up with was having a bunch of tiny boxes as a sprite group and being kept inside a class containing the logic for an entire paddle.

I'm now working on a solution to get the paddle (along with a paddle which fits the dimensions of the paddle perfectly) to not go over the boundaries of the screen, and what I came up with was was the following:

if self.rect.bottom >= self.screen_size[1] + 1:
    self.paddle_blocks.update(key_input * -1) self.rect.topleft += key_input * -1

This is just the logic fo

28


r/programminghelp•

I made a mistake on my Boolean Logic problem, and while it does give me the most efficient answer, I don't know how to prove it (mistake is bolded and italicized below)

Essentially, here is what I have (+ means 'or', ~ means 'not' so A~B means 'A and not B', XOR means an 'exclusive or'):

Question: ~A~BCD + ~AB~CD + ~ABC~D + A~B~CD + A~BC~D + AB~C~D

First line: ~AD (B XOR C) + A XOR B (C XOR D) + A~D (B XOR C)

Last line (answer that works but I don't know how to prove): B XOR C (A XOR D) + A XOR B (C XOR D)

The answer is the most efficient one, but I do not know how to actually, properly prove it

20