suspend是暫停函式還沒寫完,但是正常運行的都寫完了,測驗的時候,沒加入食物部分時運行正常,但是加入食物后就出現重影了,不知道哪里出現了問題


。。


uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
我挪到for前面了,但是還是出現現在這樣的情況


uj5u.com熱心網友回復:
你把代碼粘貼上來uj5u.com熱心網友回復:
import pygame
import jiemian
import random
pygame.init()
class shepi(object):
def __init__(self):
self.zuobiao = [[590,300],[570,300],[550,300]]
self.chang = 2
self.su = 20
self.direction = "right"
def pa(self,suspend):
if suspend:
if self.direction == "up":
self.zuobiao[self.chang][0] = self.zuobiao[0][0]
self.zuobiao[self.chang][1] = self.zuobiao[0][1] - self.su
self.zuobiao.insert(0,[self.zuobiao[self.chang][0],self.zuobiao[self.chang][1]])
del self.zuobiao[self.chang]
for i in self.zuobiao:
pygame.draw.rect(jiemian.beijin,(0,0,255),(self.zuobiao[0][0],self.zuobiao[0][1],20,20),0)
if self.direction == "down":
self.zuobiao[self.chang][0] = self.zuobiao[0][0]
self.zuobiao[self.chang][1] = self.zuobiao[0][1] + self.su
self.zuobiao.insert(0,[self.zuobiao[self.chang][
uj5u.com熱心網友回復:
完整代碼壓縮下私信我吧
uj5u.com熱心網友回復:
你把代碼粘貼上來
import pygame
import jiemian
import random
pygame.init()
class shepi(object):
def __init__(self):
self.zuobiao = [[590,300],[570,300],[550,300]]
self.chang = 2
self.su = 20
self.direction = "right"
def pa(self,suspend):
if suspend:
if self.direction == "up":
self.zuobiao[self.chang][0] = self.zuobiao[0][0]
self.zuobiao[self.chang][1] = self.zuobiao[0][1] - self.su
self.zuobiao.insert(0,[self.zuobiao[self.chang][0],self.zuobiao[self.chang][1]])
del self.zuobiao[self.chang]
for i in self.zuobiao:
pygame.draw.rect(jiemian.beijin,(0,0,255),(self.zuobiao[0][0],self.zuobiao[0][1],20,20),0)
if self.direction == "down":
self.zuobiao[self.chang][0] = self.zuobiao[0][0]
self.zuobiao[self.chang][1] = self.zuobiao[0][1] + self.su
self.zuobiao.insert(0,[self.zuobiao[self.chang][
完整代碼壓縮下私信我吧


我又把書拿出來仔細研究了一下我的代碼,發現了問題了
uj5u.com熱心網友回復:
你把代碼粘貼上來
import pygame
import jiemian
import random
pygame.init()
class shepi(object):
def __init__(self):
self.zuobiao = [[590,300],[570,300],[550,300]]
self.chang = 2
self.su = 20
self.direction = "right"
def pa(self,suspend):
if suspend:
if self.direction == "up":
self.zuobiao[self.chang][0] = self.zuobiao[0][0]
self.zuobiao[self.chang][1] = self.zuobiao[0][1] - self.su
self.zuobiao.insert(0,[self.zuobiao[self.chang][0],self.zuobiao[self.chang][1]])
del self.zuobiao[self.chang]
for i in self.zuobiao:
pygame.draw.rect(jiemian.beijin,(0,0,255),(self.zuobiao[0][0],self.zuobiao[0][1],20,20),0)
if self.direction == "down":
self.zuobiao[self.chang][0] = self.zuobiao[0][0]
self.zuobiao[self.chang][1] = self.zuobiao[0][1] + self.su
self.zuobiao.insert(0,[self.zuobiao[self.chang][
完整代碼壓縮下私信我吧
我又把書拿出來仔細研究了一下我的代碼,發現了問題了
fill函式我沒寫,我以前一直以為不寫他會默認,我重新把這個寫上去之后他就正常了
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/92306.html
下一篇:python正則運算式提取空串列
