From 438e0652fc92110b704db7c00c0ee5e30f34ca83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E9=93=AD?= <2436077353@qq.com> Date: Fri, 31 May 2024 11:25:29 +0800 Subject: [PATCH] first commit --- pythonProject1/main.py | 1 + .../source/__pycache__/tools.cpython-312.pyc | Bin 3832 -> 4012 bytes .../__pycache__/brick.cpython-312.pyc | Bin 0 -> 1869 bytes .../__pycache__/info.cpython-312.pyc | Bin 5147 -> 5484 bytes .../__pycache__/player.cpython-312.pyc | Bin 11883 -> 12399 bytes pythonProject1/source/components/brick.py | 27 +++++++++ pythonProject1/source/components/info.py | 8 ++- pythonProject1/source/components/player.py | 20 ++++-- .../states/__pycache__/level.cpython-312.pyc | Bin 10138 -> 12387 bytes .../__pycache__/load_screen.cpython-312.pyc | Bin 1504 -> 2095 bytes .../__pycache__/main_menu.cpython-312.pyc | Bin 4827 -> 5429 bytes pythonProject1/source/states/level.py | 57 +++++++++++++++--- pythonProject1/source/states/load_screen.py | 17 +++++- pythonProject1/source/states/main_menu.py | 27 ++++++++- pythonProject1/source/tools.py | 4 ++ 15 files changed, 142 insertions(+), 19 deletions(-) create mode 100644 pythonProject1/source/components/__pycache__/brick.cpython-312.pyc diff --git a/pythonProject1/main.py b/pythonProject1/main.py index fc41857..8afba18 100644 --- a/pythonProject1/main.py +++ b/pythonProject1/main.py @@ -10,6 +10,7 @@ def main(): 'main_menu':main_menu.MainMenu(), 'load_screen':load_screen.LoadScreen(), 'level':level.Level(), + 'game_over':load_screen.GameOver() } game = tools.Game(state_dict,'main_menu') game.run() diff --git a/pythonProject1/source/__pycache__/tools.cpython-312.pyc b/pythonProject1/source/__pycache__/tools.cpython-312.pyc index 1a03e1b0a92016995aa12b1eecdf1f9cea027158..227cd4bf53c26587a43d9b65cf13f2a8c623c7e0 100644 GIT binary patch delta 645 zcmXYvOK1~O6o%)_E0avdB+WEULY@SvlSXUA2Q4Z^Bqb3<+!Yrwn8Ze#q})tEN{TM6 zh*1tcii>WAy3r!K5Z6WBL<=cnRj_+$4cOvF?@hgnZ_fSifBt)BnBDO6sP;kA92{Mk zoGNd>&=LYnV_G;2Gk9O{VbY<)Jhp`)d@1PsJdgK;{rJP_-W5tbZB7#2E`V4&5dckEN6=wMt{URJ80@3)ND-QY+Uju~xca5)V6< z8fJl*mfV~z7R(Z1vk^CiArLRCgUsY${ycS>rG`L-SS&^c*=d+!PMxH|hxP(oRA@9Q zBDc78)zuzf81Jf)Pikb{A6jxOI=cQ;$Dg{L#aCj|<8-%k3%RZ{)NzKMOszSG@tb%8 zX3-~|h4*+#It2#)m81AZ3j0irhW6L;|0i&FvzV9SxGPR?_#7Dd#n~{T z#FaJO*wFnCGk8YH$}XEWw&lkMN)qDuRyij3FEDUN8If($k)G~ZIbaX-kj9L9PMV7avf$G6FpvnM6c_!DfDA%(W2?1qpainGDWfo_orrcu5 zORXp=5(Ejdl@_EVmZTPe^cM*L2~DOVVUPqDNKJfk2~e__2`HeTP$UXcBMl^~xZM+T zQ}rNP`GEq(AwZ&m;RZK!Hl$tL;*_~B!auur?W6b1@tS*cP zCVykKWt5-1j$M9oFqkNxCdKn2U$5*Qo6EKPPP#(9$uu(>lHn%u)aol$493P+Fx z$lfAeAaRSOBr`c1>dYef$$cDhisB$Q?1Z?1Pw0-M{Ct_2GS?+FFG^}&mel^lz&80T zha&S;5zWcpI6T>S*?28Kh)j0n)MAvKT)=6{1~yxL@@h_PHda=n&jS3L?{La8G3rnL z#qG^%2Q*e=vlovJ6PpW=S!6W1hEI{z2go#?yohf$qwZuoelc#4sv?kJk@n1_tc-$1Ah!Yl6!dxA diff --git a/pythonProject1/source/components/__pycache__/brick.cpython-312.pyc b/pythonProject1/source/components/__pycache__/brick.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4304f25f85eda089bf1049902424b0b1fcf05ee5 GIT binary patch literal 1869 zcmZ`)O>7%Q6rQnnH|xYn)8Is@ah!k%(FRBf5)!H^B$_}-OQMMWNVslR#=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#w6PLp9q#W@umr0JuEBAZRc}H;CgjQ_7vROAa%Uv;$!T;OY8kgx?7E(JlO8@DWWc z-wn-Dc@&AGd`zFFQGQn6Nyqqgy+7sk1B28%CLs3EEVE&FTPaK~hCibTz8HS{P$y7a zdH#J1PXCv068(doe~U2;1_xbWs@2e$@M8GBn!c^3@2Li~Xe4rxF7(0aX1N6&Kc329 ze4tY&ONA^d33*P{d4F1oi#06g+Pcv=gP delta 1021 zcmZWn%}Z2K6o2=9&)0kN^-{;tM)2#Y$(UxNeNafz6xC+X7KMzynRqd3-ZxUpfDr`+ zQH#3>riHmQS26!UM7tnp5yo4D5EN327+bZebKWQjye9L&XXd@(cx#y#${k$5CN@v{&7 z1fLOD-fz@;g(@NM*t&d{m4Z#IRjO*6q;b6!F7lg%t&{FxIoNP<+%1hQ3Nby>0uC!` z#jLnxSch1L+|K6YfbI!L?lSz$CiYiOlV+Ay`bi7Bt{jcG!_kU#EtN_Qo4j3tOtg)? zQbu?)zhc16CQ=8Vc9v36ya_(XY4oIzrSJ=Ld3 zlzr0&$T*9IJKH?9c*#oSpjuC756gug5`($n81i3;Ker>gWzzm zr!apt_)LGSZ>jAc)%H(n3R-kOvPM>0;nd{mF<5L3B$_Ji0^1d5N_Lr!f=Rucl0BEd zS)dotf$xhB0GI;B+g-(3qQ(4dflk2A!50ow_9p0x7R}#T@p(m|iDPiq0Psn+Y_XTI zDo8sKKhqrtr#Enlb8U1K7165z8yq#zj%oAuKHxB6aM_ zsx;bQ;&U|pbPN`kqap_PA;<^{f{HK>;EMJyLVJZoyhA6;9JB*g}6e Sr=MfvMptNvjMg~-kNgk(p4YPg diff --git a/pythonProject1/source/components/__pycache__/player.cpython-312.pyc b/pythonProject1/source/components/__pycache__/player.cpython-312.pyc index a7ea98128dacec5b11cdf2e24effa00893fd549d..94888331f205e4418e20057a53d2a98a325edc53 100644 GIT binary patch delta 1052 zcmZvbUr19?9LIOIyE*UN{5N&(I^C8!uWo{rgkTZ`r7xpEqAZ;^@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T4F-5Z_z31m1Lg?vvzMZ+>~ec(W{wOi z5|z=SuUdhC8BT}$R9*G!v2h}+^Lfyso+*@d^Nb_vR6Db#vcam-2`vXgr;M7lQRp$S zP!GDnae1DD8EXi`3fUzGF9$9LZprZlIezt-n{pavZpoV$(#>gF$)-z-hKB6t0F->4sLW zxhjU)wnXR4JQD+XYF5j-$}jNA41XWa*Q0J&{x4}5R;}Hvr+ct*F}U@CR|s~3&p#yY zC%A@&#~SE3s=;fd!|X;f8`1ITla|KVKglFH$`akfkc(5@Gi2~_n8cznVbk~UIF|dI zTR_~q4J0|1OvlM6+nqKc7*pM``R~*B$W~6YA5UZJa=f-#!G;LQM5kb414SMvVxF4D z?r&lsq`tXKcA2mV>VVT6M4I*3(l_xHl z!lYQq+$L{h0aMHax7>Jm&_8a;X~-F6P&n=S&07dIleO+4*^>pTZ_s{%CHj)YV$b(| z17?2ji%I99iLO;!2ivRs#7=HG%v!eeL2-rI(w3$%KivhSjyPT{*i=E|Totc4sZi4L zhU+($H63|upPq#A2J5(3Z*+47%dUnS&axx@C)thu{)RZb4l5D%?Y7KJ492|w(g=>Q z?NMw`v>o9X!f^ylKRSkhUoM(Qm_#^%fClFTio|X|4&Vp@JCt=8;GD4Rk)=(`ZK9+s zhh<48%N?S`$^%W3D0MA|*@c0gnU$a@rCl04tc0A#oLQ=vWr)8;x#M`@jzA@NP#;1A z!qW)+*3ckLAfyqvkWX;5F78ixPs!A)MPrDbg9ZG!Sy_MwUWE{HPe|SoLQ6sd21`Qr Tj^Mu|1RjbuA?alSkrVw3d8z3g diff --git a/pythonProject1/source/states/__pycache__/load_screen.cpython-312.pyc b/pythonProject1/source/states/__pycache__/load_screen.cpython-312.pyc index 6d32d444ab9d6c48f0c7a730c7e1d7a722660b8d..7cca26d0cc98d3a1f553ee024dc37a7b71908b16 100644 GIT binary patch literal 2095 zcmd5-&2Jk;6rcU_N8*hW;#P5zHYP-XbFk=*x)n$e5e0#%1gOHbSXn!3;;*%tUAJ8; z2M#$nsFj02N;y$Z)XJg!A6y72s7j~nc z6zhhDg>oaMvRSq^4eH9Kaoctyw8e^cxna7BU9KC9Va%?)0lGcWl`W%IVi=@_nWa+C z*5Aw)KC}#G6>irH*BpJb$m-Wvqhjc`RcJc)X2bNvO9iXZV!BbV?4oU0g;ODAnvSc$ zGPB#$qrzwS3g%{A0rDB?Czm_&ovHrZ1(?)+VgaUTe{PXW=gz}4ag>F*=r)t8~hD|Uco zB{bUgxk}XMM)SVM0(yaGhx`{iXT{fs3rNN48pIgq9T;@Vc&|FxIdYCS3&UtXNQYdR zvf?c^4U!vbI@mIIR$;?4AbC`Uk zvv&9GBXzcWW9Pa5*)x1XFx-4lgOU1sOO z#n@F2TA%1)$cWP&9_twvmC7yK-u#9M$iFaOe zCp4|zpsgD6F-`llRjdtn7}{iLle_E@es~xIHZ?M)Cp@ z4(tkYcnOAxzK9%>BzzY9C;-s`AetTO;12!<^+vtfFb&hThMkJqyb<_WHg5D;y|^Y#laQ@eLhE{37F(fslj22CB1H=7MIuYgzO*U(L*Co|ND=Bm z#e*Q>9V+-2hzAe;5gxo)yo6Oj@ajR*gHRBh*>=S_%zQKR%{TAOyZZNv`>|Rr6R_=r zm40dv@&l8?*a80f{;U!v-N08pDMak?%<2!~fm#OQh48|8HQzhOytQ*`pW+TUA zS-F=)50hBLsmjkOZK&r0@;st{%1736lmwfhxGLQX(7{8i8F0T$O6fN;|Akb4vj%l0 I1YAD%7n53vv;Y7A diff --git a/pythonProject1/source/states/__pycache__/main_menu.cpython-312.pyc b/pythonProject1/source/states/__pycache__/main_menu.cpython-312.pyc index ab866129acb6916b58e576cc5914531f966b3cce..0516e0eaac6baac6cf4a43e1e14fe8f75af43cfa 100644 GIT binary patch delta 1482 zcmZWp&2Jk;6rWk|u6Nhojg#2L4Ys>+i4wbMs?ee~v;qPF39Pt~HlPLx%h;RNslPO9 zBgG0zBzj0CphP2-1N{Rq95_T&;#3KNgv5o2k6Md@kl<2@LvVx;aN)hRW7078{`Sqx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kz}fUrbYb}ZI>zwwSd8f;CbMwi;`y&Duj&q${`|Y z1Udm#l+$56i?Ag$h3xl=N?ro0nMEod2@QuV^)`I6w7?nxCM~gsEK9M5uS1IOMch(! zpH8H930sXt-OXkCQLw!}8Iisl 3000: + self.finished = True + self.update_game_info() + + else: + self.update_player_position() + self.check_if_go_die() + self.update_game_window() + self.info.update() + self.brick_group.update() + self.draw(surface) @@ -121,5 +150,19 @@ class Level: def draw(self, surface): self.game_ground.blit(self.background,self.game_window,self.game_window) self.game_ground.blit(self.player.image,self.player.rect) # 将背景与人物化境 + self.brick_group.draw(self.game_ground) + surface.blit(self.game_ground,(0,0), self.game_window) # 渲染 - self.info.draw(surface) \ No newline at end of file + self.info.draw(surface) + + def check_if_go_die(self): + if self.player.rect.y > C.SCREEN_H: + self.player.go_die() # 判断是否掉落屏幕外 + + def update_game_info(self): + if self.player.dead: + self.game_info['lives'] -= 1 + if self.game_info['lives'] == 0: + self.next = 'game_over' + else: + self.next = 'load_screen' \ No newline at end of file diff --git a/pythonProject1/source/states/load_screen.py b/pythonProject1/source/states/load_screen.py index 2f7244b..bd2280f 100644 --- a/pythonProject1/source/states/load_screen.py +++ b/pythonProject1/source/states/load_screen.py @@ -2,11 +2,13 @@ from .. components import info import pygame class LoadScreen: - def __init__(self): + def start(self,game_info): + self.game_info = game_info self.finished = False self.next = 'level' + self.duration = 2000 # 持续时间 self.timer = 0 - self.info = info.Info('load_screen') + self.info = info.Info('load_screen',self.game_info) def update(self,surface,keys): self.draw(surface) @@ -18,4 +20,13 @@ class LoadScreen: def draw(self,surface): surface.fill((0,0,0)) - self.info.draw(surface) \ No newline at end of file + self.info.draw(surface) + +class GameOver(LoadScreen): + def start(self,game_info): + self.game_info = game_info + self.finished = False + self.next = 'main_menu' + self.duration = 4000 + self.timer = 0 + self.info = info.Info('game.over',self.game_info) \ No newline at end of file diff --git a/pythonProject1/source/states/main_menu.py b/pythonProject1/source/states/main_menu.py index bf5d9d3..42ee015 100644 --- a/pythonProject1/source/states/main_menu.py +++ b/pythonProject1/source/states/main_menu.py @@ -7,10 +7,24 @@ from ..components import info class MainMenu: def __init__(self): + game_info = { + 'score':0, + 'coin':0, + 'lives':3, + 'player_state':'small' + } + self.start(game_info) + + + + + + def start(self,game_info): # 使其可以重复调用实现重置效果 + self.game_info = game_info self.setup_background() # 设置底图 self.setup_player() # 设置玩家 self.setup_cursor() # 设置光标 - self.info = info.Info('main_menu') + self.info = info.Info('main_menu',self.game_info) self.finished = False self.next = 'load_screen' @@ -42,6 +56,7 @@ class MainMenu: self.cursor.state = '2p' self.cursor.rect.y = 405 elif keys[pygame.K_RETURN]: + self.reset_game_info() # 按下回车重置 if self.cursor.state == '1p': self.finished = True elif self.cursor.state == '2p': @@ -57,4 +72,12 @@ class MainMenu: surface.blit(self.cursor.image,self.cursor.rect) self.info.update() - self.info.draw(surface) \ No newline at end of file + self.info.draw(surface) + + def reset_game_info(self): # 按下回车重置 + self.game_info.update({ + 'score':0, + 'coin':0, + 'lives':3, + 'player_state':'small' + }) \ No newline at end of file diff --git a/pythonProject1/source/tools.py b/pythonProject1/source/tools.py index 11eca67..173cac4 100644 --- a/pythonProject1/source/tools.py +++ b/pythonProject1/source/tools.py @@ -14,9 +14,11 @@ class Game: def update(self): if self.state.finished: + game_info = self.state.game_info next_state = self.state.next self.state.finished = False self.state = self.state_dict[next_state] + self.state.start(game_info) self.state.update(self.screen, self.keys) @@ -25,6 +27,7 @@ class Game: for event in pygame.event.get(): # 获取鼠标键盘事件 if event.type == pygame.QUIT: pygame.display.quit() # 退出游戏 + quit() elif event.type == pygame.KEYDOWN: # 按键按下 self.keys = pygame.key.get_pressed() # 按键状态 elif event.type == pygame.KEYUP: @@ -32,6 +35,7 @@ class Game: + self.update() pygame.display.update() # 更新屏幕