Since our last update, we’ve been doing more then just playing around with raycasting engines…. This latest release is primarily about bug-fixes, which easily made up more then half of the changes. We also put a lot of effort into optimizing both Play My Code and our Quby language.
We’ve also found time to add a few new features along the way, and here are some of the highlights:
Per-Pixel Image Collision
Sometimes bounding boxes and other shapes aren’t enough, what you really want is pixel-perfect accuracy on a collision check. So, we’ve added the isPixelOverlap method to the Image class, allowing you to check if one image collides with another (on a pixel-by-pixel basis).
a = new Image( 'a.png' ) b = new Image( 'b.png' ) if a.isPixelOverlap( aX, aY, b, bX, bY ) // there is a collision! end
A collision is detected if two non-transparent pixels, from each of the two images, overlap each other.
We also implemented a pure bounds version, isOverlap, as an Image friendly version of the ‘isRectOverlap’ function.
a = new Image( 'a.png' ) b = new Image( 'b.png' ) if a.isOverlap( aX, aY, b, bX, bY ) // the images overlap, but it's not pixel perfect end
It should be noted that per-pixel collision detection has a much greater overhead than bounding box collision, and should only be used when such accuracy is required. For the majority of cases, bounding box collision will be accurate enough.
We also added two new sets of drawing calls: fillRoundedRect and drawRoundedRect.
They fill, or draw the outline, of rectangles with rounded corners. A nice extra tool for making game building a little bit easier.
Both of these excellent suggestions came from Giorgio in our forum just a few days ago, so if there is something new that you’d like to see added then feel free to post it. We’ve also implemented a few suggestions that have come in via Twitter, and of course you can also use the Feedback form on the top-left of this page if you wish to send feedback anonymously.
The syntax is very similar to defining a function or method, only without the name:
myFun = def( a, b ) return a + b*2 end
The objects are of type Function and you can then call it later using the ‘call’ method, passing in any arguments.
result = myFun.call([ 1, 4 ])
This is especially useful for building event based systems where you want to be able to hold the actions within an object.
Using Google Page Speed’s benchmarks, some pages now have a score as high as 95 out of 100; up to 20 points higher then they used to receive. However, we will continue optimising to ensure the site, and more importantly your games, run even faster.