game-development

How do I "Push" an object (crate) with another object (player) in Pygame?

How do I "Push" an object (crate) with another object (player) in Pygame? Question: I’m trying to make a pushable crate using Pygame. I’m able to push the crate in all directions (up, down, left and right) which works fine. I can also push the crate up or down and move left and right at …

Total answers: 1

I can't create a tunnel between two rooms

I can't create a tunnel between two rooms Question: I’m as making a script for one gererator dungeon for my game import random from typing import Iterator, Tuple import tcod from Gamemap import GameMap import tile_types class RectangularRoom: def __init__(self, x: int, y: int, width: int, height: int): self.x1 = x self.y1 = y self.x2 …

Total answers: 1

Problem with Pygame Animating a Moving Sprite

Problem with Pygame Animating a Moving Sprite Question: I’m trying to make a game and when I want to make a moving sprite, there’s trail that is behind it. When I remove it, then the sprite is not animated. When I try to fix that, it stops moving. As far as I know the problem …

Total answers: 1

How to make a responsive grid with tkinter?

How to make a responsive grid with tkinter? Question: I have a grid made in tkinter that looks like so –  Here, each column is a list inside which there are values ‘green’ or ‘yellow’ which correspond to the colour of each cell in the grid. As you can see it is a 9×9 …

Total answers: 1

TypeError: next_turn() missing 1 required positional argument: 'food'

TypeError: next_turn() missing 1 required positional argument: 'food' Question: After snake dies "Game over" is display in the window and after player click game should start again. I don’t know how to make this. I try to call function after click but I see this error: "TypeError: next_turn() missing 1 required positional argument: ‘food’" , …

Total answers: 2

Pygame can't create if statment for restart screen?

Pygame can't create if statment for restart screen? Question: Im trying to create a code for creating restart section. I created a variable and set to True. And said if that variable true do everything in game if not press space and restart the game. Now space bar now working and games not restarting. What …

Total answers: 1

Problem with creating a pygame object inside a class

Problem with creating a pygame object inside a class Question: So this is the code that I created, it’s going to be a simple 2D game. I was trying to experiment with classes while making another game to make it more functional and organized. But the problem is that when I run the code and …

Total answers: 2

How to print only one item from a dictionary with a changeable variable

How to print only one item from a dictionary with a changeable variable Question: I am trying to print only one key and value from my dictionary at a time and have it print based on the player current room position. Every solution I tried so far, either prints all of the items, all the …

Total answers: 1

How do I fix wall warping in my raycaster?

How do I fix wall warping in my raycaster? Question: So I have made a raycaster in python using pygame. I cast my rays little bit by bit and once they’ve hit a wall, I calculate the distance and use that base the height of my walls. The problem is that my walls are curved. …

Total answers: 1