Advertisement
alestane

Code reduction

Apr 28th, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. local alphaShift = 1/256
  2.  
  3. local function onEnterFrame(event)
  4.     local group = game.game.parent
  5.     local bat = group.bat
  6.     local foreground = group.foreground
  7.     local isTouching = group.controls[1].isTouching
  8.     local direction = isTouching and -1 or 1
  9.     local alpha = foreground.alpha + direction * alphaShift
  10.     foreground.alpha = math.min(math.max(0, alpha), 1)
  11.     bat.gravityScale = direction
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement