Fix enemy facing direction and add player damage feedback
This commit is contained in:
+6
-6
@@ -40,16 +40,16 @@ export class Crab extends Enemy {
|
||||
this.model.add(spot);
|
||||
}
|
||||
|
||||
// Eye stalks (on the armored front side, -Z)
|
||||
// Eye stalks (on the armored front side, +Z)
|
||||
const stalkMat = new THREE.MeshToonMaterial({ color: 0xdd5533 });
|
||||
const eyeMat = new THREE.MeshToonMaterial({ color: 0x111122 });
|
||||
for (const side of [-1, 1]) {
|
||||
const stalk = new THREE.Mesh(new THREE.CylinderGeometry(0.035, 0.035, 0.22, 6), stalkMat);
|
||||
stalk.position.set(side * 0.22, 0.55, -0.42);
|
||||
stalk.position.set(side * 0.22, 0.55, 0.42);
|
||||
this.registerFadeMesh(stalk);
|
||||
this.model.add(stalk);
|
||||
const eye = new THREE.Mesh(new THREE.SphereGeometry(0.09, 10, 8), eyeMat);
|
||||
eye.position.set(side * 0.22, 0.68, -0.42);
|
||||
eye.position.set(side * 0.22, 0.68, 0.42);
|
||||
this.registerFadeMesh(eye);
|
||||
this.model.add(eye);
|
||||
}
|
||||
@@ -70,8 +70,8 @@ export class Crab extends Enemy {
|
||||
const clawGeom = new THREE.SphereGeometry(0.22, 12, 10);
|
||||
this.clawL = new THREE.Mesh(clawGeom, shellMat);
|
||||
this.clawR = new THREE.Mesh(clawGeom, shellMat);
|
||||
this.clawL.position.set(-0.45, 0.45, -0.5);
|
||||
this.clawR.position.set(0.45, 0.45, -0.5);
|
||||
this.clawL.position.set(-0.45, 0.45, 0.5);
|
||||
this.clawR.position.set(0.45, 0.45, 0.5);
|
||||
this.clawL.scale.set(1.2, 0.7, 1.4);
|
||||
this.clawR.scale.set(1.2, 0.7, 1.4);
|
||||
this.clawL.castShadow = true;
|
||||
@@ -144,7 +144,7 @@ export class Crab extends Enemy {
|
||||
) {
|
||||
// Armored from the front: reduce damage coming from the facing side
|
||||
if (sourcePos) {
|
||||
const front = new THREE.Vector3(0, 0, -1)
|
||||
const front = new THREE.Vector3(0, 0, 1)
|
||||
.applyQuaternion(this.body.quaternion);
|
||||
front.y = 0;
|
||||
front.normalize();
|
||||
|
||||
Reference in New Issue
Block a user