1. Sami Loone
  2. Fat x Fast

Source

Fat x Fast / FatxFast / pointsystem.py

# This file is part of FatxFast.
#
#    FatxFast is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    FatxFast is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with FatxFast.  If not, see <http://www.gnu.org/licenses/>.

# Versioning based on: 
# http://en.wikipedia.org/wiki/Versioning#Designating_development_stage
__author__ = "dryatu (c) 2013"
__version__ = "1.2.4"

from FatxFast.fileio import LOGGER

class PointSystem(object):
    def __init__(self, scene):
        super(PointSystem, self).__init__()
        self.scene = scene
        self.error_points = 1337
        self.max_points = 50000

    def get_columns_and_rows(self):
        return self.scene.tilemap.width, self.scene.tilemap.height
    
    def increase_points(self, character):
        # Maze guy meets math
        columns, rows = self.get_columns_and_rows()
        try: 
            points = int(round(columns*rows*
                (1+(rows/(self.scene.levelsystem.leveltime/1000.0)))))
        except ZeroDivisionError:
            points = self.error_points
            LOGGER.log_message(""""ZeroDivision: 
                Points increased with == 0 level time""")
        if points > self.max_points:
            points = self.max_points
        character.points += points