From e406bdea89bc23e4f9490be1a1b8a89feba4499e Mon Sep 17 00:00:00 2001 From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Tue, 4 Jul 2023 20:31:27 -0400 Subject: [PATCH] remove unnecessary --- .gitattributes | 2 - .gitignore | 152 --------- .idea/.gitignore | 8 - .idea/fruit-ninja.iml | 10 - .../inspectionProfiles/profiles_settings.xml | 6 - .idea/misc.xml | 4 - .idea/modules.xml | 8 - .idea/vcs.xml | 6 - __pycache__/bomb.cpython-310.pyc | Bin 3689 -> 0 bytes __pycache__/combo_counter.cpython-310.pyc | Bin 1019 -> 0 bytes __pycache__/effect.cpython-310.pyc | Bin 7343 -> 0 bytes __pycache__/fruit.cpython-310.pyc | Bin 2333 -> 0 bytes __pycache__/game.cpython-310.pyc | Bin 5431 -> 0 bytes __pycache__/menu.cpython-310.pyc | Bin 3602 -> 0 bytes __pycache__/player.cpython-310.pyc | Bin 1983 -> 0 bytes __pycache__/setup.cpython-310.pyc | Bin 3306 -> 0 bytes bomb.py | 108 ------- combo_counter.py | 23 -- effect.py | 301 ------------------ fruit.py | 53 --- game.py | 295 ----------------- main.py | 31 -- menu.py | 149 --------- player.py | 77 ----- rect.py | 18 -- setup.py | 103 ------ 26 files changed, 1354 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .gitignore delete mode 100644 .idea/.gitignore delete mode 100644 .idea/fruit-ninja.iml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 __pycache__/bomb.cpython-310.pyc delete mode 100644 __pycache__/combo_counter.cpython-310.pyc delete mode 100644 __pycache__/effect.cpython-310.pyc delete mode 100644 __pycache__/fruit.cpython-310.pyc delete mode 100644 __pycache__/game.cpython-310.pyc delete mode 100644 __pycache__/menu.cpython-310.pyc delete mode 100644 __pycache__/player.cpython-310.pyc delete mode 100644 __pycache__/setup.cpython-310.pyc delete mode 100644 bomb.py delete mode 100644 combo_counter.py delete mode 100644 effect.py delete mode 100644 fruit.py delete mode 100644 game.py delete mode 100644 main.py delete mode 100644 menu.py delete mode 100644 player.py delete mode 100644 rect.py delete mode 100644 setup.py diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index dfe0770..0000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3eb56cb..0000000 --- a/.gitignore +++ /dev/null @@ -1,152 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -.idea/ diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/fruit-ninja.iml b/.idea/fruit-ninja.iml deleted file mode 100644 index 74d515a..0000000 --- a/.idea/fruit-ninja.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 74740ed..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8571d5f..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/__pycache__/bomb.cpython-310.pyc b/__pycache__/bomb.cpython-310.pyc deleted file mode 100644 index 92b945697c1825e40416502ded4b18c45899f26a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3689 zcmd1j<>g{vU|@LkuO-D_l7Zndh=Yt-7#J8F7#J9eO&Ay$QW#Pga~N_NqZk=MY^EHh zT;?cdFq=7tC4|A9A%!J{wS^&tHI=cMIf^xfEto-*{UyjeO~zZSZbhY;C7O)4xPuFF zGD}?3(o&N_Tt=;AkP2kX3*{6mFf%ZuGDI<^Fhnt>Fh((_GN&+!FhsGWFh{YbvSqO^ z;7Dc5;#|O$!m^NY0rx_NROS>`5h$6)w2%oT7R7_2l5HVlDhpT@n1rc9QNvDz8V(}V za1x=0iwHH`*wv)7p}3j{yDAhlyhNzsBSH;75o!d8P$P(4&2aWvI&&0nicl0^Dq9x+ z0)Z6ag^W;^$U??+rYOO7hBU?$(G;;3jwm58TRcUgg(FHhMKVRIg&|5LMLI>Mg&|6` zoq>fRN-UT`Q}z~%Q+{sJ%M=C%hL@o1{L-6&fuV{&vA8(3q*y;GKQ~FQATRwT6G&7M zDw0`^hn7e)q#DrIOy73Y`cr4;LD6zamGOxMiF!a}b+v8+l1 zRZ(tgN@i&;l0p*$6LTYw%49}pkqV+fY-R=q1`sZ`V_;w?VQ6Mpz_^fsk)ehmi>Zbo zo;iiFh9RCM1;l2pVaQ^uVTfl3^EgU47jV@uWN|M9so+Ur2xib^_H!!&nW@Qpi?z74 zAhqZgM|^x{US>&r{4KU1M;Fh~;9G1(i7A<-#kV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0586cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1019 zcmd1j<>g{vU|@KiUzHNd#K7(LFG0FA8E-LaC4*SVmCzs}?=9Lu3xM!AllqSWb6_sX|=;meSWhKUdEsalx1eIPv zi*_{_Y_lK6O#xy7J3=3(Sx@-4_!noLCk3=9mnSW{ASN)o|7hY&&_QMS^8l*E!$K2QvUR7)`OF>*1oFtYrw z5=QX@L>+D)h=6>+xB%jQhAgIqOpFlMG5UdGASoxaq=+BnCQxv}+{6NkBZzB2F;WC} z5=%-^VmZjTVo(r?FjfhoI0Pi?r^yZq|GdQ9)cE*YT=DU_`6;D2AU02Yd|_!~4n(Gi z6J((5rP0&Sp-VxpdbWCBL@QuBL@=)I}aOJ+)tC~7He^8NofI?i{x6c XAt3#?IBXyeumdIUVvtE33_{ERk&WN! diff --git a/__pycache__/effect.cpython-310.pyc b/__pycache__/effect.cpython-310.pyc deleted file mode 100644 index 63a96c4b45e4cb9e8af2a15689b094219b9fb98b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7343 zcmd1j<>g{vU|@LkuO%fzihC@fLo;IvC&)cWd@fXeI&&0z3U>-m z3quq~3U3Nu3qurV3V(_~3qurFieNBX0Bu?5@cXt_+{#B6%$&VT2vg9 zn39{H7vqwjT$-DjS5h3~o>}5iniP{(RGL|$o0plFl^Bx>_Ml!tK&R}3*C}CK@Si`uGv4bI=sfMY9 zxq~5#C52Iv0ZcPVGL*0`U|q=2%q+st!4S{Z!H~t?!4S`p0#eTjCb_^QcRNEGV+wN$ zOAAK{>jIt*hAiHN;KbR%5YLyw5X_*->Q@9xJ1;>5Mo@wr3kr~8J6I}`hNU8KT4JtY zEMe(j$YM=l5MgLWVW%-IWa?nZVq3@rO<#;fAP;J?7lA_e7H3IOVqS4teo^i%wxax! z#FEroti{QRIjOgpGxJJru@xnzWR@1+Vol6T&q-a$RK(A~z;KH-ttc@!btU61mg3Z$ zG_*()1(g;&3=9lx3`|T~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}=W&n>CfNBs>EdfgSjPQgH9xu>j z_6q^0D%h|p*x86-0i!^wIwI)v85kJWz}yQ?uADqP4-)?#i=Ew z1x2937~JUww}`<7HaJCt)nPOC7KaUF4Al#G4rYLsq-oFsSAk$08omH AM*si- diff --git a/__pycache__/fruit.cpython-310.pyc b/__pycache__/fruit.cpython-310.pyc deleted file mode 100644 index fc2ac081e0337c8e28cc6873762b59fb2656a647..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2333 zcmd1j<>g{vU|^7LZBA+9VPJR+;vi#Y1_lNP1_p*=DFz0H6owSW9EK1EcZL+E6y_F& z6y|28D8>|)UN=?iI3kX34auZ8RG9YHZ1VwBzBT_Vh+ysg#XHaa%F)}ce zFw`()F{Us|LTDyQh7zU)ObZ#BnQIv0nM+s}u!2>vK~=D&AgKV$utR0ok!2P#)iA_! zz;$y%)o>!K0qf?1%5WjefOT_&bf+-ZFl6z7`Mfm@SsYn>H4ItYS$q- zAL1C~?ivEsDH`S)6yoWOF3eVvSd^Yxa!U+JUvPk9xF1xT2wWSoC`Unlab`(oe%>v1 z_aMhG&ydJlJc-H4sX3`diC|&I%3F*Tw>ZjDbMlijODb=1mJ}uC6{qDF<=$c~PEO28 zy~UQCk)N5IdW+S=)zKyR7Hej1VtVQ=*2KK@oYY&KDVas7$zYQ>(o;*~i!-ZIZ?TqV zrj%sdV#`R)OwTCMWVyvsoSKt%iz%h@7E?;aEyj|S3`M#O3=F?aoULL)i&Kk=V-izx z^Yda{@{>z*Q}arSW85=KJW7*d(m>f$H!m|UD-puhE2zB15g(tKmst`YFA2&EDhvz^ za*QlYQjAiJZ2wr8A+!Lq0E+;l5Tg>K2BQ$80HYX76(2aS>%lZ9gR(j#P8k?LY)}pZ z=dKV228J327KSWv&H|@OMrj6f1}27hh&WRXNDh=*Vd6|+^~@ORJ4E!c1_kIIR*xXB54o-@=X!QH$|!p3=En~MVbr@47XTQQgccY z!NCO~^gyC)r3ER8C8Jyz7$FV@(F>U*7+~Tx3|TA-nHDkyGiWmTfs?)_YmpEG149%`P-=2X5!ltjAomM` zT+Ik}HN>T$C@um!7o0Re>BJJ|U` z7)qG48H-d(SZWxuSZf%v*g!GT%pAj1%T&u;!?b`Mnx8pp7~(l=7#DDXN|S|5j0~W7 z0AWo=KTU3k<7Hruzs2U^>gnzg62)7TUy@jo8lRk+SCU#(qzqC3ju-0u0zxcei~@`Tj4Xev zxFE3ylJ?US110mk#N5>Q_*-1@@wxdar8yurPkek~X<`mUridTp4CdU#id(GVo-QFC zMdBdGnSclh5FrX8L_h?nfdGy-uy<~;J-@iFr; z!XV2p77h+34oMDn9u}}3KTW1vti`D%r3GLvQpy2a05ba)hYiI0cA!*T46=oTL5LXu D0G%T! diff --git a/__pycache__/game.cpython-310.pyc b/__pycache__/game.cpython-310.pyc deleted file mode 100644 index d7483470074bc0debcc1c8f143c5c8c96c128e72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5431 zcmd1j<>g{vU|@LkuO+2QiGkrUh=Yuo85kHG7#J9evlti{QW#Pga~N_NqZk=MY^EHh zT;?cdFq=7tC6_gdHJ2@lEtfrtJ(nYjBbPIZGnXrh3oOr)!=1|$#RF!u=J4k7Me%{z zY&rZP4DJjm>?s^A3@IGVOi=(=6_sX|Xfobn3&=^VOfAx6yv3-M3~~uFW`%{xBnAeCRE8+V6ox3K6vim# z6s9Pa6y_+_6qYEq6xJyARE{jp1zf2dS=XBTI0B zPzw7(#wg)b;RPZoj0+hV8K9yZ3mKs-PB@EeA!9molxPZflvoN+3U3QTlz0kX3V#bj zlthX^ieL*vlw^ufFoUM>Ef)90+|=}0GeKad{Yw!B28JR=1_p+gzZe)8GB2<*FjR>q z78j?M6zeA?CTFJ?<(KBA=oRFpSLs59i$NmA`o*P5x=D$}#kwZC#i_~pc`3ypplfDi zVyIW1SXO0-syw(nvp6HQSU)E}FI_h`H6^n&SGO1>rfXtiY-9q~qJmvZad~E5x~`dl zi78l>HcnN=8ML?^JZ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y9W=dfbXQ*LcAOaQ< zS;!#H01^Q;rD{2AI2VYPh=GdP8qNibHS9I)S>iREAblz9(okI>RvJ?ZM=vBqK~POy#$q6nzFap zij#{{Q}d!&l5#RjZgDv|I(xeZ`G@+sfXm5SEGb2a<=|opT#7@AE^r0Fl9r!W62(@O znwOGV1TJQySi?O$LtKkMl|&R5NIE_zu_!$iQc{8HtSI*2(xSA)klae}iqC`A1>SpqQt!7wEUu6 zP=7ixC$-2AqySv8!-Mn|dvbnWS!z*9Q6@+d+%gCRvBE$Exc(0Tu|PFVkqL+eDuRnZ zfrAuah*0BYU|`?`g&L@S;$Q$3yAUh~4nHnN5M=qs!pgzKAqbJaKYmUkopj0UlBOYK?%MHlt>}N5Uj-C32yiR diff --git a/__pycache__/menu.cpython-310.pyc b/__pycache__/menu.cpython-310.pyc deleted file mode 100644 index 6c7e77d8ed0874cf8a7dc52ef4fd1e2715516c3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3602 zcmd1j<>g{vU|_h&(3)~rn1SIjh=Yuo85kHG7#J9e!x$JCQW#Pga~PsPG*b>^2#99R zVajEWVrB%fS#nr%S)*9NY}OpMT=ppTT#hJ?T+S%YT&^gtT<$1tMh16=6t)!h7KRk| zW~L~f6vki%O^%l!8~rpHZ!v0VGTvef$VseBEz)GX#p+g6npvXBdW$f!%U9fGsmL}!~<{-t%j7WhAVzV+ZFgSyf$_54oh7yJ>#w?}<%%IS# zVTfme@>x@u7BVuzWZ6=f!94b6h8l)=juK8V%~is%fV+ezg+-d7gg1pngdv4hnqeVR z4MP@JJYNbMnC4Fh=@2LpTp$DrDO_;A1enha z=S!yW)G)+Lr7#3DX!811*`xa2KTW|cu}HxsGc7H(C^fG{!7mXM2MW3ht|b|HnaK)H zsfi^D8qUtTPLY~=`RVEDkN|mL|MLI;|NmbyF)%Q^1m&M1Q0P<%f)lfXUuIrbqJncy zeqL%wmAFe$V!A>}zCv+MW^$@RNk*zd8YszE@dp&878fh{g5+{b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wQ7@7^GZ^SUP^+* zKy7YK##_8e`9&$IMe&fl_7aqBUK%klFlaK~;!4UdDap^xNlgRQZQKxEQD%BZiKf^s zmZY4_l3QGe>b(e*R3RCiC8a2_yhs9MJ;1XK##VuOf43Mv+` z5T}b{kaxU$kYnU6_RPGroWzpUTdYn#j?UheqLE>QAtq@ zNE}>DJAqiPAVLd7fC`KvkZ&NKL-Qsm!Z|_S1ce_50~@0NBO4>re-=ije=JN)|F~GV z7`Yf({&BE!2=izbfmCbqLR`sOoLW*^0506YjWuvAgIj8l@B}3qa9Il}yg|h%xKsuk fg3T?rIBX!HVh3uL7K0Kh2LlHasBDvA6k-MdW%Id4 diff --git a/__pycache__/player.cpython-310.pyc b/__pycache__/player.cpython-310.pyc deleted file mode 100644 index 24a73e2cd16cdf1468cfe5143b1ad668cdac8315..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1983 zcmd1j<>g{vU|@LkuO&r@gMr~Oh=Yuo85kHG7#J9er5G3(QW#Pga~MJx+!<1sQkYv9 zQka{Wq8L+Hf*CYfUxIXLGTvg;N(QlzF%!%T69xu`RE8+V6ox3K6vim#6s9Pa6y_9` z7KSL+6xI~B7KSLc6!sL37KSMH6wVZ`7KSK}6z*UKO`cn90Xd14sYNeS7#J8{iZC!R zBr_se0b;W-FfcfSTx!6;z>v;R!w?T48B3TJFqbf8u`FO+$gq&Hh9RB}B$C3I!nlyB zh9RCkg&~+hlgY0LWQZomE#Bgs%;eOR_=5b*yprNu92uD~%LkY9XDsGumdEHl5fI36qk7UPF7Q!}5iniP{(RGL|$ zo0plFl^9b14gA_SagMuFxRv?ui z3=Sv{Mh1owhAhSfObZ!mnQE9)7$q5sbig9a3mIyeYZyR*R>H7=t%i9aV+lhR`vQ)I z3~5XY85tR1qBRUzoD!hG=0b?XbLI(vc<>+w%fZYAM*(LILl*Y}o`npI3?;lEdzu+j zn6g=l8cX;PdMfR_)Z~&|oO$_0xrsTMRjIeQGV{`M5=&C!GYf9E;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H8v)YA1!h6C zLJS7$=LQQy4S{f=CP6q*WnGIQ#qhI{LZ9yGD41+~S4tfnP{34|#P^$*gO5m``%}*)KNwovzt71^T;$Yxl= self.EXPLOSION_TIME / len(self.explosion_txt): - self.exploded_frame_timer = 0 - self.explosion_frame = min(len(self.explosion_txt) - 1, self.explosion_frame + 1) - if self.explosion_frame == len(self.explosion_txt) - 1: - return True - - def explode(self, fruits, bombs, effects, depth=0): - if self in bombs: - if not self.exploded: - self.image = self.explosion_txt[0] - if depth == 0: - pygame.mixer.Sound.play(random.choice(self.explosion_sound_effects)) - self.exploded = True - self.velocity = pygame.Vector2(0, 0) - self.acceleration = pygame.Vector2(0, 0) - - for fruit in fruits: - fruit.velocity += (fruit.position - self.position).normalize() * self.POWER - for effect in effects: - effect.velocity += (effect.position - self.position).normalize() * self.POWER - - for bomb in bombs: - if not bomb.exploded: - bomb.explode(fruits, bombs, effects, depth + 1) - - def draw(self): - if self.exploded: - self.explosion_txt[self.explosion_frame].draw(None, pygame.Rect(self.position.x - self.EXPLOSION_RADIUS, - self.position.y - self.EXPLOSION_RADIUS, - self.EXPLOSION_RADIUS * 2, - self.EXPLOSION_RADIUS * 2)) - else: - # self.circle.draw(None, pygame.Rect(self.position.x - self.RADIUS, self.position.y - self.RADIUS, - # self.RADIUS * 2, self.RADIUS * 2)) - - self.BOMB_TXT.draw(None, pygame.Rect(self.position.x - self.radius * self.RADIUS_FACTOR, - self.position.y - self.radius * self.RADIUS_FACTOR, - self.radius * 2 * self.RADIUS_FACTOR, - self.radius * 2 * self.RADIUS_FACTOR), - self.angle, (self.radius * self.RADIUS_FACTOR, self.radius * self.RADIUS_FACTOR)) diff --git a/combo_counter.py b/combo_counter.py deleted file mode 100644 index f697d50..0000000 --- a/combo_counter.py +++ /dev/null @@ -1,23 +0,0 @@ -from setup import * - - -class ComboCounter: - LIFE_TIME = 1000 - - def __init__(self, position, combo): - self.position = pygame.Vector2(position) - self.velocity = pygame.Vector2(0, -100) - self.time = self.LIFE_TIME - self.combo = f"x{combo}" - self.text_surface = font_large.render(self.combo, True, DARK_GRAY) - self.text_txt = Texture.from_surface(renderer, self.text_surface) - - def update(self, delta): - self.position += self.velocity * delta / 1000 - self.time -= delta - if self.time <= 0: - return True - - def draw(self): - self.text_txt.draw(None, self.position - pygame.Vector2(self.text_surface.get_width() / 2, - self.text_surface.get_height() / 2)) diff --git a/effect.py b/effect.py deleted file mode 100644 index 3a7ce26..0000000 --- a/effect.py +++ /dev/null @@ -1,301 +0,0 @@ -from setup import * - - -class BloodEffect: - LIFE_TIME = 1000 - SPEED_RANGE = [250, 350] - RADIUS_RANGE = [3, 3.75] - blood_frames = [ - [pygame.image.load(f"assets/effects/blood1/{i}.png").convert_alpha() for i in range(16)], - [pygame.image.load(f"assets/effects/blood2/{i}.png").convert_alpha() for i in range(16)], - [pygame.image.load(f"assets/effects/blood3/{i}.png").convert_alpha() for i in range(16)] - ] - - def __init__(self, position, radius, color=None): - self.position = pygame.Vector2(position) - - self.radius = radius * lerp(self.RADIUS_RANGE[0], self.RADIUS_RANGE[1], random.random()) - - self.life_time = 0 - self.current_frame = 0 - - self.surf_frames = random.choice(self.blood_frames) - - if color is None: - color = random.choice(EFFECT_COLORS) - - for frame in self.surf_frames: - px_array = pygame.PixelArray(frame) - px_array.replace(pygame.Color(250, 3, 35), pygame.Color(color)) - px_array.close() - - self.frame_txt = [Texture.from_surface(renderer, frame) for frame in self.surf_frames] - - def update(self, delta): - self.life_time += delta - - if self.life_time >= self.LIFE_TIME / len(self.surf_frames) * (self.current_frame + 1): - self.current_frame += 1 - - if self.life_time >= self.LIFE_TIME: - return True - - def draw(self): - if self.life_time < self.LIFE_TIME: - self.frame_txt[self.current_frame].draw(None, pygame.Rect(self.position.x - self.radius, - self.position.y - self.radius, - self.radius * 2, self.radius * 2)) - - -class BloodSplatter: - LIFE_TIME = 4000 - FADE_TIME = 1000 - RADIUS_RANGE = [2, 2.75] - ANGLE_OFFSET = 35 - blood_frames = [ - pygame.image.load("assets/effects/splatter/bloodslash1.png").convert_alpha(), - pygame.image.load("assets/effects/splatter/bloodslash2.png").convert_alpha() - ] - - LIGHT_COLOR1 = pygame.Color(110, 110, 110) - DARK_COLOR1 = pygame.Color(84, 84, 84) - LIGHT_COLOR2 = pygame.Color(83, 83, 83) - DARK_COLOR2 = pygame.Color(74, 74, 74) - - color_frames = [dict(), dict()] - for c in EFFECT_COLORS: - for i, f in enumerate(blood_frames): - c_f = f.copy() - px_array = pygame.PixelArray(c_f) - px_array.replace(LIGHT_COLOR1 if i == 0 else LIGHT_COLOR2, pygame.Color(c)) - px_array.replace(DARK_COLOR1 if i == 0 else DARK_COLOR2, pygame.Color(darken(c, 0.875))) - px_array.close() - color_frames[i][c] = c_f - - def __init__(self, position, radius, angle, color=None): - self.position = pygame.Vector2(position) - - self.radius = radius * lerp(self.RADIUS_RANGE[0], self.RADIUS_RANGE[1], random.random()) - self.angle = angle - - self.life_time = self.LIFE_TIME - self.fade_time = self.FADE_TIME - - img_index = random.randint(0, len(self.blood_frames) - 1) - self.alpha = 255 - - if color is None: - color = random.choice(EFFECT_COLORS) - - self.frame = Texture.from_surface(renderer, self.color_frames[img_index][color]) - - def update(self, delta): - if self.life_time > 0: - self.life_time -= delta - else: - self.fade_time -= delta - - if self.fade_time <= 0 and self.life_time <= 0: - return True - - if self.life_time <= 0: - self.alpha = int(lerp(0, 255, self.fade_time / self.FADE_TIME)) - self.frame.alpha = self.alpha - - def draw(self): - self.frame.draw(None, pygame.Rect(self.position.x - self.radius, - self.position.y - self.radius, - self.radius * 2, self.radius * 2), - self.angle + self.ANGLE_OFFSET, origin=(self.radius, self.radius)) - - -class SplitEffect: - SPEED_PERCENT_RANGE = [65, 85] - gravity = 275 - - def __init__(self, position, frame, fruit_velocity, normal_velocity): - self.position = pygame.Vector2(position) - self.velocity = pygame.Vector2(fruit_velocity) * lerp(self.SPEED_PERCENT_RANGE[0], self.SPEED_PERCENT_RANGE[1], - random.random()) / 100 + pygame.Vector2(normal_velocity) - self.acceleration = pygame.Vector2(0, self.gravity) - - self.angle = frame.angle - self.direction = random.choice([-1, 1]) - - - self.frame = frame - self.width, self.height = self.frame.get_rect().width, self.frame.get_rect().height - - def update(self, delta): - self.velocity += self.acceleration * delta / 1000 - self.position += self.velocity * delta / 1000 - - self.angle += 360 * delta / 1000 / 10 * self.direction - - if self.position.y - self.height / 2 > HEIGHT: - return True - - def draw(self): - self.frame.angle = self.angle - # print(self.position) - self.frame.draw(None, pygame.Rect(self.position.x - self.width / 2, - self.position.y - self.height / 2, - self.width, self.height)) - self.width, self.height = self.frame.get_rect().width, self.frame.get_rect().height - - @staticmethod - def find_normals(v): - return pygame.Vector2(-v.y, v.x), pygame.Vector2(v.y, -v.x) - - @staticmethod - def should_split(texture, angle, image_position, mouse_position, mouse_direction, radius): - if mouse_direction.x == 0: - mouse_direction.x += 0.0001 - - a = math.degrees(math.atan(mouse_direction.y / mouse_direction.x)) - diagonal = math.sqrt(2 * ((radius * 2) ** 2)) - txt = Texture(renderer, (diagonal, diagonal), target=True) - txt.blend_mode = pygame.BLEND_ADD - renderer.target = txt - texture.draw(None, pygame.Rect((diagonal - radius * 2) / 2, (diagonal - radius * 2) / 2, radius * 2, - radius * 2), angle - a, origin=(radius, radius)) - renderer.target = None - - img_size = pygame.Vector2(diagonal, diagonal) - center = img_size / 2 - - # finding end and start points of the splitting line - # [x,y] = mouse_position + t * mouse_direction # vector equation - # x = mouse_position.x + t * mouse_direction.x - # y = mouse_position.y + t * mouse_direction.y - - mp = mouse_position - image_position + center - - t1 = (- mp.x) / mouse_direction.x - p1 = mp + t1 * mouse_direction - - p3 = (p1 - center).rotate(-a) + center - - MIN_SPLIT = 0.25 - slice_percent = clamp(p3.y, 0, img_size.y) / img_size.y - if MIN_SPLIT < slice_percent < 1 - MIN_SPLIT: - return True - return False - - @staticmethod - def split_image(texture, angle, image_position, mouse_position, mouse_direction, radius): - if mouse_direction.x == 0: - mouse_direction.x += 0.0001 - - a = math.degrees(math.atan(mouse_direction.y / mouse_direction.x)) - diagonal = math.sqrt(2 * ((radius * 2) ** 2)) - txt = Texture(renderer, (diagonal, diagonal), target=True) - txt.blend_mode = pygame.BLEND_ADD - renderer.target = txt - texture.draw(None, pygame.Rect((diagonal - radius * 2) / 2, (diagonal - radius * 2) / 2, radius * 2, - radius * 2), angle - a, origin=(radius, radius)) - renderer.target = None - - img_size = pygame.Vector2(diagonal, diagonal) - center = img_size / 2 - - # finding end and start points of the splitting line - # [x,y] = mouse_position + t * mouse_direction # vector equation - # x = mouse_position.x + t * mouse_direction.x - # y = mouse_position.y + t * mouse_direction.y - - mp = mouse_position - image_position + center - - t1 = (- mp.x) / mouse_direction.x - p1 = mp + t1 * mouse_direction - - p3 = (p1 - center).rotate(-a) + center - - half1 = Image(txt, pygame.Rect(0, 0, img_size.x, clamp(p3.y, 0, img_size.y))) - half2 = Image(txt, - pygame.Rect(0, clamp(p3.y, 0, img_size.y), img_size.x, clamp(img_size.y - p3.y, 0, img_size.y))) - - p5 = half1.get_rect().center - center - pos1 = p5.rotate(a) + image_position - - p6 = half2.get_rect().center - center - pos2 = p6.rotate(a) + image_position - - half1.angle = a - half2.angle = a - - return half1, half2, pos1, pos2 - - -class SlashEffect: - SLASH_SURFS = [pygame.image.load(f"assets/effects/sword_slashes/File{i}.png").convert_alpha() - for i in range(1, 7)] - LIFETIME = 600 - - def __init__(self, position, angle): - self.position = pygame.Vector2(position) - self.angle = angle - - self.time = 0 - self.current_frame = 0 - - self.slash_frames = [Texture.from_surface(renderer, frame) for frame in self.SLASH_SURFS] - - def update(self, delta): - self.time += delta - if self.time >= self.LIFETIME / len(self.SLASH_SURFS): - self.time = 0 - self.current_frame += 1 - if self.current_frame >= len(self.SLASH_SURFS): - return True - - def draw(self): - frame = self.slash_frames[self.current_frame] - frame.draw(None, self.position - pygame.Vector2(frame.width, frame.height) / 2, self.angle) - - -class FadeInEffect: - - def __init__(self, fade_time=500): - self.fade_time = fade_time - self.surf = pygame.Surface((WIDTH, HEIGHT), pygame.SRCALPHA) - self.surf.fill(BLACK) - self.time = self.fade_time - self.alpha = 255 - - self.txt = Texture.from_surface(renderer, self.surf) - - def update(self, delta): - self.time -= delta - - if self.time <= 0: - return True - self.alpha = int(lerp(0, 255, self.time / self.fade_time)) - - def draw(self): - self.txt.alpha = self.alpha - self.txt.draw(None, (0, 0)) - - -class FadeOutEffect: - - def __init__(self, fade_time=500, max_alpha=255): - self.fade_time = fade_time - self.max_alpha = max_alpha - - self.surf = pygame.Surface((WIDTH, HEIGHT), pygame.SRCALPHA) - self.surf.fill(BLACK) - self.time = 0 - self.alpha = 0 - - self.txt = Texture.from_surface(renderer, self.surf) - - def update(self, delta): - self.time += delta - if self.time >= self.fade_time: - return True - self.alpha = int(lerp(0, self.max_alpha, self.time / self.fade_time)) - - def draw(self): - self.txt.alpha = self.alpha - self.txt.draw(None, (0, 0)) diff --git a/fruit.py b/fruit.py deleted file mode 100644 index 37a9df3..0000000 --- a/fruit.py +++ /dev/null @@ -1,53 +0,0 @@ -from setup import * - - -class Fruit: - RADIUS_RANGE = [60 * SCALE.x, 100 * SCALE.x] - - HORIZONTAL_SPAWN_RANGE = [max(RADIUS_RANGE), WIDTH - max(RADIUS_RANGE)] - VERTICAL_SPAWN_RANGE = [HEIGHT + max(RADIUS_RANGE), HEIGHT * 2 + max(RADIUS_RANGE)] - - VERTICAL_TARGET_RANGE = [max(RADIUS_RANGE), HEIGHT * 3.5 / 5] - HORIZONTAL_TARGET_RANGE = [WIDTH / 5.5, WIDTH * 4.5 / 5.5] - - GRAVITY = 275 * SCALE.y - FRUITS = [ - pygame.image.load(f"assets/fruits/{file}").convert_alpha() for file in os.listdir('assets/fruits/') - ] - - def __init__(self): - self.radius = lerp(self.RADIUS_RANGE[0], self.RADIUS_RANGE[1], random.random()) - - self.target = pygame.Vector2( - lerp(self.HORIZONTAL_TARGET_RANGE[0], self.HORIZONTAL_TARGET_RANGE[1], random.random()), - lerp(self.VERTICAL_TARGET_RANGE[0], self.VERTICAL_TARGET_RANGE[1], random.random())) - self.position = pygame.Vector2( - lerp(self.HORIZONTAL_SPAWN_RANGE[0], self.HORIZONTAL_SPAWN_RANGE[1], random.random()), - lerp(self.VERTICAL_SPAWN_RANGE[0], self.VERTICAL_SPAWN_RANGE[1], random.random())) - - self.acceleration = pygame.Vector2(0, self.GRAVITY) - - dy = self.target.y - self.position.y - dx = self.target.x - self.position.x - t = (-2 / self.GRAVITY * dy) ** 0.5 - self.velocity = pygame.Vector2(dx / t, -(-2 * self.GRAVITY * dy) ** 0.5) - - self.angle = lerp(0, 360, random.random()) - self.direction = random.choice([-1, 1]) - - self.width, self.height = (self.radius * 2, self.radius * 2) - - self.image = random.choice(self.FRUITS) - self.fruit_txt = Texture.from_surface(renderer, self.image) - - def update(self, delta): - self.velocity += self.acceleration * delta / 1000 - self.position += self.velocity * delta / 1000 - - self.angle += 360 * delta / 1000 / 10 * self.direction - - def draw(self): - if self.position.y - self.radius <= HEIGHT: - self.fruit_txt.draw(None, pygame.Rect(self.position - pygame.Vector2(self.radius, self.radius), - (self.radius * 2, self.radius * 2)), - angle=self.angle, origin=(self.radius, self.radius)) diff --git a/game.py b/game.py deleted file mode 100644 index b07d96c..0000000 --- a/game.py +++ /dev/null @@ -1,295 +0,0 @@ -from player import Player -from fruit import Fruit -from effect import BloodEffect, SplitEffect, SlashEffect, FadeInEffect, FadeOutEffect, BloodSplatter -from combo_counter import ComboCounter -from bomb import Bomb -from rect import Rect -from setup import * - - -class Game: - BOMB_CHANCE = 0.1 - - COMBO_TIME = 250 - GAME_OVER_TIME = 2000 - WAVE_COOLDOWN = 500 - - BACKGROUND = pygame.Surface((WIDTH, HEIGHT)) - tile_cols = 4 - tile_rows = 4 - background_tile = pygame.transform.scale(pygame.image.load("assets/background.png"), - (WIDTH / tile_cols, HEIGHT / tile_rows)).convert() - dark_background_tile = pygame.transform.scale(pygame.image.load("assets/dark_background.png"), - (WIDTH / tile_cols, HEIGHT / tile_rows)).convert() - for x in range(tile_cols): - for y in range(tile_rows): - if y == 0: - BACKGROUND.blit(dark_background_tile, (x * WIDTH / tile_cols, y * HEIGHT / tile_rows)) - else: - BACKGROUND.blit(background_tile, (x * WIDTH / tile_cols, y * HEIGHT / tile_rows)) - BACKGROUND = Texture.from_surface(renderer, BACKGROUND) - - bass_sound_effect = pygame.mixer.Sound("assets/sounds/sub-bass-4-secondsssss-6241.wav") - bass_sound_effect.set_volume(0.1) - slash_sounds = [pygame.mixer.Sound(f"assets/sounds/Swishes/long-medium-swish-44324.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swing-6045.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swish-sound-94707.wav"), - ] - - HIGH_SCORE_FILE = "high_score.txt" - - def __init__(self): - self.player = Player() - - self.fruits = [Fruit()] - self.bombs = [] - - self.effects = [ - [], # Blood splatter - [], # Blood splash - [], # Split Effect - [], # slash effect - [FadeInEffect(fade_time=1000)] # Fade in/fade out effects - ] - - self.combo_counters = [] - - self.score = 0 - - self.time_since_last_hit = 0 - self.current_combo = 0 - - self.wave = 1 - self.cleared_wave = True - self.wave_cooldown_timer = 0 - - self.game_over = False - self.game_over_time = 0 - - try: - with open(self.HIGH_SCORE_FILE, "r") as f: - self.high_score = int(f.read()) - except: - self.high_score = 0 - - self.music_started = False - if pygame.mixer.music.get_busy(): - pygame.mixer.music.fadeout(500) - pygame.mixer.music.load("assets/sounds/Of Far Different Nature - Friendly Trap (CC-BY).ogg") - pygame.mixer.music.set_volume(0.25) - pygame.mixer.music.play(-1) - self.music_started = True - - self.score_surf = font.render(f"SCORE {self.score}", True, WHITE) - self.score_txt = Texture.from_surface(renderer, self.score_surf) - - self.combo_surf = font.render(f"COMBO x{max(1,self.current_combo)}", True, WHITE) - self.combo_txt = Texture.from_surface(renderer, self.combo_surf) - - self.high_score_surf = font.render(f"BEST {self.high_score}", True, WHITE) - self.high_score_txt = Texture.from_surface(renderer, self.high_score_surf) - - self.title_surf = font_large.render("GAME OVER", True, WHITE) - - self.subtitle_surf = font.render(f"HIGH SCORE {self.high_score}", True, WHITE) - - self.game_over_surf = pygame.Surface((max(self.title_surf.get_width(), self.subtitle_surf.get_width()), - self.title_surf.get_height() + self.subtitle_surf.get_height())) - self.game_over_surf.fill(GRAY) - self.game_over_surf.blit(self.title_surf, self.title_surf.get_rect( - center=(self.game_over_surf.get_width() / 2, self.title_surf.get_height() / 2))) - self.game_over_surf.blit(self.subtitle_surf, self.subtitle_surf.get_rect( - center=( - self.game_over_surf.get_width() / 2, - self.title_surf.get_height() + self.subtitle_surf.get_height() / 2))) - self.game_over_txt = Texture.from_surface(renderer, self.game_over_surf) - - self.r1 = Rect(self.game_over_surf.get_rect(center=(WIDTH / 2, HEIGHT / 2)).inflate(50, 50), GRAY, 10) - self.r2 = Rect(self.game_over_surf.get_rect(center=(WIDTH / 2, HEIGHT / 2)).inflate(50, 50), BLACK, 10, 5) - - def update(self, delta): - for event in pygame.event.get(): - if event.type == pygame.QUIT or (event.type == pygame.KEYUP and event.key == pygame.K_ESCAPE): - if self.score >= self.high_score: - self.high_score = self.score - with open(self.HIGH_SCORE_FILE, "w") as f: - f.write(str(self.high_score)) - return COMMAND_EXIT - elif event.type == pygame.KEYUP: - if event.key == pygame.K_m: - if pygame.mixer.music.get_busy(): - pygame.mixer.music.pause() - else: - pygame.mixer.music.unpause() - if not self.music_started: - pygame.mixer.music.load("assets/sounds/Of Far Different Nature - Friendly Trap (CC-BY).ogg") - pygame.mixer.music.set_volume(0.25) - pygame.mixer.music.play(-1) - self.music_started = True - - if not self.game_over: - self.player.update(delta) - else: - self.game_over_time += delta - if self.game_over_time > self.GAME_OVER_TIME: - return COMMAND_START - - hits = [] - for fruit in self.fruits: - fruit.update(delta) - - hit_status = self.player.hits(fruit) - if hit_status and SplitEffect.should_split(fruit.fruit_txt, fruit.angle, fruit.position, - self.player.previous_mouse_pos, - self.player.mouse_direction, fruit.radius): - hits.append((fruit, self.player.mouse_direction, self.player.previous_mouse_pos)) - - if (((not -fruit.radius * 2 < fruit.position.x < WIDTH + fruit.radius * 2) or - fruit.position.y - fruit.radius * 2 > HEIGHT) and fruit.velocity.y > 0): - self.fruits.remove(fruit) - self.cleared_wave = False - - self.time_since_last_hit += delta - - if self.time_since_last_hit < self.COMBO_TIME: - self.score += self.current_combo - self.high_score = max(self.score, self.high_score) - self.score_surf = font.render(f"SCORE {self.score}", True, WHITE) - self.score_txt = Texture.from_surface(renderer, self.score_surf) - self.high_score_surf = font.render(f"BEST {self.high_score}", True, WHITE) - self.high_score_txt = Texture.from_surface(renderer, self.high_score_surf) - else: - self.current_combo = 0 - self.combo_surf = font.render(f"COMBO x{max(1,self.current_combo)}", True, WHITE) - self.combo_txt = Texture.from_surface(renderer, self.combo_surf) - - for hit, mouse_direction, mouse_position in hits: - color = random.choice(EFFECT_COLORS) - self.effects[0].append(BloodSplatter(hit.position, hit.radius, - determine_angle(hit.position, hit.position + mouse_direction), - color)) - self.effects[1].append(BloodEffect(hit.position, hit.radius, lighten(color, 0.15))) - - half1, half2, pos1, pos2 = SplitEffect.split_image(hit.fruit_txt, hit.angle, hit.position, mouse_position, - mouse_direction, hit.radius) - - n1, n2 = SplitEffect.find_normals(mouse_direction.normalize() * 5) - self.effects[2].append(SplitEffect(pos1, half1, hit.velocity, n1)) - self.effects[2].append(SplitEffect(pos2, half2, hit.velocity, n2)) - - pygame.mixer.Sound.play(random.choice(self.slash_sounds)) - - self.score += 1 - self.high_score = max(self.score, self.high_score) - self.score_surf = font.render(f"SCORE {self.score}", True, WHITE) - self.score_txt = Texture.from_surface(renderer, self.score_surf) - self.high_score_surf = font.render(f"BEST {self.high_score}", True, WHITE) - self.high_score_txt = Texture.from_surface(renderer, self.high_score_surf) - - if self.time_since_last_hit < self.COMBO_TIME: - self.current_combo += 1 - self.combo_surf = font.render(f"COMBO x{max(1,self.current_combo)}", True, WHITE) - self.combo_txt = Texture.from_surface(renderer, self.combo_surf) - if self.current_combo > 1: - self.combo_counters.append(ComboCounter(hit.position, self.current_combo + 1)) - - self.effects[3].append(SlashEffect(hit.position, hit.angle)) - self.time_since_last_hit = 0 - - if hit in self.fruits: - self.fruits.remove(hit) - - for layer in self.effects: - for effect in layer: - effect_status = effect.update(delta) - if effect_status: - layer.remove(effect) - - for combo in self.combo_counters: - combo_status = combo.update(delta) - if combo_status: - self.combo_counters.remove(combo) - - for bomb in self.bombs: - bomb_status = bomb.update(delta) - if self.player.hits(bomb): - bomb.explode(self.fruits, self.bombs, self.effects[2]) - self.set_game_over() - - if bomb_status: - self.bombs.remove(bomb) - continue - if (((not -bomb.radius * 2 < bomb.position.x < WIDTH + bomb.radius * 2) or - bomb.position.y - bomb.radius * 2 * bomb.RADIUS_FACTOR > HEIGHT) and bomb.velocity.y > 0): - self.bombs.remove(bomb) - - if len(self.fruits) == 0 and len(self.bombs) == 0 and not self.game_over: - self.wave_cooldown_timer += delta - if self.wave_cooldown_timer >= self.WAVE_COOLDOWN: - if self.cleared_wave: - self.wave_cooldown_timer = 0 - self.wave += 1 - self.cleared_wave = True - for i in range(self.wave): - if random.random() < self.BOMB_CHANCE: - self.bombs.append(Bomb()) - else: - self.fruits.append(Fruit()) - - def set_game_over(self): - self.game_over = True - - self.player.sliced_points.clear() - pygame.mixer.Sound.play(self.bass_sound_effect) - self.effects[4].append(FadeOutEffect(fade_time=self.GAME_OVER_TIME, max_alpha=20)) - - if self.score >= self.high_score: - self.high_score = self.score - with open(self.HIGH_SCORE_FILE, "w") as f: - f.write(str(self.high_score)) - - self.title_surf = font_large.render("GAME OVER", True, WHITE) - - self.subtitle_surf = font.render(f"HIGH SCORE {self.high_score}", True, WHITE) - - self.game_over_surf = pygame.Surface((max(self.title_surf.get_width(), self.subtitle_surf.get_width()), - self.title_surf.get_height() + self.subtitle_surf.get_height())) - self.game_over_surf.fill(GRAY) - self.game_over_surf.blit(self.title_surf, self.title_surf.get_rect( - center=(self.game_over_surf.get_width() / 2, self.title_surf.get_height() / 2))) - self.game_over_surf.blit(self.subtitle_surf, self.subtitle_surf.get_rect( - center=( - self.game_over_surf.get_width() / 2, - self.title_surf.get_height() + self.subtitle_surf.get_height() / 2))) - self.game_over_txt = Texture.from_surface(renderer, self.game_over_surf) - - def draw(self): - self.BACKGROUND.draw(None, (0, 0)) - - self.score_txt.draw(None, (7, 0)) - self.combo_txt.draw(None, (WIDTH / 2 - self.combo_txt.width / 2, 0)) - self.high_score_txt.draw(None, (WIDTH - self.high_score_txt.width - 7, 0)) - - for effect in self.effects[0]: - effect.draw() - for effect in self.effects[1]: - effect.draw() - for bomb in self.bombs: - bomb.draw() - for effect in self.effects[2]: - effect.draw() - for fruit in self.fruits: - fruit.draw() - for effect in self.effects[3]: - effect.draw() - for combo in self.combo_counters: - combo.draw() - for effect in self.effects[4]: - effect.draw() - - if self.game_over: - self.r1.draw() - self.r2.draw() - self.game_over_txt.draw(None, ( - WIDTH / 2 - self.game_over_txt.width / 2, HEIGHT / 2 - self.game_over_txt.height / 2)) - self.player.draw() diff --git a/main.py b/main.py deleted file mode 100644 index 2053bfe..0000000 --- a/main.py +++ /dev/null @@ -1,31 +0,0 @@ -from game import Game -from menu import Menu -from setup import * - -FPS = 60 -clock = pygame.time.Clock() - -scene = Menu() - -is_running = True -while is_running: - delta = clock.tick(FPS) - renderer.clear() - - status = scene.update(delta) - scene.draw() - - # fps_text = font_small.render(f"FPS: {clock.get_fps():.0f}", True, DARK_GRAY) - # fps_txt = Texture.from_surface(renderer, fps_text) - # fps_txt.draw(None, pygame.Vector2(10, 75)) - - renderer.present() - - if status == COMMAND_EXIT: - is_running = False - elif status == COMMAND_START: - scene = Game() - elif status == COMMAND_MENU: - scene = Menu() - -pygame.quit() diff --git a/menu.py b/menu.py deleted file mode 100644 index 21ac97b..0000000 --- a/menu.py +++ /dev/null @@ -1,149 +0,0 @@ -from setup import * -from player import Player -from fruit import Fruit -from effect import SlashEffect, SplitEffect, BloodEffect, FadeOutEffect, BloodSplatter -from rect import Rect - - -class Menu: - # Creating background image - background = pygame.Surface((WIDTH, HEIGHT)) - tile_cols = 4 - tile_rows = 4 - background_tile = pygame.transform.scale(pygame.image.load("assets/background.png"), - (WIDTH / tile_cols, HEIGHT / tile_rows)).convert() - for x in range(tile_cols): - for y in range(tile_rows): - background.blit(background_tile, (x * WIDTH / tile_cols, y * HEIGHT / tile_rows)) - bg_txt = Texture.from_surface(renderer, background) - - # Slash sound effects - slash_sounds = [ - pygame.mixer.Sound(f"assets/sounds/Swishes/long-medium-swish-44324.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swing-6045.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swish-sound-94707.wav"), - ] - - def __init__(self): - # Music - pygame.mixer.music.load("assets/sounds/Of Far Different Nature - Ethnic Beat (CC-BY).ogg") - pygame.mixer.music.set_volume(0.5) - pygame.mixer.music.play(-1) - pygame.mixer.music.pause() - - # Player - self.player = Player() - - # Fruit - self.fruit = Fruit() - self.fruit.position = pygame.Vector2(WIDTH / 2, HEIGHT * 1.5 / 2.5) - self.fruit.angle = 0 - self.fruit.image = pygame.image.load("assets/fruits/58.png") - self.fruit.fruit_txt = Texture.from_surface(renderer, self.fruit.image) - - # Effects - self.effects = [] - - # Text surfaces - self.title_surface = font_large.render("Fruit Shinobi", True, WHITE) - self.tutorial_surface = font.render("Drag to slice the fruit", True, WHITE) - self.controls_surface = font_small.render("Press M to unmute music", True, WHITE) - self.credit_surface = font_small.render("Made by: Skullheadx", True, WHITE) - - self.title_txt = Texture.from_surface(renderer, self.title_surface) - self.tutorial_txt = Texture.from_surface(renderer, self.tutorial_surface) - self.controls_txt = Texture.from_surface(renderer, self.controls_surface) - self.credit_txt = Texture.from_surface(renderer, self.credit_surface) - - # Rect textures - self.tutorial_surface_pos = ( - WIDTH / 2, HEIGHT * 2 / 3 + self.tutorial_surface.get_height() / 2 + self.fruit.radius + 30) - - self.r1 = Rect(self.tutorial_surface.get_rect(center=self.tutorial_surface_pos).inflate(25, 25), DARK_GRAY, 10) - self.r2 = Rect(self.tutorial_surface.get_rect(center=self.tutorial_surface_pos).inflate(25, 25), BLACK, 10, 5) - - self.r3 = Rect(self.title_surface.get_rect(center=(WIDTH / 2, HEIGHT / 3)).inflate(50, 50), GRAY, 10) - self.r4 = Rect(self.title_surface.get_rect(center=(WIDTH / 2, HEIGHT / 3)).inflate(50, 50), BLACK, 10, 5) - - # blacked out - self.blacked_out = False - - def update(self, delta): - # Event handling - for event in pygame.event.get(): - if event.type == pygame.QUIT or (event.type == pygame.KEYUP and event.key == pygame.K_ESCAPE): - pygame.mixer.music.stop() - return COMMAND_EXIT - if event.type == pygame.KEYUP: - if event.key == pygame.K_m: - if pygame.mixer.music.get_busy(): - pygame.mixer.music.pause() - else: - pygame.mixer.music.unpause() - - # Update player - self.player.update(delta) - - # Update fruit - if not self.blacked_out: - hit_status = self.player.hits(self.fruit) # Check if player hits fruit - # Check if fruit should split - if hit_status and SplitEffect.should_split(self.fruit.fruit_txt, self.fruit.angle, self.fruit.position, - self.player.previous_mouse_pos, self.player.mouse_direction, - self.fruit.radius): - # Split fruit - color = random.choice(EFFECT_COLORS) - n1, n2 = SplitEffect.find_normals(self.player.mouse_direction.normalize() * 5) - - self.effects.append(BloodSplatter(self.fruit.position, self.fruit.radius, - determine_angle(self.fruit.position, - self.fruit.position + self.player.mouse_direction), - color)) - self.effects.append(BloodEffect(self.fruit.position, self.fruit.radius, lighten(color, 0.15))) - half1, half2, pos1, pos2 = SplitEffect.split_image(self.fruit.fruit_txt, self.fruit.angle, - self.fruit.position, self.player.previous_mouse_pos, - self.player.mouse_direction, self.fruit.radius) - - self.effects.append(SplitEffect(pos1, half1, pygame.Vector2(0, 0), n1)) - self.effects.append(SplitEffect(pos2, half2, pygame.Vector2(0, 0), n2)) - self.effects.append(SlashEffect(self.fruit.position, self.fruit.angle)) - - # Play slash sound - pygame.mixer.Sound.play(random.choice(self.slash_sounds)) - - # cue fadeout - self.blacked_out = True - self.effects.append(FadeOutEffect()) - - # Update effects - for effect in self.effects: - effect_status = effect.update(delta) - if effect_status: - if isinstance(effect, FadeOutEffect): - return COMMAND_START - self.effects.remove(effect) - - def draw(self): - self.bg_txt.draw(None, (0, 0)) - - if not self.blacked_out: - self.fruit.draw() - - self.r1.draw() - self.r2.draw() - - self.tutorial_txt.draw(None, self.tutorial_surface.get_rect( - center=self.tutorial_surface_pos)) - - self.r3.draw() - self.r4.draw() - - self.title_txt.draw(None, self.title_surface.get_rect(center=(WIDTH / 2, HEIGHT / 3))) - - self.controls_txt.draw(None, self.controls_surface.get_rect(bottomleft=(10, HEIGHT - 10))) - self.credit_txt.draw(None, self.credit_surface.get_rect(bottomright=(WIDTH - 10, HEIGHT - 10))) - - - for effect in self.effects: - effect.draw() - self.player.draw() diff --git a/player.py b/player.py deleted file mode 100644 index ba3f230..0000000 --- a/player.py +++ /dev/null @@ -1,77 +0,0 @@ -import pygame.mouse - -from setup import * - - -class Player: - LIFE_TIME = 100 - - image = pygame.image.load("assets/knife.png").convert_alpha() - txt = Texture.from_surface(renderer, image) - - SIZE = pygame.Vector2(50* SCALE, 50* SCALE) - - def __init__(self): - self.sliced_points = [] - self.lines = [] - - self.previous_mouse_pos = pygame.Vector2(pygame.mouse.get_pos()) - self.mouse_direction = pygame.Vector2(0, 0) - self.slicing = False - - self.angle = 0 - - def update(self, delta): - pressed = pygame.mouse.get_pressed() - if pressed[0]: - pos = pygame.mouse.get_pos() - self.sliced_points.append((pygame.Vector2(pos), pygame.time.get_ticks())) - self.mouse_direction = pygame.Vector2(pos) - self.previous_mouse_pos - self.previous_mouse_pos = pygame.Vector2(pos) - self.slicing = True - else: - self.mouse_direction = pygame.Vector2(0, 0) - self.previous_mouse_pos = pygame.Vector2(pygame.mouse.get_pos()) - self.slicing = False - - - self.lines.clear() - if len(self.sliced_points) > 1: - for i in range(len(self.sliced_points) - 1): - self.lines.append( - (pygame.Vector2(self.sliced_points[i][0]), pygame.Vector2(self.sliced_points[i + 1][0]))) - - for i, val in enumerate(self.sliced_points): - pos, time = val - if pygame.time.get_ticks() - time > self.LIFE_TIME: - self.sliced_points.pop(i) - break - - def hits(self, fruit): - for line in self.lines: - v1 = pygame.Vector2(line[0]) - fruit.position - v2 = pygame.Vector2(line[1]) - fruit.position - v = v2 - v1 - r = fruit.radius - - if v.magnitude_squared() == 0: - continue - - discriminant = 4 * (v1.dot(v)) ** 2 - 4 * v.magnitude_squared() * (v1.magnitude_squared() - r ** 2) - if discriminant >= 0: - t1 = (-2 * v1.dot(v) + math.sqrt(discriminant)) / (2 * v.magnitude_squared()) - t2 = (-2 * v1.dot(v) - math.sqrt(discriminant)) / (2 * v.magnitude_squared()) - if 0 <= t1 <= 1 or 0 <= t2 <= 1: - return True - if (t1 < 0 and t2 > 1) or (t2 < 0 and t1 > 1): - return True - return False - - def draw(self): - renderer.draw_color = LIGHT_GRAY - if len(self.sliced_points) > 1: - for i in range(len(self.sliced_points) - 1): - renderer.draw_line(self.sliced_points[i][0], self.sliced_points[i + 1][0]) - renderer.draw_line(self.previous_mouse_pos, self.previous_mouse_pos - self.mouse_direction) - self.txt.draw(None, pygame.Rect(pygame.mouse.get_pos(), self.SIZE)) - diff --git a/rect.py b/rect.py deleted file mode 100644 index 7c0fbf6..0000000 --- a/rect.py +++ /dev/null @@ -1,18 +0,0 @@ -from setup import * - - -def get_rect_txt(rect, color, border_radius, thickness=0): - r = pygame.Surface((rect.width, rect.height), pygame.SRCALPHA) - pygame.draw.rect(r, color, (0, 0, rect.width, rect.height), border_radius=border_radius, - width=thickness) - return Texture.from_surface(renderer, r) - - -class Rect: - - def __init__(self, rect, color, border_radius=0, thickness=0): - self.position = pygame.Vector2(rect.x, rect.y) - self.texture = get_rect_txt(rect, color, border_radius, thickness) - - def draw(self): - self.texture.draw(None, self.position) diff --git a/setup.py b/setup.py deleted file mode 100644 index 0c2aced..0000000 --- a/setup.py +++ /dev/null @@ -1,103 +0,0 @@ -import pygame -from pygame._sdl2 import Window, Renderer, Texture, Image -import random -import os -import math -from functools import cache - -pygame.init() -WIDTH, HEIGHT = pygame.display.Info().current_w, pygame.display.Info().current_h -display = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN) -window = Window.from_display_module() -renderer = Renderer(window) -pygame.mouse.set_visible(False) - -SCALE = pygame.Vector2(WIDTH / 1536, HEIGHT / 864) - -pygame.display.set_caption("Fruit Shinobi") -icon = pygame.image.load("assets/logo.ico").convert() -pygame.display.set_icon(icon) - -# fonts -font_small = pygame.font.Font("assets/font/go3v2.ttf", int(30 * SCALE.x)) -font = pygame.font.Font("assets/font/go3v2.ttf", int(60 * SCALE.x)) -font_large = pygame.font.Font("assets/font/go3v2.ttf", int(100 * SCALE.x)) - -# colors -WHITE = (255, 255, 255, 255) -LIGHT_GRAY = (211, 211, 211, 255) -GRAY = (128, 128, 128, 255) -DARK_GRAY = (25, 25, 25, 255) -BLACK = (0, 0, 0, 255) - -RED = (255, 0, 0, 255) -GREEN = (0, 255, 0, 255) -BLUE = (0, 0, 255, 255) -ORANGE = (255, 165, 0, 255) -YELLOW = (255, 255, 0, 255) -PURPLE = (128, 0, 128, 255) - -BROWN = (139, 69, 19, 255) -DARK_BROWN = (119, 49, 0, 255) - -DARK_RED = (139, 0, 0, 255) -DARK_GREEN = (0, 100, 0, 255) -DARK_BLUE = (0, 0, 139, 255) -DARK_ORANGE = (255, 140, 0, 255) -DARK_YELLOW = (255, 215, 0, 255) -DARK_PURPLE = (75, 0, 130, 255) - -EFFECT_COLORS = [ - (252, 166, 168, 255), - (247, 203, 168, 255), - (203, 172, 239, 255), - (160, 247, 208, 255), - (222, 244, 141, 255), - (205, 255, 135, 255), - (174, 252, 201, 255), - (247, 167, 111, 255), - (225, 162, 239, 255), - (209, 239, 119, 255), - (211, 255, 178, 255), - (119, 249, 215, 255), - (252, 113, 146, 255), - (204, 247, 160, 255), - (247, 161, 148, 255), - (218, 186, 255, 255), - (112, 239, 116, 255), - (237, 186, 125, 255), - (198, 202, 255, 255), - (197, 252, 174, 255), -] - - -def darken(color, factor=0.5): - r, g, b, a = color - return r * factor, g * factor, b * factor, a - - -def lighten(color, factor=0.5): - r, g, b, a = color - return min(255, r * (1 + factor)), min(255, g * (1 + factor)), min(255, b * (1 + factor)), a - - -# commands -COMMAND_EXIT = 0 -COMMAND_START = 1 -COMMAND_MENU = 2 - - -def lerp(start, end, weight): - return weight * (end - start) + start - - -def clamp(value, minimum, maximum): - return min(maximum, max(minimum, value)) - -def determine_angle(pos1, pos2): - pos1 = pygame.Vector2(pos1) - pos2 = pygame.Vector2(pos2) - if pos1.x == pos2.x: - pos2.x += 0.0001 - a = math.degrees(math.atan((pos2.y - pos1.y) / (pos2.x - pos1.x))) - return a -- 2.54.0