Ejemplo n.º 1
0
def Run():
    global DeltaTime

    DeltaTime += 1

    if DeltaTime > 2:
        DeltaTime = 0
        # -- ItemID is 0
        ItemLevel = items.GetItemLevel_ByID(0)
        ItemClickPerSecound = gameMain.DefaultCnt.Get_RegKey(
            "/ItemData/0/lv_{0}_click".format(ItemLevel), float)

        TotalValue = (
            ItemClickPerSecound *
            gameMain.save.Current_MoneyMultiplier) * items.GetItemCount_ByID(0)
        AdderText = "+{0}".format(utils.FormatNumber(TotalValue))

        try:  # -- Items exists -- #
            Index = gameMain.ScreenGame.IncomingLog.TextGrind_Text.index(
                AdderText)

            gameMain.save.Current_Money += TotalValue

        except ValueError:  # -- Item Does not Exist -- #
            gameMain.ScreenGame.IncomingLog.AddMessageText(
                AdderText, True, (150, 220, 150), TotalValue)
Ejemplo n.º 2
0
def BuyItem_ByID(ItemID):
    ItemID = int(ItemID)
    ItemPrice = gameItems.GetItemPrice_ByID(ItemID)
    ItemCount = gameItems.GetItemCount_ByID(ItemID)
    ItemIsUnlocker = gameItems.GetItemIsUnlocker_ByID(ItemID)
    BuySucefully = False

    if ItemIsUnlocker:  # -- Buy Unlocker Items
        if not ItemCount >= 1:
            # -- Increase Item Count -- #
            gameItems.IncreaseItemCount_ByID(ItemID)

            # -- Create Item Object -- #
            gameItems.CreateItemObject(ItemID)

            BuySucefully = True

    else:  # -- Buy Common Items -- #
        gameItems.IncreaseItemCount_ByID(ItemID)

        # -- Create Item Object -- #
        gameItems.CreateItemObject(ItemID)

        BuySucefully = True

    if BuySucefully:
        # -- Subtract the Money -- #
        IncomingLog.AddMessageText(utils.FormatNumber(-ItemPrice, 2), True, (250, 150, 150), -ItemPrice)

        # -- Add Item to the Item View on Game Screen -- #
        GameScreen.ItemsView.AddItem(str(ItemID))
    else:
        # -- Subtract the Money -- #
        IncomingLog.AddMessageText(gameMain.DefaultCnt.Get_RegKey("/strings/window/store/cant_buy_item"), False, (250, 150, 150))
        sound.PlaySound("/hit_2.wav", 0.5)
Ejemplo n.º 3
0
def Update():
    global ItemsMaintenance
    global BaseMaintenance
    global LastMaintenancePrice
    global DayTrigger
    global NextMaintenanceDay

    if save.CurrentDate_Day == DayTrigger:
        # -- Dont let the Maintenance Day to the Day Limit -- #
        if save.CurrentDate_Day + 1 >= save.CurrentDate_MonthLimiter:
            DayTrigger = 0

        else:
            DayTrigger = save.CurrentDate_Day + PerDayValue

        # -- Calculate Maintenance of All Items -- #
        TotalItems = 0

        for item in gameItems.ItemsList:
            TotalItems += 1
            ItemsMaintenance = ItemsMaintenance + item.maintenance_cost + randint(
                1, TotalItems)

        # -- Add Maintenance of Auto Clicker -- #
        if gameItems.GetItemCount_ByID(0) > 1:
            ItemsMaintenance += (gameItems.GetItem_MaintenancePrice(0) *
                                 gameItems.GetItemCount_ByID(0))

        # -- Calculate the Maintenance -- #
        MaintenancePrice = BaseMaintenance + ItemsMaintenance

        # -- Decrease Money -- #
        IncomingLog.AddMessageText(utils.FormatNumber(-MaintenancePrice, 2),
                                   True, (
                                       250,
                                       150,
                                       150,
                                   ), -MaintenancePrice)

        # -- Set Variables -- #
        LastMaintenancePrice = MaintenancePrice
Ejemplo n.º 4
0
def EventUpdate(event):
    # -- Update all buttons -- #
    global GrindButton
    global GameOptionsButton
    global SaveButton
    global BackToMainMenuButton
    global OpenStoreButton
    global StoreWindow_Enabled
    global ItemsView
    global IsControlsEnabled
    global OpenExperienceWindowButton
    global OpenInfosWindowButton
    global BlinkExperienceEnabled
    global HUD_Surface

    if IsControlsEnabled:
        GrindButton.Update(event)
        GameOptionsButton.Update(event)
        SaveButton.Update(event)
        BackToMainMenuButton.Update(event)
        OpenStoreButton.Update(event)
        ItemsView.Update(event)
        IncomingLog.EventUpdate(event)
        OpenInfosWindowButton.Update(event)

        if gameItems.GetItemCount_ByID(-1) == 1:
            OpenExperienceWindowButton.Update(event)

        # -- Update store Window -- #
        if StoreWindow_Enabled:
            storeWindow.EventUpdate(event)

        # -- Update Infos Window -- #
        if InfosWindow_Enabled:
            infosWindow.EventUpdate(event)

        if ExperienceStore_Enabled:
            expStoreWindow.EventUpdate(event)

    if event.type == pygame.KEYUP and event.key == pygame.K_z:
        save.GrindClick()

    if event.type == pygame.KEYUP and event.key == pygame.K_m:
        save.GrindClick()
Ejemplo n.º 5
0
    def Render(self, DISPLAY):
        # -- Recreate Surface -- #
        self.ListSurface = pygame.Surface((self.Rectangle[2], self.Rectangle[3]), pygame.SRCALPHA)

        mainScript.shape.Shape_Rectangle(DISPLAY, (0, 12, 30), (self.Rectangle[0], self.Rectangle[1] - 16, self.Rectangle[2], 16), 0, 0, 2, 2)
        mainScript.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 10, mainScript.DefaultCnt.Get_RegKey("/strings/game/game_items_view"), (255, 255, 255), self.Rectangle[0] + self.Rectangle[2] / 2 - mainScript.DefaultCnt.GetFont_width("/PressStart2P.ttf", 10, mainScript.DefaultCnt.Get_RegKey("/strings/game/game_items_view")) / 2, self.Rectangle[1] - 13)

        Draw_Panel(DISPLAY, self.Rectangle)

        for i, itemID in enumerate(self.ItemsID):
            ItemName = mainScript.DefaultCnt.Get_RegKey("/ItemData/name/" + str(itemID))
            ItemWidth = 156

            ItemX = self.ScrollX + ItemWidth * i
            ItemRect = (ItemX, self.Rectangle[3] / 2 - 90 / 2, ItemWidth - 5, 90)

            # -- Draw the Background -- #
            Draw_Panel(self.ListSurface, ItemRect, True)

            # -- Render the Item Title -- #
            mainScript.DefaultCnt.FontRender(self.ListSurface, "/PressStart2P.ttf", 9, ItemName, (250, 250, 250), ItemRect[0] + ItemRect[2] / 2 - mainScript.DefaultCnt.GetFont_width("/PressStart2P.ttf", 9, ItemName) / 2, ItemRect[1] + 2, mainScript.DefaultCnt.Get_RegKey("/OPTIONS/font_aa"))

            # -- Render the Item Sprite -- #
            mainScript.DefaultCnt.ImageRender(self.ListSurface, mainScript.DefaultCnt.Get_RegKey(gameItems.GetItemSprite_ByID(int(itemID))), ItemRect[0] + 3, ItemRect[1] + 15, 64, 64, mainScript.DefaultCnt.Get_RegKey("/OPTIONS/sprite_aa"))

            # -- Render the Item Info -- #
            LittleInfoText = mainScript.DefaultCnt.Get_RegKey("/strings/game/items_info").format(utils.FormatNumber(gameItems.GetItemCount_ByID(self.ItemsID[i])).replace(".00", ""), str(gameItems.GetItemLevel_ByID(self.ItemsID[i])))

            # -- Render Item Info -- #
            mainScript.DefaultCnt.FontRender(self.ListSurface, "/PressStart2P.ttf", 10, LittleInfoText, (250, 250, 250), ItemRect[0] + 70, ItemRect[1] + 12, mainScript.DefaultCnt.Get_RegKey("/OPTIONS/font_aa"))

        DISPLAY.blit(self.ListSurface, (self.Rectangle[0], self.Rectangle[1]))
Ejemplo n.º 6
0
def GameDraw(DISPLAY):
    global BackToMainMenuButton
    global OpenStoreButton
    global OpenInfosWindowButton
    global OpenExperienceWindowButton
    global StoreWindow_Enabled
    global ItemsView
    global SavingScreenEnabled
    global BlinkExperienceValue
    global HUD_Surface

    if SavingScreenEnabled:
        UpdateSavingScreen(DISPLAY)

    if not SavingScreenEnabled:
        # -- Draw the Grind Text -- #
        IncomingLog.Draw(DISPLAY)
        # -- Draw the Grind Button -- #
        GrindButton.Render(DISPLAY)
        # -- Draw the Options Button -- #
        GameOptionsButton.Render(DISPLAY)
        # -- Draw the Save Button -- #
        SaveButton.Render(DISPLAY)
        # -- Draw the BackToMenu button -- #
        BackToMainMenuButton.Render(DISPLAY)
        # -- Draw the Store Button -- #
        OpenStoreButton.Render(DISPLAY)
        # -- Draw the Items View -- #
        ItemsView.Render(DISPLAY)
        # -- Draw the OpenInfosWindow -- #
        OpenInfosWindowButton.Render(DISPLAY)
        # -- Draw the OpenExperience -- #
        if gameItems.GetItemCount_ByID(-1) == 1:
            OpenExperienceWindowButton.Render(DISPLAY)

        # -- Render Money Text -- #
        MoneyColor = (250, 250, 255)
        PerSecoundColor = (220, 220, 220)
        if save.Current_Money > 0.1:
            MoneyColor = (120, 220, 120)
        elif save.Current_Money <= 0:
            MoneyColor = (220, 10, 10)
        if save.Current_MoneyPerSecond > 0.1:
            PerSecoundColor = (50, 200, 50)
        elif save.Current_MoneyPerSecond <= 0:
            PerSecoundColor = (120, 10, 10)

        # -- Render Current Money, at Top -- #
        MoneyText = gameMain.DefaultCnt.Get_RegKey(
            "/strings/game/money") + save.Current_MoneyFormated
        gameMain.DefaultCnt.FontRender(
            DISPLAY, "/PressStart2P.ttf", 18,
            gameMain.DefaultCnt.Get_RegKey("/strings/game/money") +
            save.Current_MoneyFormated, (0, 0, 0), 12, 22)
        gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 18,
                                       MoneyText, MoneyColor, 10, 20)

        # -- Render Money per Second -- #
        MoneyPerSecoundText = gameMain.DefaultCnt.Get_RegKey(
            "/strings/game/money_per_secound"
        ) + save.Current_MoneyPerSecondFormatted
        gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 18,
                                       MoneyPerSecoundText, (0, 0, 0), 12, 52)
        gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 18,
                                       MoneyPerSecoundText, PerSecoundColor,
                                       10, 50)

        # -- Render Experience -- #
        ExperienceText = gameMain.DefaultCnt.Get_RegKey(
            "/strings/game/experience") + str(
                save.Current_ExperienceFormated) + "/" + str(
                    save.Current_TotalClicks -
                    save.Current_TotalClicksNext) + "=" + str(
                        save.Current_ExperiencePerEach)
        gameMain.DefaultCnt.FontRender(
            DISPLAY, "/PressStart2P.ttf", 18, ExperienceText,
            (BlinkExperienceValue, BlinkExperienceValue, BlinkExperienceValue),
            12, 82)
        gameMain.DefaultCnt.FontRender(
            DISPLAY, "/PressStart2P.ttf", 18, ExperienceText,
            (140 + BlinkExperienceValue, 130 + BlinkExperienceValue,
             120 + BlinkExperienceValue), 10, 80)

        # -- Render the Clock -- #
        gameClock.Draw(DISPLAY)

        # -- Draw the Store Window -- #
        if StoreWindow_Enabled:
            storeWindow.Render(DISPLAY)

        # -- Draw the Infos Window -- #
        if InfosWindow_Enabled:
            infosWindow.Render(DISPLAY)

        # -- Draw the Exp Store Window -- #
        if ExperienceStore_Enabled and gameItems.GetItemCount_ByID(-1) >= 1:
            expStoreWindow.Render(DISPLAY)

        HUD_Surface = DISPLAY.copy()
Ejemplo n.º 7
0
def Update():
    global GameOptionsButton
    global BackToMainMenuButton
    global OpenStoreButton
    global StoreWindow_Enabled
    global ItemsView
    global BackToMainMenu_Delay
    global BackToMainMenu
    global IsControlsEnabled
    global SavingScreenEnabled
    global ExperienceStore_Enabled
    global InfosWindow_Enabled

    if IsControlsEnabled:
        # -- Update Save -- #
        save.Update()

        # -- Update Experience Blink -- #
        UpdateExperienceBlink()

        ItemsView.Set_X(5)
        ItemsView.Set_Y(gameMain.DefaultDisplay.get_height() - 130)

        # -- Update General Maintenance -- #
        maintenance.Update()

        # -- Update Buttons Click -- #
        if GrindButton.ButtonState == 2:
            save.TutorialTrigger("clicking_button")
            save.GrindClick()

        # -- Game Options Button -- #
        if GameOptionsButton.ButtonState == 2:
            transition.Run()
            ScreenSettings.ScreenToReturn = 1
            ScreenSettings.Initialize()
            storeWindow.RestartAnimation()
            gameMain.SetScreen_ByID(2)

        # -- Save Buttons -- #
        if SaveButton.ButtonState == 2:
            SavingScreenEnabled = True
            IsControlsEnabled = False

        # -- Back to Main Menu Button -- #
        if BackToMainMenuButton.ButtonState == 2:
            transition.Run()
            BackToMainMenu = True

        if BackToMainMenu:
            BackToMainMenu_Delay += 1

            if BackToMainMenu_Delay >= 5:
                gameMain.SetScreen_ByID(0)
                # -- Reset Variables -- #
                BackToMainMenu_Delay = 0
                BackToMainMenu = False

                SaveGame()

        # -- Store Button -- #
        if OpenStoreButton.ButtonState == 2:
            save.TutorialTrigger("store_window_button")

            if StoreWindow_Enabled:
                StoreWindow_Enabled = False
                storeWindow.RestartAnimation()
            else:
                StoreWindow_Enabled = True
                InfosWindow_Enabled = False
                ExperienceStore_Enabled = False

        # -- Infos Button -- #
        elif OpenInfosWindowButton.ButtonState == 2:
            save.TutorialTrigger("infos_window_button")

            if InfosWindow_Enabled:
                InfosWindow_Enabled = False
            else:
                InfosWindow_Enabled = True
                StoreWindow_Enabled = False
                ExperienceStore_Enabled = False

        # -- Experience Store Button -- #
        elif OpenExperienceWindowButton.ButtonState == 2 and gameItems.GetItemCount_ByID(
                -1) >= 1:
            save.TutorialTrigger("expstore_window_button")

            if ExperienceStore_Enabled:
                ExperienceStore_Enabled = False
                expStoreWindow.RestartAnimation()

            else:
                ExperienceStore_Enabled = True
                StoreWindow_Enabled = False
                InfosWindow_Enabled = False

        # -- Update Buttons Location -- #
        GameOptionsButton.Set_X(gameMain.DefaultDisplay.get_width() - 120)
        SaveButton.Set_X(gameMain.DefaultDisplay.get_width() - 120)
        BackToMainMenuButton.Set_X(gameMain.DefaultDisplay.get_width() - 120)
        GrindButton.Rectangle[2] = 130
        GrindButton.Rectangle[3] = 150
        OpenStoreButton.Set_X(5)
        OpenStoreButton.Set_Y(gameMain.DefaultDisplay.get_height() -
                              OpenStoreButton.Rectangle[3] - 5)
        OpenInfosWindowButton.Set_X(OpenStoreButton.Rectangle[0] +
                                    OpenStoreButton.Rectangle[2] + 5)
        OpenInfosWindowButton.Set_Y(OpenStoreButton.Rectangle[1])
        OpenExperienceWindowButton.Set_X(OpenInfosWindowButton.Rectangle[0] +
                                         OpenInfosWindowButton.Rectangle[2] +
                                         5)
        OpenExperienceWindowButton.Set_Y(OpenInfosWindowButton.Rectangle[1])

        # -- Update Windows -- #
        WindowsUpdate()

        # -- Update Objects -- #
        IncomingLog.Update()
        gameClock.Update()