eliasdaler

DelayAction

Jun 28th, 2016
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. -- Example of usage:
  2. -- DelayAction { time = 500 } -- time is in ms
  3.  
  4. local Action = require("action")
  5.  
  6. local DelayAction = class("DelayAction", Action)
  7.  
  8. function DelayAction:initialize(params)
  9.     Action.initialize(self, params)
  10.     self.currentTime = 0
  11. end
  12.  
  13. function DelayAction:update(dt)
  14.     self.currentTime = self.currentTime + dt
  15.     if self.currentTime >= self.time then
  16.         self.isFinished = true
  17.     end
  18. end
  19.  
  20. return DelayAction
Advertisement
Add Comment
Please, Sign In to add comment