Documentation
¶
Index ¶
- func CalcAngleBetweenPoints(x1, y1, x2, y2 float64) float64
- func CalcDistance(x1, y1, x2, y2 float64) float64
- func CalcWeaponFireAngle(curX, curY, bulletSpeed, enemyX, enemyY, enemySpeed, enemyRotation float64) (angle float64, targetX float64, targetY float64)
- func IsPointInRotatedRectangle(x, y, cx, cy, length, width, angle float64) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcAngleBetweenPoints ¶
ebiten 游戏引擎坐标体系: | ^ y | -3 | | -2 | | -1 | 1 2 3 x ------------+------------> | -3 -2 -1 | 1 | | 2 | | 3
CalcAngleBetweenPoints 计算两个点之间的夹角(+90 转换成顺时针角度, +360 确保非负数)
func CalcWeaponFireAngle ¶
func CalcWeaponFireAngle( curX, curY, bulletSpeed, enemyX, enemyY, enemySpeed, enemyRotation float64, ) (angle float64, targetX float64, targetY float64)
CalcWeaponFireAngle 计算武器发射角度
func IsPointInRotatedRectangle ¶
示例:length 4, width 1, angle 0
——
| | | | 3 | |
—— 1
示例:length 4, width 1, angle 90
——————
| | 1
—————— 3
IsPointInRotatedRect 判断点 (x, y) 是否在由中心点 (cx, cy),旋转角度 angle,长度 length 和宽度 width 的长方形内
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.