Tag Info

New answers tagged

1

I would go for a draw function that is called in interval. And for the game objects you deal with them in an array and updates them in your loop. Then if you want to have good performance try to only redraw the part of the canvas that is needed to be updated. Here is a good tutorial http://jlongster.com/Making-Sprite-based-Games-with-Canvas


0

Ok, I found the solution for this. The actual phonegap implementation uses default webViewer, which is quite slow. Ludei (www.ludei.com) has a great solution for HTML5 canvas high performance games, CocoonJS. It works great on iOS and Android, there is not for WindowsPhone. However there is no need for it on Windows Phone 8. Windows Phone 8 has the highest ...


2

Here's what I found out by following this link. context.drawImage can take an img, canvas, or video element. So you can decide to use the contents of an off-screen canvas as a pattern. // First we create a canvas to draw our pattern on // Doesn't actually have to be in the DOM var offscreenCanvas = document.createElement('canvas'); offscreenCanvas.width = ...


0

Here's an implementation of a fairly simple rectangle hittest algorithm, which looks like what you were trying to achieve function Collision(r1, r2) { return ((r1.X + r1.Width >= r2.X) && (r1.X <= r2.X + r2.Width) && (r1.Y + r1.Height >= r2.Y) && (r1.Y <= r2.Y + r2.Height) ); ...


0

When your animation system reaches a certain complexity, it becomes useful to pair each spritesheet with a separate animation manifest which says which animations are on that spritesheet and where the frames for each animation can be found. The animation manifest could be a javascript object which says what animations the entity can perform, for how many ...



Top 50 recent answers are included