mr-crocs-adventures/js/MrCroc.js

25 lines
787 B
JavaScript
Raw Normal View History

2020-01-22 22:50:45 +01:00
import Movable from "./Movable.js";
import RetroAnimation from "./retro/RetroAnimation.js";
export default class MrCroc extends Movable
{
constructor() {
2020-01-26 22:12:32 +01:00
let SCALE = 2;
2020-01-25 13:11:25 +01:00
super(new RetroAnimation('graphics/mr-croc-walk-right.png', 2, SCALE), 7);
this.isJumping = false;
this.addAnimation('WALK_RIGHT', new RetroAnimation('graphics/mr-croc-walk-right.png', 2, SCALE, 10));
this.addAnimation('WALK_LEFT', new RetroAnimation('graphics/mr-croc-walk-left.png', 2, SCALE, 10));
2020-01-22 22:50:45 +01:00
}
moveRight(timestamp, delta = 1)
{
this.playAnimation('WALK_RIGHT', timestamp);
super.moveRight(delta);
}
moveLeft(timestamp, delta = 1)
{
this.playAnimation('WALK_LEFT', timestamp);
super.moveLeft(delta);
}
}