Energy and damage
This commit is contained in:
1 parent
521ec559bf
commit
9b9bbc70e8
3 files changed
+27
-2
No files matched your search
@@ -27,6 +27,10 @@ export function wrap(min, x, max) {
|
||||
return ((x-min + max-min) % (max-min)) + min;
|
||||
}
|
||||
|
||||
export function within(x, y, tx, ty, r) {
|
||||
return Math.abs(x-tx) < r && Math.abs(y-ty) < r;
|
||||
}
|
||||
|
||||
export function parable(t, x, y, a, v, w=0, g=9.8) {
|
||||
const fx = x + t*v * Math.cos(a) - 0.5 * -w * t*t;
|
||||
const fy = y + t*v * Math.sin(a) - 0.5 * -g * t*t;
|
||||
|
||||
Reference in new issue
Block a user