本文整理汇总了Python中pyglet.sprite.Sprite.speed_y方法的典型用法代码示例。如果您正苦于以下问题:Python Sprite.speed_y方法的具体用法?Python Sprite.speed_y怎么用?Python Sprite.speed_y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyglet.sprite.Sprite
的用法示例。
在下文中一共展示了Sprite.speed_y方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from pyglet.sprite import Sprite [as 别名]
# 或者: from pyglet.sprite.Sprite import speed_y [as 别名]
from pyglet.sprite import Sprite
from pyglet.text import Label
from pyglet.window import Window, key
window = Window()
MAX_BALL_SPEED = 500
INITIAL_BALL_SPEED = 400
ball_image = resource.image('images/ball.png')
ball = Sprite(ball_image)
ball.x = window.width / 2 - ball.width/2
ball.y = window.height / 2 - ball.width/2
ball.speed_x = INITIAL_BALL_SPEED
ball.speed_y = INITIAL_BALL_SPEED
PADDLE_MARGIN = 10
paddle_image = resource.image('images/paddle.png')
paddle1 = Sprite(paddle_image)
paddle1.x = PADDLE_MARGIN
paddle1.y = window.height / 2 - paddle1.height / 2
paddle1.speed = 400
paddle2 = Sprite(paddle_image)
paddle2.x = window.width - paddle2.width - PADDLE_MARGIN
paddle2.y = window.height / 2 - paddle2.height / 2
paddle2.speed = 400
score_1 = 0
score_2 = 0