EaselJS Pixel Perfect Collision Detection for Bitmaps with Alpha Threshold

I just finished the first version of a pixel perfect collision detection for EaselJS Bitmaps and BitmapAnimations.
Get it from Github: https://github.com/olsn/Collision-Detection-for-EaselJS

Here is an example (play around with the alpha threshold and toggle the detection mode):

iOS6 html hardware acceleration changes and how to fix them

As probably many developers have already experience this over the past weeks:
I had a phonegap application for iOS that contained some visually animated components  (a coverflow or a carousel for example). But after updating to iOS6 this is all flickring now and it feels horrible because it’s just stumbling and faltering on the new version of the OS.
There are several reasons for this and I cannot say which were already there in iOS5, however here are the two main reasons and instructions on how to fix that: Continue reading

Generate Repeatable Random Numbers (in JS)

Quite often when developing a game I need “random” numbers, that I can reproduce or that I can steer. Why? – For example when setting up a level or when resetting a level you might want to have it look random, but still the same every time you load it. – So how do we do that? There are tons of ways of achieving a so called “seeded random generated number” – if you want any details on the algorithms you can for example check out this link. But basically they all work the same: You initialize the algorithm with a “seed” (a number, that you choose to steer the algorithm). And every seed will return its own unique set of “random” numbers, so e.g.: Every time I seed the Number 6, I get the same set of generated “random” numbers. Every time I seed the Number 10, I get the same set of “random” number, that is different from the set ‘6’ and so on…
Because of this fact: seeded random numbers are predictable, which is not bad, but just don’t use it for encryption purposes ect… ;-)

The algorithm

So the algorithm I’m using is the following, it’s really very simple:
(this is nothing new and also nothing I invented, but I think this might help quite a few people)

Continue reading