3
36
1731
金牌会员
class Car(): def __init__(self,color,people): self.color = color self.people = people self.position = [400,300] self.change_direction = 'right' def forward(self): self.change_direction = 'up' self.position[0]+=5 def backward(self): self.change_direction = 'down' self.position[0]+=5 def turn_left(self): self.change_direction = 'left' self.position[1]-=5 def turn_right(self): self.change_direction = 'right' self.position[1]+=5 car_one = Car('red',1)
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|东台市机器人学会 ( 苏ICP备2021035350号-1;苏ICP备2021035350号-2;苏ICP备2021035350号-3 )
GMT+8, 2024-11-23 16:13 , Processed in 0.038627 second(s), 30 queries .
Powered by Discuz! X3.4
Copyright © 2001-2020, Tencent Cloud.