--[[
WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
]]
//Neko Class
var NekoNin = gamecore.Base.extend('NekoNin',
{
nekoAnim:'',
bmpAnimation:'',
spriteSheet:''
},
{
hp:1000,
lastFireTime:0,
nekoState : 'nekoIdle',
nekoState2 : 'nekoIdle',
nekoJump : false,
jumpSpeedLimit : 15,
jumpSpeed : 15,
init: function()
{
this.Class.nekoAnim=new Image();
this.Class.nekoAnim.onload = this.handleImageLoad;
this.Class.nekoAnim.onerror = this.handleImageError;
this.Class.nekoAnim.src= 'img/MonsterARun.png';
console.log(this);
},
handleImageLoad: function(e)
{
console.log(this);
this.Class.spriteSheet = new createjs.SpriteSheet({
// image to use
images: [this],
// width, height & registration point of each sprite
frames: { width: 64, height: 64, regX: 32, regY: 32 },
// To slow down the animation loop of the sprite, we set the frequency to 4 to slow down by a 4x factor
animations: {
walk: [0, 9, "walk", 4]
}
});
// to save file size, the loaded sprite sheet only includes left facing animations
// we could flip the display objects with scaleX=-1, but this is expensive in most browsers
// instead, we generate a new sprite sheet which includes the flipped animations
createjs.SpriteSheetUtils.addFlippedFrames(spriteSheet, true, false, false); // create a BitmapSequence instance to display and play back the sprite sheet:
this.Class.bmpAnimation = new createjs.BitmapAnimation(spriteSheet);
// set the registration point (the point it will be positioned and rotated around)
// to the center of the frame dimensions:
this.Class.bmpAnimation.regX = this.Class.bmpAnimation.spriteSheet.frameWidth/2|