Ask coding questions

← Back to all posts
deadly tetris nani?? walls question
greatbear437 (6)

yo hi guys, its been a while since I've been on replit. I'm pretty new to python and i was just trying to make a simple game. it works fine, but i figured out s bug/exploit of my own game. u can just go off the screen and get infinite how do I make "walls" to stop the player from going off the screen. tysm everyone!!!

greatbear437 (6)

Please respond, I dont have much time its for a project in a coding class. TYSM!

Brendan23 (166)

@greatbear437 you will have to do something like:

wall_left = x,y
wall_right = x,y

if player_pos == wall_right or player_pos == wall_left:
greatbear437 (6)

thx ill try it out, but how would i find the x and y's of the walls?


Brendan23 (166)

@greatbear437 just experiment. you know that the y would be the same y as the player_pos, and you know that the for the x one should be negative and one should be positive.

Brendan23 (166)

@greatbear437 this isn't really related but you can make a rectangle for the walls and make it the same color of the backround.