Skip to content

Instantly share code, notes, and snippets.

@boppreh
Created January 10, 2018 19:15
Show Gist options
  • Save boppreh/a2148a2ec1bb60f7843d23a13659725f to your computer and use it in GitHub Desktop.
Save boppreh/a2148a2ec1bb60f7843d23a13659725f to your computer and use it in GitHub Desktop.
Script for airma.sh to help aim. Moves enemies' flags to around you, like a radar, and their position compensates for leading time/distance. May have to change "mult" to suit your plane/upgrades.
let me = Players.getMe();
let mult = 1000;
(function(updateNameplate) {
me.__proto__.updateNameplate = function() {
let ret = updateNameplate.apply(this, arguments);
this.sprites.flag.scale.set(0.2, 0.2);
if (this == me) {
this.sprites.flag.position.set(me.pos.x, me.pos.y);
return ret;
}
let d = Math.sqrt(Math.pow(me.pos.y-this.pos.y, 2)+Math.pow(me.pos.x-this.pos.x, 2));
let leading = {x: this.pos.x + this.speed.x*mult/d, y: this.pos.y + this.speed.y*mult/d};
let angle = Math.atan2(leading.y-me.pos.y, leading.x-me.pos.x);
let aura = {x: me.pos.x + 70 * Math.cos(angle), y: me.pos.y + 70 * Math.sin(angle)};
this.sprites.flag.position.set(aura.x, aura.y);
return ret;
};
})(me.__proto__.updateNameplate);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment