1-body problem
tech: 1-body problem - do 100% damage if there is only 1 active bullet experiment mode and junk tech: random aiming bug fix - sniper, shooter aiming might be improved (no more firing backwards) or maybe I just made it worse, let me know bug fix - Shift registers working on rewriting the way backgrounds and foregrounds are drawn on each level (in progress)
This commit is contained in:
13
js/mob.js
13
js/mob.js
@@ -905,14 +905,19 @@ const mobs = {
|
||||
}
|
||||
//rotate towards fireAngle
|
||||
const angle = this.angle + Math.PI / 2;
|
||||
c = Math.cos(angle) * this.fireDir.x + Math.sin(angle) * this.fireDir.y;
|
||||
const dot = Vector.dot({
|
||||
x: Math.cos(angle),
|
||||
y: Math.sin(angle)
|
||||
}, this.fireDir)
|
||||
// c = Math.cos(angle) * this.fireDir.x + Math.sin(angle) * this.fireDir.y;
|
||||
const threshold = 0.1;
|
||||
if (c > threshold) {
|
||||
if (dot > threshold) {
|
||||
this.torque += 0.000004 * this.inertia;
|
||||
} else if (c < -threshold) {
|
||||
} else if (dot < -threshold) {
|
||||
this.torque -= 0.000004 * this.inertia;
|
||||
} else if (this.noseLength > 1.5) {
|
||||
} else if (this.noseLength > 1.5 && dot > 0 && dot < 0.03) {
|
||||
//fire
|
||||
console.log(dot)
|
||||
spawn.bullet(this.vertices[1].x, this.vertices[1].y, 9 + Math.ceil(this.radius / 15));
|
||||
const v = 15;
|
||||
Matter.Body.setVelocity(mob[mob.length - 1], {
|
||||
|
||||
Reference in New Issue
Block a user