Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
3936b575
宇宙模拟器
项目概览
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看板
提交
3936b575
编写于
11月 15, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
935df579
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
62 addition
and
16 deletion
+62
-16
simulators/ursina/entities/ursina_demo.py
simulators/ursina/entities/ursina_demo.py
+62
-16
未找到文件。
simulators/ursina/entities/ursina_demo.py
浏览文件 @
3936b575
...
...
@@ -8,22 +8,42 @@ texture = load_texture("../../../objs/textures/core_valaga_clas.jpg")
camera_ship
=
Entity
(
model
=
"../../../objs/models/core_valaga_clas.obj"
,
texture
=
texture
,
double_sided
=
True
)
shperes
=
[]
bullets
=
[]
targets
=
[]
target1
=
Entity
(
# model="sphere",
model
=
"../../../objs/models/drops.obj"
,
texture
=
load_texture
(
"../../../objs/textures/rock_snow.jpg"
),
collider
=
'box'
,
position
=
Vec3
(
0
,
0
,
26000
),
scale
=
900
)
targets
.
append
(
target1
)
def
create_sphere
():
shpere_l
=
Entity
(
target2
=
Entity
(
# model="sphere",
model
=
"../../../objs/models/drops.obj"
,
texture
=
load_texture
(
"../../../objs/textures/rock_snow.jpg"
),
collider
=
'box'
,
position
=
Vec3
(
-
8000
,
0
,
26000
),
scale
=
900
)
targets
.
append
(
target2
)
def
create_bullets
():
bullet_l
=
Entity
(
# model="sphere",
model
=
"../../../objs/models/drops.obj"
,
texture
=
load_texture
(
"../../../objs/textures/rock_snow.jpg"
),
position
=
camera_ship
.
position
+
Vec3
(
-
260
,
0
,
0
),
scale
=
500
)
shperes
.
append
(
shpere_l
)
shpere_r
=
Entity
(
model
=
"../../../objs/models/drops.obj"
,
texture
=
load_texture
(
"../../../objs/textures/rock_snow.jpg"
),
collider
=
'box'
,
position
=
camera_ship
.
position
+
Vec3
(
-
260
,
0
,
0
),
scale
=
500
)
bullets
.
append
(
bullet_l
)
bullet_r
=
Entity
(
# model="sphere",
model
=
"../../../objs/models/drops.obj"
,
texture
=
load_texture
(
"../../../objs/textures/football.jpg"
),
position
=
camera_ship
.
position
+
Vec3
(
260
,
0
,
0
),
scale
=
500
)
shperes
.
append
(
shpere_r
)
collider
=
'box'
,
position
=
camera_ship
.
position
+
Vec3
(
260
,
0
,
0
),
scale
=
500
)
bullets
.
append
(
bullet_r
)
# camera.parent = camera_ship.planet
...
...
@@ -42,18 +62,44 @@ camera.rotation_x = 10
# application.time_scale = 1
def
update
():
camera_ship
.
position
+=
Vec3
(
0
,
0
,
10
)
camera_ship
.
rotation_y
+=
0.01
camera_ship
.
position
+=
camera_ship
.
forward
*
2
#
camera_ship.rotation_y += 0.01
# camera.position = Vec3(0, 1000, -1000)
for
shpere
in
shperes
:
shpere
.
rotation_y
=
camera_ship
.
rotation_y
shpere
.
position
+=
shpere
.
forward
*
10
destroy_bullets
=
[]
destroy_targets
=
[]
for
bullet
in
bullets
:
bullet
.
rotation_x
=
camera_ship
.
rotation_x
bullet
.
rotation_y
=
camera_ship
.
rotation_y
bullet
.
rotation_z
=
camera_ship
.
rotation_z
bullet
.
position
+=
bullet
.
forward
*
3
for
target
in
targets
:
if
bullet
.
intersects
(
target
):
if
target
not
in
destroy_targets
and
bullet
not
in
destroy_bullets
:
destroy_bullets
.
append
(
bullet
)
destroy_targets
.
append
(
target
)
for
i
in
range
(
len
(
destroy_targets
)
-
1
,
-
1
,
-
1
):
targets
.
remove
(
destroy_targets
[
i
])
destroy
(
destroy_targets
[
i
])
for
i
in
range
(
len
(
destroy_bullets
)
-
1
,
-
1
,
-
1
):
bullets
.
remove
(
destroy_bullets
[
i
])
destroy
(
destroy_bullets
[
i
])
if
held_keys
[
'a'
]:
camera_ship
.
rotation_y
-=
0.03
if
held_keys
[
'd'
]:
camera_ship
.
rotation_y
+=
0.03
if
held_keys
[
'w'
]:
camera_ship
.
rotation_x
-=
0.03
if
held_keys
[
's'
]:
camera_ship
.
rotation_x
+=
0.03
def
input
(
key
):
print
(
key
)
if
key
==
"space"
:
create_
sphere
()
create_
bullets
()
# player = FirstPersonController()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录