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

Python超人-宇宙模拟器

上级 d2d710b1
...@@ -150,12 +150,12 @@ if __name__ == '__main__': ...@@ -150,12 +150,12 @@ if __name__ == '__main__':
radius = moon.planet.position[2] + 40 * random.random() - 20 # * moon.distance_scale radius = moon.planet.position[2] + 40 * random.random() - 20 # * moon.distance_scale
asteroid = Entity(model='sphere', position=pos, color=color.white, scale=1.5) asteroid = Entity(model='sphere', position=pos, color=color.white, scale=1.5)
asteroid.s_angle = 89.5 asteroid.s_angle = 89.5
y = 10 * random.random() - 5
def rotation(): def rotation():
x = sun.planet.x + radius * math.cos(asteroid.s_angle) x = sun.planet.x + radius * math.cos(asteroid.s_angle)
z = sun.planet.z + radius * math.sin(asteroid.s_angle) z = sun.planet.z + radius * math.sin(asteroid.s_angle)
asteroid.position = (x, 10 * random.random() - 5, z) asteroid.position = (x, y, z)
speed = random.random() / 15 speed = random.random() / 100
asteroid.s_angle += speed asteroid.s_angle += speed
asteroid.update = rotation asteroid.update = rotation
...@@ -172,6 +172,7 @@ if __name__ == '__main__': ...@@ -172,6 +172,7 @@ if __name__ == '__main__':
import math import math
# print(time_data.years) # print(time_data.years)
if time_data.years > 1 and not hasattr(asteroids, "years_1"): if time_data.years > 1 and not hasattr(asteroids, "years_1"):
set_alpha_animation(asteroids, 0.0, 1.0, 0.01) set_alpha_animation(asteroids, 0.0, 1.0, 0.01)
setattr(asteroids, "years_1", True) setattr(asteroids, "years_1", True)
elif time_data.years > 4 and not hasattr(asteroids, "years_5"): elif time_data.years > 4 and not hasattr(asteroids, "years_5"):
...@@ -183,11 +184,15 @@ if __name__ == '__main__': ...@@ -183,11 +184,15 @@ if __name__ == '__main__':
set_alpha_animation(moon, 0.0, 1.0, 0.005) set_alpha_animation(moon, 0.0, 1.0, 0.005)
setattr(moon, "years_6", True) setattr(moon, "years_6", True)
elif time_data.years > 8 and not hasattr(asteroids, "years_8"): elif time_data.years > 8 and not hasattr(asteroids, "years_8"):
if not hasattr(asteroids, "c_time"):
asteroids.c_time = time.time()
c_time = time.time()
# set_alpha_animation(asteroids, 0.0, 1.0, 0.01) # set_alpha_animation(asteroids, 0.0, 1.0, 0.01)
for i in range(3): if c_time - asteroids.c_time > 0.1:
asteroids.c_time = c_time
create_asteroid() create_asteroid()
if time_data.years > 11 and not hasattr(moon, "mars_rotation"): if time_data.years > 30 and not hasattr(moon, "mars_rotation"):
setattr(asteroids, "years_8", True) setattr(asteroids, "years_8", True)
moon.planet.look_at(mars.planet) moon.planet.look_at(mars.planet)
radius = 12 radius = 12
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册