Skip to content
Browse files

Merge pull request #55 from BlckKnght/spritemap-dimensions

Fix for Spritemaps with source image width that is not an exact multiple of its frame width
  • Loading branch information...
2 parents 2759b2f + 75f7653 commit 94a60deee5c67acd609bb83b5bb13c14f465cf5b @Draknek Draknek committed Dec 16, 2011
Showing with 2 additions and 3 deletions.
  1. +2 −3 net/flashpunk/graphics/Spritemap.as
View
5 net/flashpunk/graphics/Spritemap.as
@@ -54,9 +54,8 @@
override public function updateBuffer(clearBefore:Boolean = false):void
{
// get position of the current frame
- _rect.x = _rect.width * _frame;
- _rect.y = uint(_rect.x / _width) * _rect.height;
- _rect.x %= _width;
+ _rect.x = _rect.width * (_frame % _columns);
+ _rect.y = _rect.height * uint(_frame / _columns);
if (_flipped) _rect.x = (_width - _rect.width) - _rect.x;
// update the buffer

0 comments on commit 94a60de

Please sign in to comment.
Something went wrong with that request. Please try again.