alestane icon

Code reduction

alestane | PRO | 04/29/13 01:56:29 AM UTC | 0 ⭐ | 336 👁️ | Never ⏰ | []
Lua |

410 B

|

None

|

0 👍

/

0 👎

local alphaShift = 1/256
 
local function onEnterFrame(event)
    local group = game.game.parent
    local bat = group.bat
    local foreground = group.foreground
    local isTouching = group.controls[1].isTouching
    local direction = isTouching and -1 or 1
    local alpha = foreground.alpha + direction * alphaShift
    foreground.alpha = math.min(math.max(0, alpha), 1)
    bat.gravityScale = direction
end

Comments