(function() { "use strict"; var Cursor = function(scene) { this.scene = null; this.diplay = null; this.position = 0; this.speed = 100; this.height = 250; this.status = 'normal'; this.images = { 'normal' : game.load.get('img_cursor1'), 'ok' : game.load.get('img_cursor2'), 'bad' : game.load.get('img_cursor3') } this.display = game.create.bitmap(this.images['normal'], {regX:51, regY:280}); this.moveTo(0) } var p = Cursor.prototype p.moveTo = function(position) { position = (position<0)? 360+position%360 : position%360; this.position = position; this.display.rotation = position; // this.display.x = this.height*Math.cos(tine.radians(-90)); // this.display.y = this.height*Math.sin(tine.radians(-90)); } p.move = function(direction) { this.moveTo(this.position + this.speed*game.time.fdelta*direction); } p.normal = function() { if (this.status === 'normal') return; this.display.image = this.images['normal']; this.status = 'normal'; } p.ok = function() { if (this.status === 'ok') return; this.display.image = this.images['ok']; this.status = 'ok'; } p.bad = function() { if (this.status === 'bad') return; this.display.image = this.images['bad']; this.status = 'bad'; } window.Cursor = Cursor; })();