Slide 15
Slide 15 text
Crafty.c("Walkable", {
Walkable: function(speed) {
this.addComponent("Collision");
this.bind("EnterFrame", function() {
if (paused()) return;
if (obstacle() || outOfBounds()) return;
// Move the sprite
this.playAnimation(this.direction);
this.move(this.direction, speed);
})