From 625fb2ba8af9343d6b8bc492cf284b0588e87fdc Mon Sep 17 00:00:00 2001 From: march3 Date: Tue, 5 Dec 2023 17:57:35 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- objs/battleship.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 objs/battleship.py diff --git a/objs/battleship.py b/objs/battleship.py new file mode 100644 index 0000000..6161a8a --- /dev/null +++ b/objs/battleship.py @@ -0,0 +1,57 @@ +# -*- coding:utf-8 -*- +# title :战舰 +# description :战舰 +# author :Python超人 +# date :2023-02-11 +# link :https://gitcode.net/pythoncr/ +# python_version :3.8 +# ============================================================================== +from objs.obj import Obj + + +class BattleShip(Obj): + """ + 战舰 + """ + + def __init__(self, name="战舰", mass=5.97237e24, + init_position=[0, 0, 0], + init_velocity=[0, 0, 0], + texture="Missile_BaseColor.jpg", size_scale=1.0, distance_scale=1.0, + ignore_mass=False, density=1e3, color=(7, 0, 162), + trail_color=None, show_name=False, + model="battleship.obj", rotation=(0, 0, 0), + parent=None, gravity_only_for=[]): + params = { + "name": name, + "mass": mass, + "init_position": init_position, + "init_velocity": init_velocity, + "density": density, + "color": color, + "texture": texture, + "size_scale": size_scale, + "distance_scale": distance_scale, + "ignore_mass": ignore_mass, + "trail_color": trail_color, + "show_name": show_name, + "parent": parent, + "rotation": rotation, + "gravity_only_for": gravity_only_for, + "model": model + } + super().__init__(**params) + + +if __name__ == '__main__': + battleship = BattleShip(size_scale=1000) + print(battleship) + + + def on_timer_changed(time_data): + battleship.planet.rotation_z += 0.1 + + + battleship.show_demo(size_scale=1000, + position=[0, 0, -10000000], + directional_light_pos=(200, 0, -300)) -- GitLab