mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Basic implementations
This commit is contained in:
24
js/MrCroc.js
Normal file
24
js/MrCroc.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import Movable from "./Movable.js";
|
||||
import RetroAnimation from "./retro/RetroAnimation.js";
|
||||
|
||||
export default class MrCroc extends Movable
|
||||
{
|
||||
constructor() {
|
||||
super(new RetroAnimation('graphics/mr-croc-walk-right.png', 2, 5), 5);
|
||||
|
||||
this.addAnimation('WALK_RIGHT', new RetroAnimation('graphics/mr-croc-walk-right.png', 2, 5, 10));
|
||||
this.addAnimation('WALK_LEFT', new RetroAnimation('graphics/mr-croc-walk-left.png', 2, 5, 10));
|
||||
}
|
||||
|
||||
moveRight(timestamp, delta = 1)
|
||||
{
|
||||
this.playAnimation('WALK_RIGHT', timestamp);
|
||||
super.moveRight(delta);
|
||||
}
|
||||
|
||||
moveLeft(timestamp, delta = 1)
|
||||
{
|
||||
this.playAnimation('WALK_LEFT', timestamp);
|
||||
super.moveLeft(delta);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user