且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python3.2 如何防止乌龟离开屏幕以及何时重置?

更新时间:2023-12-01 16:09:34

我知道这是我自己的问题,但我需要一个有效的答案,所以我将其添加到字符类中:

I know this is my own question but I needed an answer that worked well so I added this to the character class:

if self.x < 0:
    self.x = 3
if self.x > 800:
    self.x = 790
if self.y < 0:
    self.y = 3
if self.y > 800:
    self.y = 790