From bb02dc5b8b2788abe92b119817c334824308fd06 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Fri, 5 Aug 2011 08:31:29 +0300 Subject: Modify Cat to use ResourceMan --- Cat.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Cat.js b/Cat.js index f00ffbc..0d1df14 100644 --- a/Cat.js +++ b/Cat.js @@ -15,20 +15,14 @@ var p = Cat.prototype = new Container(); p.initialize = function() { p.base_initialize(); - var _this = this; - - this.img = new Image(); - this.img.onload = function() { _this.setup(); }; - this.img.src = "gfx/cat.jpg"; - }; - - p.setup = function() { + this.img = Game.resMan.get("cat"); this.gfx = new Bitmap(this.img); - this.addChild(this.gfx); - + this.regX = this.img.width / 2; this.regY = this.img.height / 2; - } + + this.addChild(this.gfx); + }; p.tick = function() { if (this._barrelRolling) { -- cgit v1.2.3