code-dot-org/blockly — pull request #649 by cpirich (2014-06-06 23:15:29+00:00)
Title: [finishes #70373766]: support sprites of arbitrary height and width

Each sprite can now have a different height or width. At this point, there is no setSpriteSize block (although that could be useful). Instead, there is now support for spriteWidth and spriteHeight to be set to something other than 100x100 in the skins file (alongside the image name).

This will be useful if we want to enable more variety in our actor image library or if we enable the student to choose from a larger (external) image gallery (such as getty images).

In addition to storing the height and width on the sprite array with each call to setSprite() and adjusting the SVG image / clipRect elements, I also needed to update the following:

(1) clipping the max x and y position differently based on the sprite size (so small sprites can move close to the bottom or right edge of the playspace)
(2) changing all collision detection (sprites, projectiles, finish targets) to take into account the height/width of the sprite and using the center point (since we now have different size sprites)