Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
fd77b603
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
fd77b603
编写于
12月 07, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
d2d710b1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
5 deletion
+10
-5
sim_lab/the_lost_planet.py
sim_lab/the_lost_planet.py
+10
-5
未找到文件。
sim_lab/the_lost_planet.py
浏览文件 @
fd77b603
...
@@ -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
()
/
1
5
speed
=
random
.
random
()
/
1
00
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录