(subject: Rect, object: Rect, threshhold = 0)
| 35 | |
| 36 | /** 用来判断subject和object是否相撞 */ |
| 37 | export function testCollide(subject: Rect, object: Rect, threshhold = 0) { |
| 38 | return ( |
| 39 | between(subject.x - object.width, object.x, subject.x + subject.width, threshhold) && |
| 40 | between(subject.y - object.height, object.y, subject.y + subject.height, threshhold) |
| 41 | ) |
| 42 | } |
| 43 | |
| 44 | export const frame = (x: number) => (1000 / 60) * x |
| 45 |
no test coverage detected