Energy and damage

This commit is contained in:
zenoamaro committed 2019-06-26 03:05:48 +02:00
1 parent 521ec559bf
commit 9b9bbc70e8
3 files changed
+27 -2

No files matched your search

+4
View File
@@ -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;