Added in frameName support for animations and easy setting of sprites born from a texture atlas (all for you Jesse!)

This commit is contained in:
Richard Davey
2013-04-15 15:42:13 +01:00
parent ebf83609ae
commit f4bf6c607f
12 changed files with 187 additions and 73 deletions
+9 -1
View File
@@ -104,6 +104,14 @@ class Sprite extends GameObject {
return this.animations.frame;
}
public set frameName(value?: string) {
this.animations.frameName = value;
}
public get frameName(): string {
return this.animations.frameName;
}
public render(camera:Camera, cameraOffsetX: number, cameraOffsetY: number): bool {
// Render checks
@@ -135,7 +143,7 @@ class Sprite extends GameObject {
this._dw = this.bounds.width * this.scale.x;
this._dh = this.bounds.height * this.scale.y;
if (this.animations.currentFrame)
if (this.animations.currentFrame !== null)
{
this._sx = this.animations.currentFrame.x;
this._sy = this.animations.currentFrame.y;