From 6719525d1be4f2e14c0e512131b96bdca869df66 Mon Sep 17 00:00:00 2001 From: Mateusz Tylka Date: Fri, 3 Apr 2020 19:56:03 +0200 Subject: [PATCH 1/3] gitignore --- .gitignore | 1 + src/.gitignore | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore index 85e7c1d..78b759b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /.idea/ +__pycache__ diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..78b759b --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,2 @@ +/.idea/ +__pycache__ From 9f95091ff67ddcb3a0cf96822defa153612ce97e Mon Sep 17 00:00:00 2001 From: Mateusz Tylka Date: Fri, 3 Apr 2020 19:57:44 +0200 Subject: [PATCH 2/3] gitignore --- src/.gitignore | 2 -- src/game/__pycache__/EventManager.cpython-36.pyc | Bin 669 -> 0 bytes src/game/__pycache__/Game.cpython-36.pyc | Bin 1712 -> 0 bytes src/game/__pycache__/Map.cpython-36.pyc | Bin 1256 -> 0 bytes src/game/__pycache__/Screen.cpython-36.pyc | Bin 1570 -> 0 bytes src/game/__pycache__/TerrainTile.cpython-36.pyc | Bin 955 -> 0 bytes 6 files changed, 2 deletions(-) delete mode 100644 src/.gitignore delete mode 100644 src/game/__pycache__/EventManager.cpython-36.pyc delete mode 100644 src/game/__pycache__/Game.cpython-36.pyc delete mode 100644 src/game/__pycache__/Map.cpython-36.pyc delete mode 100644 src/game/__pycache__/Screen.cpython-36.pyc delete mode 100644 src/game/__pycache__/TerrainTile.cpython-36.pyc diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 78b759b..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/.idea/ -__pycache__ diff --git a/src/game/__pycache__/EventManager.cpython-36.pyc b/src/game/__pycache__/EventManager.cpython-36.pyc deleted file mode 100644 index 0311caa42beca3eeed7e6390cdb6e675d702e286..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 669 zcmZut&5G1O5U%R(%)}upUW8RV3jr|)PlCvTe|XptQ4s>##B@8Gn90s`C*#gAo_4`! z@dbRCzIyT%JXw`taTYA7udA!Ss{X1T92`u3F28?71o#DeCMiB5_qPcQ7;GSi7hr^u z7hvSM$kE^%NY!t8hiS=pX@Y_ya({=w0x=;M293CYTpDQR0QR1^EsdJ?bWB+mfa6<5%K>#%uY_{Hv3w+ z-e<|bH!#7?tt*4< zGpA|9v$v!{>oC!Jero!L<3#IaUo^WHH>O_hI>Wzzhlqc1ya`t38Dfm(kRiD&WQhM) Q7UD;{-yZWuho#5zFFy8_YybcN diff --git a/src/game/__pycache__/Game.cpython-36.pyc b/src/game/__pycache__/Game.cpython-36.pyc deleted file mode 100644 index 24e8dca6492340b38b809afe25befd58190a7267..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1712 zcmZt`$!^<5bcVYm%9icKjUIi>B0%aIL2ai%0wf)vA;uco8ipd7;m8Z2 zoD`s^9{L&mp&oecDZh|Y-y2$i3xveHdGq#d=DU8s`rrw*gfD{kLm#1?vqS;idp=P~k^^QR@p6J{tIq=DF|6u7 zfP`R>%o0>s?+LSoEgaY#;etD_aSr$_nNSeK4^!>KdIGE31FE145)%!&sQ0Hu$<>~= zguA5g=zMqF=r9F`Lmz0v1B>&PO+JDnkCzRk1oB%mG5FOlqBf0eo zsoj-z-ATJklYeg4pyP(y|i1l6a#!>%( z=HRAZy}tM)v$Vj+;FFJyMVrN@-b!zY4U^Gry$z=wuzFi;qC8-Or44#_0NcfQ1%YaA z9lxmW92Q*2{4AOj`KdgcE3Rdck4B@9G{Rmbxv1Aiqp{$ck6W2>y*}eIe_|9yX;tLR zdiG1bx35&8B9(l`UUVw6WEAaRN)5ii`UmV_z5O%?0?%ZP5tLVF&|6^E5B^85%;4-r zC0Be_J&KrjA#+h&)HcX6Z<@%nsczg0DfF~{^kSMstwuEAd0yz~B#C4m@#s8JT26Qt z6-vTrwu#<|sUEEIobl4+Tl;{G^rar&ZG1J)a|p9>OC@uyaA+F`vv1rCYFM!jrXK6$ zQa4^(sm6c$%v7au5=g!A+7y{1A#dhYU`Z#;Jy6BGY`E);q6@E0Mmcy0 zlN*;x;q*7YkSd3|u|CB56Ljh4A`^*H@G4+@h0GfpI8A^(J1mNFXg5xkWTz}_gKXtl z_xc2l`kSZ+p#AZi@wAvF;|rj zxy5k^2CAg9YhZl+wgEco- z{d+(zM=;DpA*88=Lk$>SZIZgFXReQ*25AR5Z>^W@$kXFtS7B^w2LKDFJQrDFo~laS zLXsmCzfjwT+qSEHxYQPspxRZL@hj$>X0jYog-@2LRtp~D@g9J0VO0SD0{M06fL`ad z>ca8R#bROS;<)L?@vIQ@4Dm3I-_Ci~a?}@K!5F;Z1e>FbCm*mLtO}w^EHD)4wizko;B&Dw!4GW;KVqjU O^bG+)lS61W{Purgf~)EP diff --git a/src/game/__pycache__/Map.cpython-36.pyc b/src/game/__pycache__/Map.cpython-36.pyc deleted file mode 100644 index e9f8b09d45b8129c2c3f916e811fe89ea9528fd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1256 zcmZuxO>fgc5Zzg?9Xm}!sS1>W5GSM{)F8MbR752>Kn1i?kOf#))=3;3JKc4fHcBp} z5=SJC95}-t;KVQ4E2o~h^~8+bic0N9Gk!BWvmf(j^KfyoI#ZuN{1uG-VP}SgcmqX0 zKqZ-kg!%O42@JT;fv}ZW1K|r`&zKa_K4j9KbKjP*%^J=T=CQ2?n1!84sW47=;v_=T zdy%!nJkCiM82D2ISCmniBjJq zvlYv{=T`|nkK%4GH};rZ#_5&j!pZWRDjZ`Sg^rSraXT2F;we;x&gG&q&@m#3)95Et zSI|Db-|S_Bs5y?+NH=A)*OYn^2YRIT;=M3II+|Lwn{<^X8tcOY;|4*T#(5ABKY9%n z1Lx#dgDR}?I$wes)S=ENHA*^7Xj5fq*eD)K!R&7Y`@iynl{p}HKi=^f%=rFy^zp*; z6+PBWOofDxTQ}j|ws%nJjq2h~p@~UC0%LP{1*te+(w6WS*Vg%uW$5LITv?WxlD4GC+6<7ur z?wrWv5)pEyS+*KBF-lz$1g07UgG`PR!nGjS9fe6bqpsmv#nNZCqXtsNp7dmiR87DI zcUcj@Ms$V;)I0tX>Ghre{};t&%|hYcE}lqn-y-j#EsXo9JlSJvB2B&LVw2VQKQ5^) AQ2+n{ diff --git a/src/game/__pycache__/Screen.cpython-36.pyc b/src/game/__pycache__/Screen.cpython-36.pyc deleted file mode 100644 index 7f4da67290f06a8576bacf363c8501eefbf1739c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1570 zcmZuxOK%%D5awfFmSx9HTSrb>psz!=2&#h%^imW~-PAE)t3{jw$sW4cENOc;t4GL{ z9SibFLHb+z2l``p?MZ*3m-d^L>=;ET%(uhga5$X##O<}U)?csw`2B6b*x&5N@SyKN z?2iD&6t7r9Us3VCNCaQlWFnPJygjBo<-cLdpNYiBEKnh4p%ycl1d1QAIGQ64>&4u8 zj|Ss@@qjaylj&**C_51Q6+p9uE0zewm3YJG5ar>ELsWpTuR;pxf}`AMJ;)`t(4cP! z*@f7*fGMA{luZ$5i$UYiM5BpXmR{*&F1Of>bJom*DJ!v~6vtvlJ45KvjCQWnt#Wm_ zy3)aQ?_n40ZR}es*Rc{R@@^}Nu|jg<%_NnHGVMA4yioP23r=-$a#}lYkoEPP?mYh& zU{DPfOB0cP4e>44I)UFWFG`(b&v`L;*5Gp&j4o)!g{rWlD!Xv2R@Z5sjp|}Ja1l-V zL#17N;kT%h+sv~nA6Hqe53|uvMPCmr+^q}y+32X4Xy^4aBu%1(;Zj?Gzd zmQ^^pYfavz^t+3^z8PJ(C{2q&QK#uDLf8!e;{k8sx4}1MOLpYs*3$dRGpC}_ptciV zo3?)oMe$2&BfAtpG`+)W@sgPbQ&C@AI;_Jk`M{eB_!2`!@2U%wf@uLTL?YOFwwthWAEwrMdHJ4t%UE25o;2y-b0gQV*kn8*-;fcwo%L}}}3%O7J81%iq z&IFSwFJZt%&B+{kTL=|3>8NN=aRt&YL>64+zH%=q|nx>1yDWZVI!^k2Y zZA5E^Y&qn55CL}}me}#`&BA*n@K#B@Qyz%ro6oU4Cuc*i)12ZURYO-YF~QdaUjUNu z;L*=bHNPZNlg~S7GNWMIkY#2b7}gvRhvq|=ou~1>8hTm`G0=QMKu0!S?+fXo?-zyo RfpWBT?TEKUBt5wv{|DuySUms$ diff --git a/src/game/__pycache__/TerrainTile.cpython-36.pyc b/src/game/__pycache__/TerrainTile.cpython-36.pyc deleted file mode 100644 index 1e1f00f988f3be38a5395e04ea8329916f4be285..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 955 zcmYjPy>HYo6u0xuUDB5JT0lVeTP_0(3)U2NizDPet!Pz5b}rY9S`_hxcVgkBaD_L8(x}Gke!mQ zoXnx*17R-nZVB@^k*@SQH}e^tlc|3Pk>p}ZtydT3YJt-If!~Jg6Cj*m#>`=qIkzNp znG4aL9ba;#3bDQvC0_))NPMxhcX0J@fF)^3PFgA{ypDkaq%VUOw9@IIycYGLiR1%D zJLDtaW3Y}G*g=jVCXol`P!9UI^*X1c@~Fei33w**AqzSRxsV_C`jZx8C#?&3+WO3Y zir#17F@bwFLEjUw6M4EPpE3fig%{hy*(_y+DN?a2mRzScG()qBLQi)L0Y@`+dxi3W z_iXye`UVD~?O4}J7_L7GZEUbqRa0vl)Hlmw#cePcZ7}bhY?S9>Eli$U5A6!)Z$l>3 z8l)^9s(4?Oj4SKOO02VFSI|!B_b%2etAbgl(l%UF>kU`N#+sXaQI(bY#&2x21WECQ zv0jh#+EUPB$#b#g)4+O~mtWNZHuML)PPJO3*i*W659$Io5T=InfvJu1d{wcgL>}k)_ogTZOaDz@>K>fKhsp)OZPhsIi1zX{P$RUR hAfR525n=@N-^+pBD@ Date: Fri, 3 Apr 2020 20:23:36 +0200 Subject: [PATCH 3/3] refactor TerrainTile --- src/game/Game.py | 2 +- src/game/Map.py | 9 ++++----- src/game/TerrainTile.py | 7 ++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/game/Game.py b/src/game/Game.py index 1df88e4..6e6e8e4 100644 --- a/src/game/Game.py +++ b/src/game/Game.py @@ -42,7 +42,7 @@ class Game: # Start Map implement self.mapDataFolder = path.dirname("../data/mapdata/") - self.map = Map(path.join(self.mapDataFolder, 'map.txt'), self, self.screen) + self.map = Map(path.join(self.mapDataFolder, 'map.txt'), self.screen) # End Map implement self.mainLoop() diff --git a/src/game/Map.py b/src/game/Map.py index 7ed7db2..7ea843a 100644 --- a/src/game/Map.py +++ b/src/game/Map.py @@ -3,8 +3,7 @@ from game.TerrainTile import TerrainTile from game.Screen import Locations class Map: - def __init__(self, filename, game, screen): - self.game = game + def __init__(self, filename, screen): self.screen = screen self.terrain = [] self.entities = [] @@ -25,10 +24,10 @@ class Map: for row, tiles in enumerate(self.terrain): for col, tile in enumerate(tiles): if tile == 'w': - self.screen.draw(TerrainTile(self.game, col, row, 'wall.png', self.screen.mapSize), Locations.MAP, col, row) + self.screen.draw(TerrainTile(col, row, 'wall.png', self.screen.mapSize), Locations.MAP, col, row) if tile == ',': - self.screen.draw(TerrainTile(self.game, col, row, 'floor.png', self.screen.mapSize), Locations.MAP, col, row) + self.screen.draw(TerrainTile(col, row, 'floor.png', self.screen.mapSize), Locations.MAP, col, row) if tile == '.': - self.screen.draw(TerrainTile(self.game, col, row, 'grass.png', self.screen.mapSize), Locations.MAP, col, row) + self.screen.draw(TerrainTile(col, row, 'grass.png', self.screen.mapSize), Locations.MAP, col, row) diff --git a/src/game/TerrainTile.py b/src/game/TerrainTile.py index dcebdc8..c541760 100644 --- a/src/game/TerrainTile.py +++ b/src/game/TerrainTile.py @@ -4,11 +4,8 @@ from os import path class TerrainTile(pygame.sprite.Sprite): - def __init__(self, game, x, y, texture, mapSize): - self.tiles = [] - self.groups = game.spritesList - pygame.sprite.Sprite.__init__(self, self.groups) - self.game = game + def __init__(self, x, y, texture, mapSize): + super().__init__() self.imagesFolder = path.dirname("../data/images/") self.terrainFolder = path.join(self.imagesFolder, 'terrain') self.image = pygame.image.load(os.path.join(self.terrainFolder, texture)).convert()