Skip to content

Commit 356b671

Browse files
committed
stupid dog, you made me look bad.
1 parent 2ad9e3e commit 356b671

9 files changed

Lines changed: 142 additions & 67 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

.github/.DS_Store

6 KB
Binary file not shown.

.github/workflows/appveyor.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#---------------------------------#
2+
# general configuration #
3+
#---------------------------------#
4+
5+
# version format
6+
version: 0.2.0.{build}
7+
8+
# branches to build
9+
branches:
10+
only:
11+
- master
12+
13+
# Do not build on tags (GitHub and BitBucket)
14+
skip_tags: false
15+
# Start builds on tags only (GitHub and BitBucket)
16+
skip_non_tags: false
17+
# Do not build feature branch with open Pull Requests
18+
skip_branch_with_pr: true
19+
# Maximum number of concurrent jobs for the project
20+
max_jobs: 1
21+
22+
#---------------------------------#
23+
# environment configuration #
24+
#---------------------------------#
25+
26+
image: Visual Studio 2015
27+
28+
# clone directory
29+
clone_folder: c:\projects\lapyrinthe{build}
30+
31+
environment:
32+
matrix:
33+
- PYTHON: C:\Python36-x64
34+
PYTHON_VERSION: 3.6.5
35+
PYTHON_ARCH: 64
36+
- PYTHON: C:\Python36
37+
PYTHON_VERSION: 3.6.5
38+
PYTHON_ARCH: 32
39+
40+
init:
41+
- git config --global core.autocrlf input
42+
# - curl -fsS -o butler.exe https://dl.itch.ovh/butler/windows-amd64/head/butler.exe
43+
44+
install:
45+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
46+
47+
build_script:
48+
- pip install -r requirements.txt
49+
- pyinstaller -F -w -n lapyrinthe --clean lapyrinthe.spec
50+
51+
artifacts:
52+
- path: dist/*
53+
54+
#---------------------------------#
55+
# deployment configuration #
56+
#---------------------------------#
57+
58+
deploy:
59+
- provider: GitHub
60+
description: 'Lapyrinthe'
61+
artifact: /.*\.exe/
62+
auth_token:
63+
secure: ZzAkDVtw2SmgOnO6xlBy5htODrHrVCiXVHi+i3/Y7QSxx04Mso1j2Mw32myY+oL4
64+
on:
65+
branch: master # release from master branch only
66+
appveyor_repo_tag: true # deploy on tag push only

.github/workflows/travis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
language: python
2+
python:
3+
- 3.6
4+
5+
matrix:
6+
include:
7+
- os: osx
8+
language: generic
9+
env: PYTHON=3.6.0, BUTLER='https://dl.itch.ovh/butler/darwin-amd64/head/butler'
10+
- os: linux
11+
language: python
12+
env: PYTHON=3.6.0, BUTLER='https://dl.itch.ovh/butler/linux-amd64/head/butler'
13+
14+
before_install: |
15+
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
16+
brew update
17+
brew install openssl readline
18+
brew outdated pyenv || brew upgrade pyenv
19+
brew install pyenv-virtualenv
20+
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install ${PYTHON}
21+
export PYENV_VERSION=${PYTHON}
22+
export PATH="/Users/travis/.pyenv/shims:${PATH}"
23+
pyenv-virtualenv venv
24+
source venv/bin/activate
25+
python --version
26+
fi
27+
28+
install:
29+
- wget ${BUTLER} -o butler
30+
- chmod +x butler
31+
- ./butler login
32+
- pip install -r requirements.txt
33+
34+
script:
35+
- pyinstaller -F -w -n lapyrinthe --clean lapyrinthe.spec
36+
- mv dist/lapyrinthe dist/lapyrinthe_${TRAVIS_OS_NAME}
37+
38+
after_script::
39+
- butler push dist ashmonger/lapyrinthe:linux
40+
41+
deploy:
42+
provider: releases
43+
api_key: "${GITHUB_TOKEN}"
44+
file: "./dist/lapyrinthe_${TRAVIS_OS_NAME}"
45+
skip_cleanup: true
46+
on:
47+
tags: true

assets/.DS_Store

0 Bytes
Binary file not shown.

main.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env python
22
# Credits!!!
33
# (YT) Clear Code - Particle System
4+
# (YT) Python Simplified - Python to .app
45
# jay3332 - Number Abbreviation
56
# Cryptogrounds / Considera Core
7+
# https://www.reddit.com/r/pygame/comments/ehbbr9/comment/fchsd94/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
68

79
import pygame
810
import random
@@ -26,6 +28,17 @@
2628

2729
GameFPS = 60
2830

31+
def resource_path(relative_path):
32+
""" Get absolute path to resource, works for dev and for PyInstaller """
33+
try:
34+
#https://stackoverflow.com/a/13790741
35+
# PyInstaller creates a temp folder and stores path in _MEIPASS
36+
base_path = sys._MEIPASS2
37+
except Exception:
38+
base_path = os.path.abspath(".")
39+
40+
return os.path.join(base_path, relative_path)
41+
2942
class ParticlePrinciple:
3043
def __init__(self):
3144
self.particles = []
@@ -253,7 +266,7 @@ def abbreviate(number, suffixes, decimals, greaterthan, rounda):
253266
# pygame.time.set_timer(PARTICLE_EVENT, 20)
254267

255268
# Font
256-
font = pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", 24)
269+
font = pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), 24)
257270

258271
# Colors
259272
WHITE = (255, 255, 255)
@@ -480,10 +493,10 @@ def resetupgrades():
480493
Settings_Button_Y_scroll = 0
481494
Settings_Button_Y_scroll_vel = 0
482495
# Clicker button
483-
clicker_button_image = pygame.image.load("./assets/img/copilot.png").convert_alpha()
496+
clicker_button_image = pygame.image.load(resource_path("./assets/img/copilot.png")).convert_alpha()
484497
# clicker_button_rect = clicker_button_image.get_rect(center=(screen_width // 2, screen_height // 2))
485-
arrow_down_img1 = pygame.image.load("./assets/img/Arrow1-c.png").convert_alpha()
486-
arrow_up_img1 = pygame.image.load("./assets/img/Arrow1-d.png").convert_alpha()
498+
arrow_down_img1 = pygame.image.load(resource_path("./assets/img/Arrow1-c.png")).convert_alpha()
499+
arrow_up_img1 = pygame.image.load(resource_path("./assets/img/Arrow1-d.png")).convert_alpha()
487500

488501
# Upgrade button setup
489502
for i, upgrade in enumerate(upgrades):
@@ -569,7 +582,6 @@ def PlayMusic(musNum):
569582
pymusictype = "wav"
570583
musicfilepath = "./assets/audio/INOSSI - Got you-loop 44100.wav"
571584
musicintrofilepath = "./assets/audio/INOSSI - Got you-start 44100.wav"
572-
print(musicintrofilepath)
573585
original_musicintro = AudioSegment.from_file(musicintrofilepath)
574586
pitched_musicintro = change_pitch_in_memory(original_musicintro, 3)
575587
audio_buffer1 = BytesIO()
@@ -582,9 +594,9 @@ def PlayMusic(musNum):
582594

583595
PlayMusic(random.randint(1,6))
584596
pygame.mixer.music.set_volume(Decimal(pygamemixermusic) * (Settings[1]["value"] / 100))
585-
click_sound = pygame.mixer.Sound("./assets/audio/Click mouse - Fugitive Simulator - The-Nick-of-Time.wav")
586-
hover_sound = pygame.mixer.Sound("./assets/audio/251389__deadsillyrabbit__button_hover-wav.wav")
587-
upgrade_sound = pygame.mixer.Sound("./assets/audio/Upgrade SOund 0001.wav")
597+
click_sound = pygame.mixer.Sound(resource_path("./assets/audio/Click mouse - Fugitive Simulator - The-Nick-of-Time.wav"))
598+
hover_sound = pygame.mixer.Sound(resource_path("./assets/audio/251389__deadsillyrabbit__button_hover-wav.wav"))
599+
upgrade_sound = pygame.mixer.Sound(resource_path("./assets/audio/Upgrade SOund 0001.wav"))
588600

589601
Hovering_Buttons = [0,0,0,0,0,0,0,0,0,0]
590602
framestofixload = 0
@@ -598,12 +610,12 @@ def save_game():
598610
offlineTime = time.time()
599611
GameStuff = [gems, score, start_time, offlineTime, bulkbuy]
600612
GameStuff2 = [Settings, upgrades, GameStuff]
601-
with open(f'./SaveData.pickle', 'wb') as fileSave:
613+
with open (resource_path("save/SaveData.pickle"), 'wb') as fileSave:
602614
pickle.dump(GameStuff2, fileSave, protocol=pickle.HIGHEST_PROTOCOL)
603615
def load_game():
604616
try:
605617
global Settings, upgrades, gems, score, start_time, game_time, offlineCurrentTime, offlineOldTime, delta_time, offlineTime, framestofixload, auto_click_rate, auto_click_value, click_value, click_value_multi, cps_to_cpc, offlineBoxAlpha, differenceTimeOffline, offlineCurrentTime, offlineOldTime, gemboost, GameStuff, bulkbuy, GameStuff2
606-
with open('./SaveData.pickle', 'rb') as fileSave:
618+
with open (resource_path("save/SaveData.pickle"), 'rb') as fileSave:
607619
GameStuff2 = pickle.load(fileSave)
608620
GameStuff = GameStuff2[2]
609621
upgrades = GameStuff2[1]
@@ -864,7 +876,7 @@ def load_game():
864876
screen.fill((30, 30, 30))
865877
screen.blit(smalclicrimg, (button_rect_x[0]-(scale_x[0]/2)*WindowScale2, button_rect_y[0]-(scale_y[0]/2)*WindowScale2))
866878
# Draw text
867-
font = pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", int(24*WindowScale2))
879+
font = pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), int(24*WindowScale2))
868880
def draw_text(text, font, color, x, y, align, alpha):
869881
text_surface = font.render(text, True, color)
870882
text_surface.set_alpha(alpha)
@@ -927,9 +939,9 @@ def prestige():
927939
draw_text(f"{Settings[i]['name']}", font, WHITE, setx*WindowXscale + Settings_button_width[i]*WindowXscale/2, sety*WindowYscale + Settings_button_height[i]*WindowScale2/2, "center", 255)
928940
pygame.draw.rect(screen, (30, 30, 30), (900*WindowXscale + CamPos[0]*WindowXscale, WindowHeight*0.35 + CamPos[1]*WindowYscale, 380*WindowXscale, WindowHeight*1))
929941
pygame.draw.rect(screen, (30, 30, 30), (900*WindowXscale + CamPos[0]*WindowXscale, WindowHeight*0.0 + CamPos[1]*WindowYscale, 380*WindowXscale, WindowHeight*0.1))
930-
draw_text(f"Options", pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", int(36*WindowScale2)), WHITE, 1110*WindowXscale + CamPos[0]*WindowXscale, 18 * WindowYscale + CamPos[1]*WindowYscale, "center", 255)
931-
draw_text(f"Log", pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", int(36*WindowScale2)), WHITE, 1110*WindowXscale + CamPos[0]*WindowXscale, 318 * WindowYscale + CamPos[1]*WindowYscale, "center", 255) # IT'S CLONE RIGGY!
932-
draw_text(f"Upgrades", pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", int(36*WindowScale2)), WHITE, 30*WindowXscale + CamPos[0]*WindowXscale, 540 * WindowYscale + CamPos[1]*WindowYscale, "left", 255)
942+
draw_text(f"Options", pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), int(36*WindowScale2)), WHITE, 1110*WindowXscale + CamPos[0]*WindowXscale, 18 * WindowYscale + CamPos[1]*WindowYscale, "center", 255)
943+
draw_text(f"Log", pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), int(36*WindowScale2)), WHITE, 1110*WindowXscale + CamPos[0]*WindowXscale, 318 * WindowYscale + CamPos[1]*WindowYscale, "center", 255) # IT'S CLONE RIGGY!
944+
draw_text(f"Upgrades", pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), int(36*WindowScale2)), WHITE, 30*WindowXscale + CamPos[0]*WindowXscale, 540 * WindowYscale + CamPos[1]*WindowYscale, "left", 255)
933945
for i, button in enumerate(upgrade_buttons):
934946
def calcmax():
935947
return constrain(Decimal.__floor__( Decimal.log10( (Decimal(score) * (Decimal(upgrades[i]["costcoefficient"]) - 1)) / Decimal(upgrades[i]["startcost"] * (Decimal(upgrades[i]["costcoefficient"]) ** Decimal(upgrades[i]["bought"]))) + 1) / Decimal.log10(Decimal(upgrades[i]["costcoefficient"]))), Decimal(1), math.inf)
@@ -971,8 +983,8 @@ def distance_to(ax, ay, bx, by):
971983
offlineBox_rect_surface = pygame.Surface((960*WindowScale2, 360*WindowScale2), pygame.SRCALPHA)
972984
offlineBox_rect_surface.fill((0, 64, 128, offlineBoxAlpha)) # Fill with red and set alpha to 128 (50% transparent)
973985
screen.blit(offlineBox_rect_surface, ((640*WindowXscale) - (480*WindowScale2), (360*WindowYscale) - (180*WindowScale2)))
974-
draw_text(f"While you were away for {abbreviate((Decimal(offlineCurrentTime) - Decimal(offlineOldTime)), "s", 3, 10000, False)} seconds,", pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", int(30*WindowScale2)), (255, 64, 128, offlineBoxAlpha), 640*WindowXscale, 330*WindowYscale, "center", offlineBoxAlpha)
975-
draw_text(f"You earned {abbreviate(Decimal(differenceTimeOffline) * Decimal(auto_click_value) * Decimal(auto_click_rate) * Decimal(gemboost), "s", 3, 100000, False)} clicks.", pygame.font.Font("./assets/fonts/Lato/Lato-Bold.ttf", int(30*WindowScale2)), (255, 64, 128, offlineBoxAlpha), 640*WindowXscale, 390*WindowYscale, "center", offlineBoxAlpha)
986+
draw_text(f"While you were away for {abbreviate((Decimal(offlineCurrentTime) - Decimal(offlineOldTime)), "s", 3, 10000, False)} seconds,", pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), int(30*WindowScale2)), (255, 64, 128, offlineBoxAlpha), 640*WindowXscale, 330*WindowYscale, "center", offlineBoxAlpha)
987+
draw_text(f"You earned {abbreviate(Decimal(differenceTimeOffline) * Decimal(auto_click_value) * Decimal(auto_click_rate) * Decimal(gemboost), "s", 3, 100000, False)} clicks.", pygame.font.Font(resource_path("./assets/fonts/Lato/Lato-Bold.ttf"), int(30*WindowScale2)), (255, 64, 128, offlineBoxAlpha), 640*WindowXscale, 390*WindowYscale, "center", offlineBoxAlpha)
976988
offlineBoxAlpha = constrain(offlineBoxAlpha - 51*delta_time, 0, 255)
977989
YouWillNotUpgradeUnlessToldTo_Time -= delta_time
978990
# Update display

main.spec

Lines changed: 0 additions & 51 deletions
This file was deleted.

save/SaveData.pickle

1.82 KB
Binary file not shown.

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
PyInstaller.__main__.run([
44
'main.py',
5+
'--name=MSCopilotClicker',
56
'--windowed',
67
'--noconsole',
78
#'--icon=copilot.ico',

0 commit comments

Comments
 (0)