Guest User

Untitled

a guest
Apr 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1.  
  2. module AnimatedObject
  3. def frame_num()
  4. return @frame_num
  5. end
  6. def frame_num=(frame_num)
  7. @frame_num = frame_num
  8. end
  9.  
  10. def next_frame_num()
  11. (@frame_num + 1) % @frame_count
  12. end
  13.  
  14. def next_frame(img)
  15. @frame_num = next_frame_num
  16. @image = img
  17. # TODO, img size always has to be the same for collision detection
  18. # for now
  19. # @rect = Rect.new(x,y,*@image.size)
  20. end
  21.  
  22. def frame_count=(count)
  23. @frame_count = count
  24. end
  25.  
  26. def last_animated_time()
  27. @animated_time
  28. end
  29.  
  30. def last_animated_time=(time)
  31. @animated_time = time
  32. end
  33.  
  34. def animating?()
  35. @animating
  36. end
  37.  
  38. def stop_animating()
  39. @animating = false
  40. end
  41.  
  42. def animate()
  43. @animating = true
  44. end
  45.  
  46. def animating?()
  47. @animating
  48. end
  49.  
  50. def animation_length()
  51. @animation_length.nil? ? 1 : @animation_length
  52. end
  53.  
  54. def animation_image_set()
  55. @animation_image_set ||= :default
  56. end
  57.  
  58. end
Add Comment
Please, Sign In to add comment