share/hedgewars/Data/Scripts/Utils.lua
author belphegorr <szabibibi@gmail.com>
Sun, 08 Jul 2012 19:15:38 +0300
changeset 7245 53f73f4ae203
parent 4873 98dbb9b985e5
child 13215 bc95df84395f
permissions -rw-r--r--
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box Updated Animate.lua (forgot to copy it last time) Mission 1: Fixed a bug where events would cause animations to stutter Moved a crate Made the princess and the elder pay attention to Leaks A Lot Changed the name of the chief to Righteous Beard Mission 2: - Mission 3: Removed leftover debug lines Solved a bug where Dense Cloud could not select weapons during final scene Made the hogs fave each other during the final animation Mission 4: Solved a bug where Dense Cloud would appear even if he's dead

-- Library for miscellaneous utilitiy functions

-- Check if a gear is inside a box
function gearIsInBox(gear, x, y, w, h)
    gx, gy = GetGearPosition(gear)
    if gx >= x and gy >= y and gx <= x + w and gy <= y + h then
        return true
    end
    return false
end

-- Check if a gear is inside a circle
function gearIsInCircle(gear, x, y, r, useRadius)
    gx, gy = GetGearPosition(gear)
    if useRadius then
        r = r + GetGearRadius(gear)
    end
    if r ^ 2 >= (x - gx) ^ 2 + (y - gy) ^ 2 then
        return true
    end
    return false
end