|
@@ -363,7 +363,7 @@ class GameScene extends Phaser.Scene {
|
|
|
createPlayer() {
|
|
|
// 创建玩家
|
|
|
//this.player = this.physics.add.sprite(GAME_WIDTH / 2, GAME_HEIGHT - 100, 'playerAnim');
|
|
|
- this.player = this.physics.add.sprite(direction.value+46, GAME_HEIGHT - 100, 'playerAnim');
|
|
|
+ this.player = this.physics.add.sprite(direction.value + 46, GAME_HEIGHT - 100, 'playerAnim');
|
|
|
this.player.setCollideWorldBounds(true);
|
|
|
this.player.setScale(0.8);
|
|
|
this.player.lives = this.lives;
|
|
@@ -940,13 +940,13 @@ class GameScene extends Phaser.Scene {
|
|
|
if (this.player && this.player.active) {
|
|
|
if (this.cursors.left.isDown) {
|
|
|
//this.player.setVelocityX(-200);
|
|
|
- this.player.setX(direction.value+46);
|
|
|
+ this.player.setX(direction.value + 46);
|
|
|
if (this.player.anims.currentAnim?.key !== 'playerLeft' && !this.player.anims.paused) {
|
|
|
this.player.anims.play('playerLeft', true);
|
|
|
}
|
|
|
} else if (this.cursors.right.isDown) {
|
|
|
//this.player.setVelocityX(200);
|
|
|
- this.player.setX(direction.value+46);
|
|
|
+ this.player.setX(direction.value + 46);
|
|
|
if (this.player.anims.currentAnim?.key !== 'playerRight' && !this.player.anims.paused) {
|
|
|
this.player.anims.play('playerRight', true);
|
|
|
}
|
|
@@ -1361,14 +1361,17 @@ const getCanvas = () => {
|
|
|
ctx.lineWidth = 5;
|
|
|
ctx.stroke();
|
|
|
// 绘制每个点
|
|
|
- postData.forEach((point: any) => {
|
|
|
- const [x, y] = point;
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(x, y, 5, 0, Math.PI * 2); // 绘制半径为5的圆点
|
|
|
- ctx.fillStyle = 'red';
|
|
|
- ctx.fill();
|
|
|
- ctx.lineWidth = 1;
|
|
|
- ctx.stroke();
|
|
|
+ postData.forEach((point: any, index: number) => {
|
|
|
+ //眼睛鼻子不显示
|
|
|
+ if (![0, 1, 2].includes(index)) {
|
|
|
+ const [x, y] = point;
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(x, y, 5, 0, Math.PI * 2); // 绘制半径为5的圆点
|
|
|
+ ctx.fillStyle = 'red';
|
|
|
+ ctx.fill();
|
|
|
+ ctx.lineWidth = 1;
|
|
|
+ ctx.stroke();
|
|
|
+ }
|
|
|
});
|
|
|
// 根据点关系连线
|
|
|
const arr = [[10, 8], [8, 6], [6, 5], [5, 7], [7, 9], [6, 12], [5, 11], [12, 11], [12, 14], [14, 16], [11, 13], [13, 15]]
|