本文整理汇总了Python中scene.Scene.add_object方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.add_object方法的具体用法?Python Scene.add_object怎么用?Python Scene.add_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene.Scene
的用法示例。
在下文中一共展示了Scene.add_object方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import add_object [as 别名]
def __init__(self, player, boss):
self.p1 = player
self.p2 = boss
p1_status = Scene(max(len(self.p1.name), self.max_health) + 1, 3)
p1_status.modify_background(self.p1.name)
p2_status = Scene(max(len(self.p2.name), self.max_health) + 1, 3)
p2_status.modify_background(self.p2.name)
self.p1.health = HealthBar(self.max_health)
p1_status.add_object(self.p1.health, 0, 2)
self.p1.status_win = p1_status
self.p1.thruster = Thruster(self.p1)
self.p1.thruster.switch_direction()
self.p1.thruster.set_color(curses.COLOR_CYAN)
self.p2.health = HealthBar(self.max_health)
p2_status.add_object(self.p2.health, 0, 2)
self.p2.status_win = p2_status
width, height = Scene.max_view(0, 7)
width *= self.screens
self.main_win = Scene(width, height)
self.main_win.modify_background(self.generate_starfield(width, height))
示例2: Scene
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import add_object [as 别名]
from scene import Scene
from camera import Camera
from lights import *
from objects import *
from color import Color
width, height = 800, 600
scene = Scene(Camera((0, -80, 20), 60), (80, 60), (width, height))
scene.add_light(Ambiant(intensity=0.2))
scene.add_light(Diffuse(-20, -40, 20, intensity=0.8))
scene.add_light(Diffuse(40, 40, 5, intensity=0.4))
scene.add_light(Specular(-20, -40, 20, intensity=0.6))
scene.add_object(Sphere(10, x=50, y=30, scale_z=1.5, color=Color(r=255)))
scene.add_object(Sphere(3, z=20, scale_x=5, color=Color(g=255)))
scene.add_object(Sphere(5, color=Color(r=255, b=255)).stretch('x', angle_y=60))
scene.add_object(Plane(z=-10, color=Color(255, 255, 255)))
scene.add_object(Plane(z=80, color=Color(255, 255, 255)))
scene.add_object(Plane(x=-80, rot_y=90, color=Color(b=255)))
scene.add_object(Plane(x=80, rot_y=90, color=Color(b=255)))
scene.add_object(Plane(y=100, rot_x=90, color=Color(r=255, g=255)))
scene.add_object(Cylinder(5, x=-80, y=100, color=Color(b=255)))
scene.add_object(Cylinder(5, x=80, y=100, color=Color(b=255)))
scene.add_object(Cone(10, color=Color(r=128, g=128, b=128)))
nb_lines_chunk = 50
dispatch = Dispatcher(61385, set(i for i in range(height) if i % nb_lines_chunk == 0), key_fmt='i')
dispatch.welcome = bytes(scene)