I've been looking at the other questions that are similar to mine, but I can't seem to find an answer.
The error that I'm having is in the title as well:
Uncaught TypeError: self.Rotate() is not a function
Here's the full code where this happens:
var Card = function(renderer, stage) {
var self = this;
self.name = "None";
self.health = 5;
self.renderer = renderer;
self.stage = stage;
self.sprite = null;
PIXI.loader.add("FirePlace/GW2-Logo.jpg").load(self.Setup);
};
Card.prototype.Setup = function() {
self.sprite = new PIXI.Sprite(PIXI.loader.resources["FirePlace/GW2-Logo.jpg"].texture);
console.log(self.stage);
self.stage.addChild(self.sprite);
console.log("Sprite loaded");
self.renderer.render(self.stage);
self.Rotate();
};
Card.prototype.SetName = function(name) {
self.name = name;
};
Card.prototype.Rotate = function() {
requestAnimationFrame(self.Rotate);
if (self.sprite === null)
console.log("Sprite is null");
if (self.sprite !== null && self.sprite.rotation <= 1.5708)
self.sprite.rotation += 0.03;
self.renderer.render(self.stage);
};
At the end of the Setup function I try to call the Rotate function and this is where it fails.