Advertisement
Guest User

StepMania 5 - BGAnimation Help

a guest
Sep 14th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local file = ... or "Square.png"
  2.  
  3. return LoadActor( file )..{
  4.     OnCommand=function(self)
  5.         self:playcommand("ResetPosition")
  6.     end,
  7.     ResetPositionCommand=function(self)
  8.        
  9.         -- reset the rotation ammount to 0
  10.         -- reset x to be newly randomized
  11.         -- and reset y to be offscreen below _screen.h
  12.         self:rotationz(0)
  13.             :x( _screen.w - math.random(0, _screen.w) )
  14.             :y( _screen.h + self:GetHeight() )
  15.             :diffuse(color("#5a5a5a"))
  16.             :zoom(0.8)
  17.             :queuecommand("Animate")
  18.     end,
  19.     AnimateCommand=function(self)
  20.        
  21.         -- tween duraiton of 2 seconds
  22.         self:linear(2)
  23.        
  24.             -- tween the y position upwards until offscreen
  25.             :y( -self:GetHeight() )
  26.            
  27.             -- rotate one full revolution on the z-axis
  28.             :rotationz(360)
  29.            
  30.             -- and, finally, reset the position so we can do this again
  31.             :queuecommand("ResetPosition")
  32.     end
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement