Advertisement
Guest User

StepMania 5 - BGAnimation Help

a guest
Sep 14th, 2015
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.             -- tween the y position upwards until offscreen
  24.             :y( -self:GetHeight() )
  25.             -- rotate one full revolution on the z-axis
  26.             :rotationz(360)
  27.             -- and, finally, reset the position so we can do this again
  28.             :queuecommand("ResetPosition")
  29.     end
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement