Пример #1
0
        self.remainstring = "%sh %sm %ss" % (remH, remM, remS)

        if self.growing:

            # check for grow complete
            if self.growtimeremaining == 0:
                self.growing = False
                self.to_harvest = True
                chance = random.randint(0, 100)
                if chance <= farmlib.rules["DESTROY_CHANCE"]:
                    farmtile["object"] = None
                    farmtile["water"] = 0
                return True

        return False  #  not updated

    def onplant(self):
        self.start_grow()

    def start_grow(self):
        """Start seed growing"""

        self.growing = True
        self.growstarttime = int(time.time())
        self.growendtime = self.growstarttime + self.growtime


# load objects from json file
objects = DictMapper()
objects.load(os.path.join("data", "objects.json"))
import os
import pygame

import imageloader
import player

from dictmapper import DictMapper


#SETTINGS

rules = DictMapper()
rules.load(os.path.join("data", "rules.json"))

images = DictMapper()
images.load(os.path.join("data", "images.json"))

__VERSION__ = rules["VERSION"]

#init plugin system
from pluginsystem import basePluginSystem as PluginSystem

pygame.font.init()
pygame.mixer.init()

clickfilename = os.path.join(os.path.join("data", "sounds"), "click.wav")
clicksound = pygame.mixer.Sound(clickfilename)
Пример #3
0
import os
import pygame

import imageloader
import player

from dictmapper import DictMapper

#SETTINGS

rules = DictMapper()
rules.load(os.path.join("data", "rules.json"))

images = DictMapper()
images.load(os.path.join("data", "images.json"))

__VERSION__ = rules["VERSION"]

#init plugin system
from pluginsystem import basePluginSystem as PluginSystem

pygame.font.init()
pygame.mixer.init()

clickfilename = os.path.join(os.path.join("data", "sounds"), "click.wav")
clicksound = pygame.mixer.Sound(clickfilename)
Пример #4
0
        self.remainstring = "%sh %sm %ss" % (remH, remM, remS)

        if self.growing:

            # check for grow complete
            if self.growtimeremaining == 0:
                self.growing = False
                self.to_harvest = True
                chance = random.randint(0, 100)
                if chance <= farmlib.rules["DESTROY_CHANCE"]:
                    farmtile["object"] = None
                    farmtile["water"] = 0
                return True

        return False  # not updated

    def onplant(self):
        self.start_grow()

    def start_grow(self):
        """Start seed growing"""

        self.growing = True
        self.growstarttime = int(time.time())
        self.growendtime = self.growstarttime + self.growtime


# load objects from json file
objects = DictMapper()
objects.load(os.path.join("data", "objects.json"))