Currently the problem I'm running into is, when I'm running locally (in a ubuntuVM), using WebStorm as a webserver, I run my game and it plays fine and its responsive, but when I uploaded it to my webhosting and play it from there it is laggy and the click events aren't responsive.
I think it is because I'm using Ticker incorrectly (How do you call update for stages?):
canvas = document.getElementById('myCanvas');
canvas = new createjs.Stage(canvas);
createjs.Ticker.addEventListener("tick", canvas);
and all containers, sprites, etc are children of this stage
http://thegamingproject.org/webgames/ludumdare28/ <- lagginess
To address the lag, I would suggest you first look into adjusting your FPS on the Ticker
. Check out the documentation here. You may also want to experiment with the enableMouseOver frequency. Be careful with animations, and take advantage of caching before doing alpha fades etc. I have found the easeljs library will lag a bit with a lot of detailed vector content (such as when exported from the Flash IDE). Use Bitmaps
when you can to limit the drawing instructions.
As for the Ticker listener, as I see it you have the following 2 options:
This is the easiest to manage, though it gives you the least amount of control over rendering. According to this createjs tutorial, this is only recommended for quick tests.
Example
createjs.Ticker.addEventListener("tick", stage);
Advantages
stage.update()
is called automatically for each tickDisadvantages
This solution allows manual control for updating the stage. This could be useful if you need to "pause" content from updating (like a game for instance).
Example
createjs.Ticker.addEventListener("tick", tick);
function tick(){
var isDirty = false;
//some custom logic
if(isDirty) {
stage.update();
}
}
Advantages
Disadvantages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With