本文整理匯總了Python中course.Course.update方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.update方法的具體用法?Python Course.update怎麽用?Python Course.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類course.Course
的用法示例。
在下文中一共展示了Course.update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Boarding
# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import update [as 別名]
class Boarding(GameState):
def __init__(self):
super(Boarding, self).__init__()
def startup(self, persistent):
self.persist = persistent
name = self.persist["course_name"]
filepath = os.path.join("resources", "courses", "{}.json".format(name))
with open(filepath, "r") as f:
course_info = json.load(f)
self.course = Course(course_info)
x, y = self.course.map_rect.centerx, 50
self.player = Snowboarder((x, y))
pg.mouse.set_visible(False)
pg.mixer.music.load(prepare.MUSIC["wind"])
pg.mixer.music.set_volume(.7)
pg.mixer.music.play(-1)
def get_event(self, event):
if event.type == pg.KEYUP:
if event.key == pg.K_ESCAPE:
self.done = True
self.next_state = "MAIN_MENU"
pg.mouse.set_visible(True)
pg.mixer.music.fadeout(3000)
def update(self, dt):
keys = pg.key.get_pressed()
self.player.update(dt, keys, self.course.map_rect)
self.course.update(dt, self.player)
def draw(self, surface):
surface.fill(pg.Color(242, 255, 255))
self.course.draw(surface, self.player)