本文整理汇总了Python中ball.Ball.velocity方法的典型用法代码示例。如果您正苦于以下问题:Python Ball.velocity方法的具体用法?Python Ball.velocity怎么用?Python Ball.velocity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ball.Ball
的用法示例。
在下文中一共展示了Ball.velocity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import velocity [as 别名]
def __init__(self, screen):
self.balls = ScatteringsHandler()
ball = Ball(50, screen.get_height()/2)
ball.velocity = Vector(3.0, -1.0)
self.balls.add(ball)
bar = Bar(screen.get_width()/2, screen.get_height()/2)
self.balls.add(bar)
self.blobble1 = Blobble(screen.get_width()/2, screen.get_height()/2)
self.balls.add(self.blobble1)
self.screen = screen
self.background = screen.copy()
self.background.fill((0,0,0))
self.lastTicks = pg.time.get_ticks()
示例2: end
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import velocity [as 别名]
def end(self, ball):
if not g.SERVER:
return
b = Ball(Vector2(ball.position.x, ball.position.y))
ball.position.y += 5
# ball.netinfo["teleporting"] = True
self.game.scene.add(b)
t = min(ball.superIndex, len(ball.super))
b.super = [] # ball.super[t:]
b.velocity = ball.velocity.clone() + Vector2(0, 0)
b.thrower = ball.thrower
b.throwTeam = ball.throwTeam
ball.velocity += Vector2(0, 0)
b.zVelocity = 10 # ball.zVelocity
b.z = ball.z
b.throw()
self.game.net.spawn(b, "ball")
示例3: Tk
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import velocity [as 别名]
from tkinter import *
from ball import Ball
master = Tk()
canvas = Canvas(master, width = 400, height = 400)
canvas.pack()
canvas.create_rectangle(0,0,400,400,fill='#ffffff',)
ball = Ball((40, 50), (2, 2), 10)
while True:
i = 0
ball.velocity = (2, 2)
while i < 100:
ball.move()
bbox = ball.get_bbox()
canvas.create_rectangle(0 , 0, 400, 400, fill='#ffffff',)
canvas.create_oval(bbox, fill='#000000')
canvas.after(1000 // 60)
canvas.update()
i += 1
ball.velocity = (-2, -2)
j=0
while j < 100:
ball.move()
bbox = ball.get_bbox()
canvas.create_rectangle(0,0,400,400,fill='#ffffff',)
canvas.create_oval(bbox, fill='#000000')
canvas.after(1000 // 60)
canvas.update()