Mercurial > rinkhals
comparison gamelib/gameboard.py @ 496:bf90a2948e34
Basic snapshot support in save games added.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Wed, 25 Nov 2009 23:15:56 +0000 |
parents | d2ca4af92c79 |
children | a2824eb2474e |
comparison
equal
deleted
inserted
replaced
495:d2ca4af92c79 | 496:bf90a2948e34 |
---|---|
968 treesleft = max(1, self.trees_left()) | 968 treesleft = max(1, self.trees_left()) |
969 sell_price = float(10*width*height)/treesleft | 969 sell_price = float(10*width*height)/treesleft |
970 buy_price = sell_price*(1.1) | 970 buy_price = sell_price*(1.1) |
971 self.wood_sell_price, self.wood_buy_price = int(sell_price), int(buy_price) | 971 self.wood_sell_price, self.wood_buy_price = int(sell_price), int(buy_price) |
972 | 972 |
973 def snapshot(self, scale=0.25): | |
974 """Return a snapshot of the gameboard.""" | |
975 w, h = self.disp.screen.get_size() | |
976 w, h = int(w * scale), int(h * scale) | |
977 snapshot = pygame.transform.smoothscale(self.disp.screen, (w, h)) | |
978 return snapshot | |
979 | |
973 def save_game(self): | 980 def save_game(self): |
974 # clear selected animals and tool states before saving | 981 # clear selected animals and tool states before saving |
975 self.reset_states() | 982 self.reset_states() |
976 return serializer.simplify(self) | 983 return serializer.simplify(self) |
977 | 984 |