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

Python超人-宇宙模拟器

上级 383fd815
......@@ -6,7 +6,8 @@
# link :https://gitcode.net/pythoncr/
# python_version :3.9
# ==============================================================================
import time
import datetime
from bodies import Sun, Earth, Moon
from objs import CoreValagaClas, SciFiBomber, WaterDrop, QuadObj, CircleObj
......@@ -204,10 +205,22 @@ class TwoWayFoilSim:
# self.sun.two_dim.planet.init_scale += 0.05
self.two_way_foil_circle.planet.init_scale += 0.8
self.blink(self.sun.two_dim)
for b in self.three_dim_bodies:
if two_bodies_colliding(self.two_way_foil_circle, b):
b.planet.enabled = False
b.two_dim.planet.enabled = True
# 二维化延时的时间
two_way_delay_times = [0.5, # 太阳
0.5, 0.8, 1.0, # 水星 金星 地球
1.2, 2.0, 3.0, # 火星 木星 土星
4.0, 5.0, 6.5] # 天王星 海王星 冥王星
for idx, b in enumerate(self.three_dim_bodies):
if hasattr(b, "two_way_time"):
if b.two_way_time is not None:
if time.time() - b.two_way_time > two_way_delay_times[idx]:
b.planet.enabled = False
b.two_dim.planet.enabled = True
b.two_way_time = None
elif two_bodies_colliding(self.two_way_foil_circle, b):
b.two_way_time = time.time()
# b.planet.enabled = False
# b.two_dim.planet.enabled = True
if b.two_dim.planet.enabled:
# b.two_dim.planet.init_scale += 0.05
self.blink(b.two_dim)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册