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

Python超人-宇宙模拟器

上级 87c7cc14
...@@ -185,6 +185,7 @@ class JupiterProtectsEarthSim: ...@@ -185,6 +185,7 @@ class JupiterProtectsEarthSim:
self.text_panel.text = colliding_info self.text_panel.text = colliding_info
def on_ready(self): def on_ready(self):
from ursina import application
# 运行前触发 # 运行前触发
self.text_panel = create_text_panel() self.text_panel = create_text_panel()
self.text_panel.text = self.colliding_info % (0, "0.0%", self.text_panel.text = self.colliding_info % (0, "0.0%",
...@@ -192,6 +193,7 @@ class JupiterProtectsEarthSim: ...@@ -192,6 +193,7 @@ class JupiterProtectsEarthSim:
0, "0.0%", 0, "0.0%",
0, "0.0%", 0, "0.0%",
0, 0) 0, 0)
application.time_scale = 3
if __name__ == '__main__': if __name__ == '__main__':
...@@ -202,7 +204,7 @@ if __name__ == '__main__': ...@@ -202,7 +204,7 @@ if __name__ == '__main__':
# 设置计时器的最小时间单位为年 # 设置计时器的最小时间单位为年
BodyTimer().min_unit = BodyTimer.MIN_UNIT_YEARS BodyTimer().min_unit = BodyTimer.MIN_UNIT_YEARS
sim = JupiterProtectsEarthSim(comet_num=50) sim = JupiterProtectsEarthSim(comet_num=30)
# 运行前会触发 on_ready # 运行前会触发 on_ready
UrsinaEvent.on_ready_subscription(sim.on_ready) UrsinaEvent.on_ready_subscription(sim.on_ready)
...@@ -212,6 +214,6 @@ if __name__ == '__main__': ...@@ -212,6 +214,6 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果 # 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后- # position = 左-右+、上+下-、前+后-
ursina_run(sim.bodies, SECONDS_PER_MONTH, ursina_run(sim.bodies, SECONDS_PER_MONTH * 3,
position=(30000000, 0, -3000000000), position=(30000000, 0, -3000000000),
show_timer=True) show_timer=True)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册