IceDragon200

Achieve

Aug 17th, 2011
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.41 KB | None | 0 0
  1. class Game_System
  2.  
  3.   attr_accessor :achievements
  4.  
  5.   alias :um_initialize :initialize unless $@
  6.   def initialize()
  7.     um_initialize()
  8.     @achievements = []
  9.   end
  10.  
  11.   def achieved?( id )
  12.     return @achievements.include?( id )
  13.   end
  14.  
  15.   def add_achievement( id )
  16.     @achievements << id
  17.     @achievements.uniq!()
  18.   end
  19.  
  20. end
  21.  
  22. $game_system.add_achievement( 1 )
  23. $game_system.achieved?( 1 ) # => true
Advertisement
Add Comment
Please, Sign In to add comment