{"repo":"dynamder/Godot-EasyTrajectory","free":true,"listed":false,"github":"https://github.com/dynamder/Godot-EasyTrajectory","clone":"git clone https://github.com/dynamder/Godot-EasyTrajectory.git","description":"A Godot plugin intended for creating various kind of trajectories easily but with excellent flexibility, can be used for bullet or enemy move (e.g. bullet hell games)","language":"GDScript","stars":21,"topics":["bullet-hell","gdscript","godot","movement","trajectory"],"license":"MIT","category":"game-templates","readme_excerpt":"EasyTrajectory ENGLISH 简体中文 EasyTrajectory是一个针对 2D场景 ，用于快速，轻松的创建诸如弹道，敌人移动之类的轨迹的插件，完全由GDscript编写。可以通过不同轨迹类型的组合，简单，灵活地创建出较为复杂的轨迹 ------ 将addons文件夹复制到你的godot项目即可完成安装 快速上手 要创建一个轨迹，有两种方法： - 使用new()方法 - 使用工厂函数create() 下面以创建一条倾角30°的直线轨迹为例，物体在此轨迹上的移动速度为30 注意： Godot的坐标系是计算机图形学中常用的坐标系，因此，30°是从x轴正方向顺时针旋转30°而非像数学中那样逆时针旋转30° new() create() 在使用工厂函数时，第一个参数为轨迹类型，第二个参数称为参数字典，为轨迹的参数，键名与轨迹的对应属性名相同。 参数字典可以使用各轨迹的辅助构造类构建。 建议 ：总是使用工厂函数create()的方式，除非需要快速对某些轨迹形状进行测试 使用轨迹 要使用轨迹，需要在 process 方法或是 physics process 方法中进行如下操作： - update(delta) 用于更新轨迹内部属性，应当在 evaluate(delta) 前调用 - evaluate(delta) 返回一个 Vector2 类型的位移矢量，与节点的position属性相加即可让节点沿轨迹移动 注意： 轨迹的坐标位置并 不是绝对 的，EasyTrajectory定义的轨迹只是定义一个轨迹的形状，轨迹的 起点 为节点开始迭代时的 自身位置 。从效果上来看，对哪个节点使用EasyTrajectoy的轨迹迭代，轨迹使用的就是该节点的 局部坐标系 重置与重定义轨迹 - 重置轨迹至初始状态： 注 ：如上所述，这并不能让被迭代的对象回到原来的位置 - 重定义轨迹（以LinearTrajectory为例）： 重定义的轨迹与原轨迹类型相同，且重定义的参数只能由字典方式指定（就像工厂函数那样） 注 ：在TrajectoryHolder及其子类中，子轨迹的类型在重定义时可以改变（见下文） EasyTrajectory提供了集中默认集成的轨迹类型，通过这些轨迹类型及其组合，能满足大部分的基本功能，下面将介绍EasyTrajectory中自带的轨迹类型 内置变换 BaseTrajectory中有一个类型为Transform2D的属性embed transform，赋值该属性会让轨迹按此Transform2D进行变换。 这一变换时惰性的，只有evaluate方法被调用时，返回的向量会被施以此变换。 ------ 默认轨迹类型 类型清单列表（括号内为工厂函数中需要使用的名字）： - LinearTrajectory (linear) - CircleTrajectory (circle) - VelAccelTrajectory (velaccel) - BezierTrajectory (bezier) - SequenceTrajectoryHolder (sequence holder) - BlendTrajectoryHolder (blend holder) 注： 标有（可选）的属性，在创建时含默认参数，可以不提供 BaseTrajectory 所有轨迹的基类，具有如下的常用属性： LinearTrajectory (linear) 直线轨迹类型，具有如下属性： 在工厂函数中，按如下格式创建(后续仅列出必要属性)： 或者使用参数字典（命名规","default_branch":null,"files":null,"tree":[],"storefront":"/r/dynamder","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dynamder/Godot-EasyTrajectory/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}