In your version game.tick invoked on window, use this
__intervalId = window.setInterval(function() { game.tick() } ,1000/game.tps);
Question
The error I'm recieving from Chrome is:
Uncaught TypeError: Cannot read property 'position' of undefined
I don't understand why I can't access the position field of this path, as it is clearly defined in the documentation: http://paperjs.org/reference/path/#position
Here is my simple code:
paper.install(window);
var canvas = document.getElementById("letterCanvas");
window.onload = function()
{
paper.setup("letterCanvas");
function Game(width, height)
{
this.width = width;
this.height = height;
this.tps = 60;
this.test = new Path.Rectangle(new Point(100,100), [50,100]);
this.test.strokeColor = "black";
}
Game.prototype.tick = function()
{
this.test.position = this.test.position.add(5,5);
}
function Activity(game)
{
}
view.onFrame = function()
{
game.test.rotate(3);
}
var game = new Game(988,644);
__intervalId = window.setInterval(game.tick,1000/game.tps);
view.draw();
}
Solution 2
In your version game.tick invoked on window, use this
__intervalId = window.setInterval(function() { game.tick() } ,1000/game.tps);
OTHER TIPS
Try game.tick()
instead of game.tick