提交 c973384b 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 6dd458bb
......@@ -29,7 +29,8 @@ class ColorBody(Body):
self.color = color
texture = self.gen_texture(texture, texture_bright, texture_contrast)
if rotation_speed is None:
rotation_speed = random.randint(10, 100) / 50
# 旋转方向随机
rotation_speed = random.randint(10, 100) / 50 - 1
params = {
"name": name,
"mass": mass,
......
......@@ -83,7 +83,7 @@ def gen_bodies_from_image(pixel_image, params, texture="color_body.png"):
# 获取像素的颜色
pixel = img.getpixel((w, h))
# 对于纯白色的颜色,就忽略,不生成星球(这样图片中,纯白色越多,对电脑的压力就越小)
if pixel[0] >= 255 and pixel[1] >= 255 and pixel[1] >= 255:
if pixel[0] >= 220 and pixel[1] >= 220 and pixel[1] >= 220:
continue
body_str = body_template % (f"星球{w}:{h}", pixel[0], pixel[1], pixel[2], scale * 10,
(width - w) * interval_factor, (height - h) * interval_factor, scale)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册