当前位置: 首页>>代码示例>>Python>>正文


Python Ball.velocity方法代码示例

本文整理汇总了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()
开发者ID:sometea,项目名称:blobble,代码行数:15,代码来源:engine.py

示例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")
开发者ID:morganq,项目名称:dodgeball-game,代码行数:19,代码来源:supernode.py

示例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()

开发者ID:greenfox-academy,项目名称:gyurka00,代码行数:31,代码来源:main.py


注:本文中的ball.Ball.velocity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。