fix bugs @ cat
This commit is contained in:
parent
fc2d861c7f
commit
2debc1d5ae
|
@ -28,6 +28,7 @@ export class Cat {
|
||||||
this.size = img.height / 5;
|
this.size = img.height / 5;
|
||||||
|
|
||||||
this.sprite = new Sprite(this.x, this.y, this.size, this.size, 'dynamic');
|
this.sprite = new Sprite(this.x, this.y, this.size, this.size, 'dynamic');
|
||||||
|
console.log(`sprite made at ${this.x}, ${this.y}`);
|
||||||
this.sprite.rotationLock = true;
|
this.sprite.rotationLock = true;
|
||||||
this.sprite.bounciness = 0.1;
|
this.sprite.bounciness = 0.1;
|
||||||
this.sprite.spriteSheet = img;
|
this.sprite.spriteSheet = img;
|
||||||
|
@ -187,23 +188,24 @@ export class Cat {
|
||||||
|
|
||||||
this.sprite.x = this.x;
|
this.sprite.x = this.x;
|
||||||
this.sprite.y = this.y;
|
this.sprite.y = this.y;
|
||||||
|
console.log(`sprite re-made at ${this.x}, ${this.y}`);
|
||||||
this.sprite.vel.x = 0;
|
this.sprite.vel.x = 0;
|
||||||
this.sprite.vel.y = 0;
|
this.sprite.vel.y = 0;
|
||||||
|
|
||||||
this.sprite.scale = this.targetSize / this.size;
|
// this.sprite.scale = this.targetSize / this.size;
|
||||||
this.sprite.mirror.x = false;
|
// this.sprite.mirror.x = false;
|
||||||
this.sprite.rotation = 0;
|
// this.sprite.rotation = 0;
|
||||||
this.sprite.rotationSpeed = 0;
|
// this.sprite.rotationSpeed = 0;
|
||||||
|
|
||||||
this.sprite.anis.offset.x = this.shiftOffset + this.targetSize / 4;
|
// this.sprite.anis.offset.x = this.shiftOffset + this.targetSize / 4;
|
||||||
|
|
||||||
this.steps = [];
|
this.steps = [];
|
||||||
this.currentStepIndex = 0;
|
this.currentStepIndex = 0;
|
||||||
this.isMoving = false;
|
this.isMoving = false;
|
||||||
this.stepTimer = 0;
|
this.stepTimer = 0;
|
||||||
this.moveDirection = null;
|
this.moveDirection = null;
|
||||||
this.targetX = null;
|
// this.targetX = null;
|
||||||
this.targetY = null;
|
// this.targetY = null;
|
||||||
|
|
||||||
this.changeAni('i');
|
this.changeAni('i');
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,7 @@ export class Cat {
|
||||||
let h = this.sprite.height;
|
let h = this.sprite.height;
|
||||||
|
|
||||||
rectMode(CENTER);
|
rectMode(CENTER);
|
||||||
// rect(this.sprite.x, this.sprite.y, w, h);
|
rect(this.sprite.x, this.sprite.y, w, h);
|
||||||
};
|
};
|
||||||
|
|
||||||
changeAni(key) {
|
changeAni(key) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user