Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local file = ... or "Square.png"
- return LoadActor( file )..{
- OnCommand=function(self)
- self:playcommand("ResetPosition")
- end,
- ResetPositionCommand=function(self)
- -- reset the rotation ammount to 0
- -- reset x to be newly randomized
- -- and reset y to be offscreen below _screen.h
- self:rotationz(0)
- :x( _screen.w - math.random(0, _screen.w) )
- :y( _screen.h + self:GetHeight() )
- :diffuse(color("#5a5a5a"))
- :zoom(0.8)
- :queuecommand("Animate")
- end,
- AnimateCommand=function(self)
- -- tween duraiton of 2 seconds
- self:linear(2)
- -- tween the y position upwards until offscreen
- :y( -self:GetHeight() )
- -- rotate one full revolution on the z-axis
- :rotationz(360)
- -- and, finally, reset the position so we can do this again
- :queuecommand("ResetPosition")
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement