corona simulator freezes?! help!

this is the code I am trying to use in the simulator i’m kind of new to this whole coding thing  but all my other projects launch but this one freezes the simulator for some reason. I attached the zipped file of the project any help would be appreciated! and btw I have 4 gigs of ram clocked at 2.66 GHz so computer specs are not the problem

local w = display.contentWidth

local h = display.contentHeight

local center = display.newImage(“Ch3Center.png”)

center.x = w/2

center.y = h/2

local square = display.newImage(“Ch3Square.png”)

square.x = math.random(square.width/2, display.contentWidth - square.width/2)

square.y = math.random(square.height/2, display.contentHeight - square.height/2)

while (square.x ~= center.x or square.y ~= center.y) do

    if (square.x > center.x) then

        square.x = square.x -1

    elseif (square.x < center.x) then

        square.x = square.x -1

    end

    

    if (square.y > center.y) then

        square.y = square.y -1

    elseif (square.y < square.y -1) then

        square.y = square.y -1

    end

end

Well I’m guessing that your while loop is not terminating.  I’d drop some prints in there printing out the values you are testing in the while loop and see what’s not working right.

Well I’m guessing that your while loop is not terminating.  I’d drop some prints in there printing out the values you are testing in the while loop and see what’s not working right.

Thanks, you saved…me…5 months later :slight_smile:

Thanks, you saved…me…5 months later :slight_smile: