FlixelCommunity / Flixel-Power-Tools

The Flixel Power Tools are a package of classes designed to provide extra functionality to your Flixel games. Originally created by Richard Davey (Photon Storm), this is the Flixel Community fork of the library, striving to keep the library living and up to date with the latest version of Flixel.
http://www.photonstorm.com/flixel-power-tools
Other
8 stars 3 forks source link

FloodFillFX Crash #16

Open FlixelCommunityBot opened 10 years ago

FlixelCommunityBot commented 10 years ago

Issue by Nejuf from Friday Sep 07, 2012 at 03:27 GMT Originally opened as https://github.com/photonstorm/Flixel-Power-Tools/issues/16


If the image's height is not divisible by the offset, this results in a crash because a script timeout. The reason being that subtracting the offset from a uint(dropY), can cause it to be negative, but since uint's can't be negative, the result is a very large number.

A simple restructuring in the draw() method fixes the problem.

Changing:


dropY -= offset;

dropRect.y -= offset;

if (dropY <= 0)
{
complete = true;
}

Into:


if (dropY <= offset)
{
    dropY = 0;
    complete = true;
}
else
{
    dropY -= offset;
    dropRect.y -= offset;
}