From 1c14696f4f894128cd70225f190da17988e42189 Mon Sep 17 00:00:00 2001 From: s450026 Date: Mon, 6 Apr 2020 22:10:21 +0200 Subject: [PATCH] Add chairs and wall graphics --- main.py | 35 ++++++++++++++++++ resources/images/chair-back.png | Bin 0 -> 3148 bytes resources/images/chair-front.png | Bin 0 -> 3543 bytes resources/images/chair-left.png | Bin 0 -> 2857 bytes resources/images/chair-right.png | Bin 0 -> 2842 bytes resources/images/wall.png | Bin 0 -> 4902 bytes resources/simulations/simulation_1.txt | 15 ++++++++ resources/simulations/simulation_2.txt | 8 +++++ resources/simulations/simulation_3.txt | 2 ++ src/__pycache__/graphics.cpython-37.pyc | Bin 0 -> 1790 bytes src/__pycache__/matrix.cpython-37.pyc | Bin 0 -> 1942 bytes src/__pycache__/tile.cpython-37.pyc | Bin 502 -> 602 bytes src/__pycache__/waiter.cpython-37.pyc | Bin 0 -> 1272 bytes src/graphics.py | 36 +++++++++++++++++++ src/matrix.py | 45 ++++++++++++++++++++++++ src/tile.py | 18 +++++++--- src/waiter.py | 32 +++++++++++++++++ 17 files changed, 187 insertions(+), 4 deletions(-) create mode 100644 main.py create mode 100644 resources/images/chair-back.png create mode 100644 resources/images/chair-front.png create mode 100644 resources/images/chair-left.png create mode 100644 resources/images/chair-right.png create mode 100644 resources/images/wall.png create mode 100644 resources/simulations/simulation_1.txt create mode 100644 resources/simulations/simulation_2.txt create mode 100644 resources/simulations/simulation_3.txt create mode 100644 src/__pycache__/graphics.cpython-37.pyc create mode 100644 src/__pycache__/matrix.cpython-37.pyc create mode 100644 src/__pycache__/waiter.cpython-37.pyc create mode 100644 src/graphics.py create mode 100644 src/matrix.py create mode 100644 src/waiter.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..016ffe0 --- /dev/null +++ b/main.py @@ -0,0 +1,35 @@ +import sys + +from src.graphics import * +from src.waiter import * + +if __name__ == "__main__": + # SETUP + pygame.init() + clock = pygame.time.Clock() + fps = 40 + graphics = Graphics() + waiter = Waiter(graphics) + + # init functions + graphics.drawBackground(waiter.matrix) + graphics.update(waiter.X, waiter.Y) + + while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + sys.exit() + break + + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: + pygame.quit() + sys.exit() + break + + graphics.clear(waiter.X, waiter.Y) + waiter.update(event, graphics) + graphics.update(waiter.X, waiter.Y) + pygame.display.flip() + clock.tick(fps) diff --git a/resources/images/chair-back.png b/resources/images/chair-back.png new file mode 100644 index 0000000000000000000000000000000000000000..45ddf0df44a67abcdce25b18b3b929c47da1b24a GIT binary patch literal 3148 zcmY+FcQhN07RM8Wn59C^M(q+c(xOzXh*2?XNA1}A*P`~SNTn@B?a>;g#t%`e_G--< zRkdpGQhNk_`rbRgciuhcd%vG^&-ea&Z>*kE`KU=w)N)pzh$|;Nxs(psoS{$Px%fmQGwo5JZEoBOm{Oq1)}~ zzuqa*3(&tZzMV^~51pQt_DI&0p5R@zKinEf`8*&CZ#d7@RnrTSTu+B|G}naj2p?RT zL=eT3Xapukd4v(f<4C>LX9XLn^6*sW`idEct)RWk?X1A9I>&9$YF)8uay$gcnpP%u zO={jZ<^@hc^kq~`&Na$h6Mb$`%OY(uX8{70p(>WDh+cp>3?yXMId+zOpgQ?kwsBIezN%W4u%A9`3 z{o;gd)ERi*)jjwF*X(3+dOVXN<;$s=wDJO`Z6u~-lB&2VJFm1FeBj(#!(gB6 zyFb^0R`;Tk#i-8mUnfSgbVTApb5Y8NEAtl>Q(BDV>@FNjnxVH6-ZEH-FIc)4tPb9% zyCyRVz0bOF8g7vD8(H9z^1Xf>L3cu|ZhhlKzjNSPP$p=$tv=sc7P~i zAA^Wst>id+Ucx%!u=73|W5=u*0+S(A6lCYQ`aN>+p_JxfytfpPHvoSRefWy2lG%Ry zbX?0#?cqI{vGb2{aD#$$wduRWh8*kPa1m{c;kObP!-uDQy*Ei9%f_=Vs|w5-Oh*61 zJbPxn$-s%#$;O$~q3D@Q-fZZi$xe+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9d{}7t*44mTK|bPFTjYo zU-94gd*irGp;0i-Y9@+3w^ud1_LtrlnzIhIlX-tiJQ4{|s){vhiTC$^NI$WGZC5$3 z{9ZC-U@23+0XIm@LwS^GJgCjYwF|YtGLlKKMcm3VOJ>-b1$YRf(PjPU?qlJwGRd;A z?UMFEFXL88bqgW60wW6LnAvZrB95dTZ61;uyUjsNK2DOMitcQpm(aeO#SXlhty}8_ ztDNvace7#M49ibpdS%fq zx%a3Kuzks!TFSwa`R!nFr{&U7hs}`jL#~WIbkAI+%~hec%E>&I?l+WVz}J$2K-c$+ z0q?5G(zF(805`|=v14SQov)0Gud6rz9G!(0e*+O z6byjK{x;N5G^ZPFACLOeq5FQJ)aANwM-^Mtu-r?8{v)gU_sC;%=cvNn=?C(ol}8K! zjAxQQW=3Rg{23C@b*DvSC^4LUZY`t83?2lO1WWK?Ton{P_@T!JCrGwYo=9_W>au3y)qa?(9?C=wL_9pL&sZ&qIcF zS^DziAkKHS9nA+zi|8Oz*7_GV?b0SSG>e6xuX=dST970ibz{^*qX}L@cAloJyq0EQ zzUi;hxnWf*Zl*KWI4}2e`K-4(vqsV%XBnaS{xwVWoQWJ3eR&MBz4Q$UaGHexTonzx zlr&QSJw6_eNeP@z?RI=twLK>%#3`qK-_i^wZaHkp?@%zH6Q_fjw@`>}*H&t6IJ$q- f{LOMDH2Sy9#LZ3<_RM1BpHHl*rh_a~v5xo`K=Z&X literal 0 HcmV?d00001 diff --git a/resources/images/chair-front.png b/resources/images/chair-front.png new file mode 100644 index 0000000000000000000000000000000000000000..60b141be0075a2951ac8490404b693f8c4d03555 GIT binary patch literal 3543 zcmV;|4Jh)7P)Hg1+lHrgWSWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6 zwD^Ni=!>T7nL9I?X}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8re zhoBb*p;u8ID_yBf0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs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&iJx&5dCu{i{3o~v zE84*f3d1wfM*be+_~fpoVQzd6TgWTe(f%ff=!u_k6)_;1hmfMTqGV8Qu$t1DGZc`e zA{N~U#Ek`zx?M$3nixwyOc3`T@m;tatKG)oR3(Yg|A9;8?S5$n>F&_KIpIv(A~c7qeIyJrQkSk!56(CX;_@ITb(*tmu%ukTt(pU{kr8ifBk#8 zdDDg9xV*%6+JPtt<;7s!F$SoB>$zgPEwF=AQ1zg|XE{yaP^s(}=$620q8e9hMO@b` z{^Q{2hhn zJUL9M>KkL$;#7BBMaV!^6RNQYmvwC>fiQ)pkOXp89@mQR7Ol!7(DdEXsVRF1r;sls zuFd6M${=^=0M}1RrDfH3OS|v(s3v@g@36r*r)Fep&XAkyp3EXIX&@PAZ7r?CCBgfm zF>2ww7DgEr0rbZ~H^&Nay+fzfXT z-mQuQPTN|+J<{b9Nk0lXwIYmau_>~GyM7aYy(RGf;OPADv=|O}Y+&p%cuomI~oCj$TZ+RBfviH+mI{ZK6;@0^fKX6`ndW)-hJ6AU^||G+;9FS`I9 z9C!Z4D`^WndaZMOj)Whhf_`>1U>gMZ&4G?kChu8m_m>BOh_6c!4%5L>2o)yNb4RM&JJr`oA6_R9G4& Rx3d5M002ovPDHLkV1loatMvc? literal 0 HcmV?d00001 diff --git a/resources/images/chair-left.png b/resources/images/chair-left.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d2f1716030111b887b4ff8d2553ad1d6dc749d GIT binary patch literal 2857 zcmV+^3)b|BP)Hg1+lHrgWSWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6 zwD^Ni=!>T7nL9I?X}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8re zhoBb*p;u8ID_yBf0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J z`jH<$>RKN5V(7OqK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYv zwjAKwmYb0gKL(K8-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Ph=gO-QG`q?L*cewH77o(pT1Cgo4DFQBxm^t>3YWw$i8+Tr* z9>rW?_U`qp6jsJkpioIUd0tLLaT$)BRH}M|8RkLNdo&^c zvrZV+ck8FM&4xyeJ2F)dHJ2MQ6V8*^l6^iel^4sOv81O}sDIn4?0nQ8nBZ5X)A@Io sXBR$ZZ_GuR{&cId_00s||G!@S2Z87?A${o)Gynhq07*qoM6N<$g8vjVRR910 literal 0 HcmV?d00001 diff --git a/resources/images/wall.png b/resources/images/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..5fd1323ffbf1dd35154f1552a1aab8f68846da01 GIT binary patch literal 4902 zcmYLMbx;(5v%Wj&?vw^44vK{l3}xc4q(DosE61sf3S1g988n@Ku!Mwf{2zKVV_}&GgbSbpQYwwWFNeYiBtn zId>O#FC7m{Yg;8-H(M`9Yi%W206;V`5o+r26iO!5?rqP)I;P_y80k|cjn9UkswY_3 z*cQ69BshmNhsgD$ssksHN~ah;J{Ktgo{Yad#|@tNTQ?NFYx+w3_4WDDJGLBX{7&35$~3-cFw#& z!)d=_XS2vE_svp4oyU>oL%wUbL*$uj@2BzXd@1;mrO7Rq5Zm?|q))BleZJxy*1EH6 zaMRP(#f;n(Vrh)zpUXKl2;w7o6XYUh1uDO!>T?`Z$TnQ~47|=AGcK|{q|-fLS&`bG z*X`TaEM#NxX4J4)K^E{RjI#_Z82k>be@WcH7f(6~r_T2E?obThB&qF^Q=GI#$a zK|mXktFZL4vAw|JQGiq3MCUsaOwbg?GR$#{ZrXA8)x6GR7c2s4TBrWdrayLVe!YLk zf5COzmO?d%b$^fs29nTPTey#s==P3ow%n~=dvD5mIT&O(E#|h5KT7^qZ7S7@rbd`EBWG_X zri?0TK>eMAPV|DS5iR=B@_EvEE`K{AsWFdI-Ys4iO8VsBmS_E4BOv2xSok*&X= z%w=@ZGx$RNVmDoiauDw7%;mvF=MBGK$o0rrWZ zz=HfB=o1s%qrbbt#nwQ@PD2C0`B!5B(10`m^uG%D7g9jl|7t}b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^i#vykc>B)O9F|`zwcRXMS*;tLB*WTjoVD}* zpmri_+v9xL826%ZvzN!6q#5@bX%sFmEictF)uOhFzc#C|u_tVv!;5p_ z-uS|5>@O{8wJmj8z&qXY3~v)Mvjc8+)@{PC4C_KoAu{bACo*p-N==JaoHSdxs$vsV zkE2dI1k@ikTfU=a$%3C~J~H$ga?5F+5U1Neitj+nh$_Z6_#-eip1J0T&<2$Y4O%Do zDR|0q6pzV*r#5s4`jdiPpm-#*xU@MkGl&4PVi2%1fmDD520<}TARdtX8nH_xp8|i= zkeM?ylHtdxU;V}~RjDW!zp9;lG>8>Nt1DY;`>XHw>e_C{BQ3VVw`*^9)V&f4KW?sX z>}Y2z-2Fh9F?3P7z1$FO820UwMmIi+@t^ACUmnG9Afr6K4=B5fiSa7Fxd|E1Ub9-- z)_tMT9X+%Ix??&FyL~zAkX{YL&%>xwBBqW_xM~4@Z(U4%qUaSBy-Wp?2}~aMJWrT^ nzAzL7)98%Fve``MDY8>^!kGQfr}kcy@w}w6%P42hsycrF8Br6_ literal 0 HcmV?d00001 diff --git a/src/graphics.py b/src/graphics.py new file mode 100644 index 0000000..dc2e0a8 --- /dev/null +++ b/src/graphics.py @@ -0,0 +1,36 @@ +import pygame + + +class Graphics: + def __init__(self): + self.image = { + 'floor': pygame.image.load('../resources/images/floor.jpg'), + 'wall': pygame.image.load('../resources/images/wall.png'), # + 'bar': pygame.image.load('../resources/images/table3.png'), # + 'bar_floor': pygame.image.load('../resources/images/waiter.png'), # + 'table': pygame.image.load('../resources/images/table3.png'), + 'waiter': pygame.image.load('../resources/images/waiter.png'), + 'chair_front': pygame.image.load('../resources/images/chair-front.png'), # + 'chair_back': pygame.image.load('../resources/images/chair-back.png'), # + 'chair_left': pygame.image.load('../resources/images/chair-left.png'), # + 'chair_right': pygame.image.load('../resources/images/chair-right.png') # + } + self.block_size = 50 + self.height = 15 + self.width: int = 14 + self.screen = pygame.display.set_mode((self.block_size * self.width, self.block_size * self.height)) + + def drawBackground(self, matrix): + for y in range(self.height): + for x in range(self.width): + self.screen.blit(self.image['floor'], (x * self.block_size, y * self.block_size)) + + for y in range(self.height): + for x in range(self.width): + self.screen.blit(self.image[matrix.get_type(x, y)], (x * self.block_size, y * self.block_size)) + + def clear(self, x, y): + self.screen.blit(self.image['floor'], (x * self.block_size, y * self.block_size)) + + def update(self, x, y): + self.screen.blit(self.image['waiter'], (x * self.block_size, y * self.block_size)) diff --git a/src/matrix.py b/src/matrix.py new file mode 100644 index 0000000..bd74866 --- /dev/null +++ b/src/matrix.py @@ -0,0 +1,45 @@ +from src.tile import Tile + + +class Matrix: + def __init__(self, graphics): + self.matrix = [] + self.set_default_matrix(graphics) + self.set_default_restaurant(graphics) + + def set_default_matrix(self, graphics): + for x in range(graphics.width): + self.matrix.append([0] * graphics.height) + + for x in range(graphics.width): + for y in range(graphics.height): + self.matrix[x][y] = Tile(type_='floor') + + def set_default_restaurant(self, graphics): + lines = [line.rstrip('\n') for line in open('../resources/simulations/simulation_1.txt')] + symbols = { + '_': 'floor', + 'W': 'wall', + 'S': 'table', + 'B': 'bar', + 'F': 'bar_floor', + 'P': 'chair_front', + 'O': 'chair_back', + 'I': 'chair_left', + 'U': 'chair_right', + 'X': 'waiter' + } + + for x in range(graphics.width): + for y in range(graphics.height): + sign = lines[y][x] + self.matrix[x][y] = Tile(symbols[sign]) + + def get_type(self, x, y): + return self.matrix[x][y].type + + def walk_through(self, x, y): + return self.matrix[x][y].walk_through + + def watch_through(self, x, y): + return self.matrix[x][y].watch_through diff --git a/src/tile.py b/src/tile.py index c63e8aa..25f107b 100644 --- a/src/tile.py +++ b/src/tile.py @@ -1,7 +1,17 @@ # TILE class Tile: - def __init__(self, type_, watch_through): - self.watch_through = watch_through - self.walk_through = 1 - self.action_required = 0 + def __init__(self, type_): self.type = type_ + + if self.type == 'wall': + self.watch_through = 0 + self.walk_through = 0 + elif self.type == 'table' or self.type == 'bar' or self.type == 'chair': + self.watch_through = 1 + self.walk_through = 0 + else: + self.walk_through = 1 + self.watch_through = 1 + + self.action_required = 0 + diff --git a/src/waiter.py b/src/waiter.py new file mode 100644 index 0000000..b6e1de5 --- /dev/null +++ b/src/waiter.py @@ -0,0 +1,32 @@ +import pygame + +from src.matrix import Matrix + + +# WAITER +class Waiter(pygame.sprite.Sprite): + def __init__(self, graphics): + pygame.sprite.Sprite.__init__(self) + self.X = 0 + self.Y = 0 + self.frame = 0 + self.matrix = Matrix(graphics=graphics) + + # Borders + def move(self, x, y, graphics): + if 0 <= self.X + x <= graphics.width - 1 and 0 <= self.Y + y <= graphics.height - 1: + if self.matrix.walk_through(self.X + x, self.Y + y) == 1: + self.X += x + self.Y += y + + def update(self, event, graphics): + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT: + self.move(-1, 0, graphics) + if event.key == pygame.K_RIGHT: + self.move(1, 0, graphics) + if event.key == pygame.K_UP: + self.move(0, -1, graphics) + if event.key == pygame.K_DOWN: + self.move(0, 1, graphics) + print(self.X, self.Y)