示例#1
0
from item import Item, HealingItem, DirtPlotEffector
from monster import Monster

from plant import Plant, Seed, CompletedPlant, plantGrades
from garden import Garden
from gametime import GameTime
import events
from fieldOffice import FieldOffice
from pets import PetEgg, Pet

import os
import updater
import json

player = Player()
gT = GameTime()
#seeds = {}

#    TODO: make more seeds/plants in seeds.json;
# TODO: go through JSON -> seed -> plant -> CompletePlant process and check for bugs;
#TODO: Add pet functionality; supplement gardening gameplay
#TODO: Make bounty hunting more viable
#TODO: add some sort of reward for rare plants (rudimentary exhibitions? maybe an internet forum :D!!);
#TODO: debug all inputs;
#TODO: make EVERYTHING more intuitive (write guide? maybe just for this beta)
#TODO: make universal, contextual tutorial() function to explain the particular context's actions


def createWorld():

    bedtime = events.SleepEvent(
示例#2
0
    def __init__(self, parent):
        self.parent = parent
        self.entities = {}
        self.colonists = []
        self.animals = []
        self.items = []
        self.families = []
        self.event_hours = [8, 20]

        self.time_frame = TimeFrame(self)
        self.time = GameTime(self)

        self.register_items = {
            "wood":
            colony.Item(self, name="Wood", stack_size=100),
            "stone":
            colony.Item(self, name="Stone", stack_size=100),
            # Iron
            "ore_iron":
            colony.Item(self, name="Iron Ore", stack_size=100),
            "ingot_iron":
            colony.Item(self, name="Iron Ingot", stack_size=100),
            # Marble
            "crushed_marble":
            colony.Item(self, name="Crushed Marble", stack_size=100),
            "brick_marble":
            colony.Item(self, name="Marble Bricks", stack_size=100),
            # Limestone
            "crushed_limestone":
            colony.Item(self, name="Crushed Limestone", stack_size=100),
            "brick_limestone":
            colony.Item(self, name="Limestone Bricks", stack_size=100)
        }

        self.register_animals = {
            "cat":
            colony.Animal(self, species="Cat", tame_chance=80, highest_age=10),
            "babirusa":
            colony.Animal(self,
                          species="Babirusa",
                          tame_chance=30,
                          highest_age=10),

            # Extinct
            "castoroides":
            colony.Animal(self,
                          species="Castoroides",
                          tame_chance=20,
                          highest_age=23),
            "dodo":
            colony.Animal(self, species="Dodo", tame_chance=20, highest_age=7)
        }

        self.register_resources = {
            "tree":
            colony.Resource(self,
                            name="Tree",
                            health=50,
                            resource=self.register_items["wood"],
                            resource_amount=50),
            "marble":
            colony.Resource(self,
                            name="Marble",
                            health=80,
                            resource=self.register_items["crushed_marble"],
                            resource_amount=1,
                            type_="Rock"),
            "limestone":
            colony.Resource(self,
                            name="Limestone",
                            health=80,
                            resource=self.register_items["crushed_limestone"],
                            resource_amount=1,
                            type_="Rock")
        }

        self.canvas = self.parent.canvas
        self.canvas.configure(background="light gray")
        self.canvas.bind("<Configure>", self.draw_widgets, "+")
        self.game_area = tk.Canvas(self.canvas,
                                   width=self.parent.game_width + 1,
                                   height=self.parent.game_height + 1,
                                   scrollregion=(0, 0, self.parent.game_width,
                                                 self.parent.game_height))

        self.grid_dictionary = {}

        # self.selected_entity = None
        self.selected_entity = []

        self.selected_tool = None
        self.select_area = None
        self.game_area.bind("<Button-1>", self.check_tool, "+")
        self.game_area.bind("<ButtonRelease-3>", self.reset_tool, "+")
        self.game_area.bind("<Motion>", self.select_grid_cell, "+")

        self.game_scrollbar_x = ttk.Scrollbar(self.parent,
                                              orient="horizontal",
                                              command=self.game_area.xview)
        self.game_scrollbar_y = ttk.Scrollbar(self.parent,
                                              command=self.game_area.yview)
        self.game_area.configure(xscrollcommand=self.game_scrollbar_x.set,
                                 yscrollcommand=self.game_scrollbar_y.set)

        self.colonist_bar = ColonistBar(self)
        self.taskbar = TaskBar(self.parent, self)
        self.debug = DeBug(self)

        self.draw_widgets()
        self.draw_grid()