本文整理汇总了Python中ship.Ship.set_MoveSpeed方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.set_MoveSpeed方法的具体用法?Python Ship.set_MoveSpeed怎么用?Python Ship.set_MoveSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ship.Ship
的用法示例。
在下文中一共展示了Ship.set_MoveSpeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _preload
# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import set_MoveSpeed [as 别名]
def _preload(self, screen):
rect = screen.get_rect()
resolution = (rect.width, rect.height)
yield 'Loading Events'
self.controller = game_handler
self.controller.context.mediator = self
yield 'Loading Background'
self.bg = ImageView(
background.load(options=background.STRETCH, resolution=resolution)
)
self.views.append(self.bg)
yield 'Loading Planets'
for msg in Planet.load():
yield msg
yield 'Loading Stars'
Sun.set_fps(GameMediator.FPS)
yield 'Loading Sector'
self.celestials = []
sun = Sun(resolution[0] / 2, resolution[1] / 2, 50)
self.celestials.append(sun)
self.views.append(sun)
yield
planet = Planet(0, 0, 8)
planet.orbit(sun, 140)
self.celestials.append(planet)
self.views.append(planet)
yield
planet = Planet(0, 0, 10)
planet.orbit(sun, 60)
self.celestials.append(planet)
self.views.append(planet)
yield
planet = Planet(0, 0, 30)
planet.orbit(sun, 200)
self.celestials.append(planet)
self.views.append(planet)
yield
yield 'Building Ships'
for msg in Ship.load():
yield msg
Ship.set_fps(GameMediator.FPS)
yield 'Spawning Players'
self.players = {}
player1 = Ship(50, 50, base='purple')
player1.set_MoveSpeed(10)
player1.set_TurnSpeed(pi)
player1.set_direction(0)
self.views.append(player1)
self.players[1] = player1
yield
player2 = Ship(600, 50, base='red')
player2.set_MoveSpeed(10)
player2.set_TurnSpeed(pi)
player2.set_direction(-pi/4)
self.views.append(player2)
self.players[2] = player2
yield
player3 = Ship(50, 400, base='green')
player3.set_MoveSpeed(10)
player3.set_TurnSpeed(pi)
player3.set_direction(pi/2)
self.views.append(player3)
self.players[3] = player3
yield
player4 = Ship(600, 400, base='blue')
player4.set_MoveSpeed(10)
player4.set_TurnSpeed(pi)
player4.set_direction(-pi/2)
self.views.append(player4)
self.players[4] = player4
yield
yield 'Applying Gravity'
for celestial in self.celestials:
celestial.pull_on(player1)
celestial.pull_on(player2)
celestial.pull_on(player3)
celestial.pull_on(player4)