From 76d52c6847cd74def207255d2786979d80f76d28 Mon Sep 17 00:00:00 2001 From: STINKpython <121897714+STINKpython@users.noreply.github.com> Date: Tue, 3 Jan 2023 16:36:51 -0300 Subject: [PATCH] Add files via upload --- auxiliar.py | 45 ++++++++++++++++++++++ imegenes/soldier/run and point.png | Bin 0 -> 9453 bytes soldier_rifle.py | 59 +++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 auxiliar.py create mode 100644 imegenes/soldier/run and point.png create mode 100644 soldier_rifle.py diff --git a/auxiliar.py b/auxiliar.py new file mode 100644 index 0000000..35911bd --- /dev/null +++ b/auxiliar.py @@ -0,0 +1,45 @@ +import pygame + +class Auxiliar: + @staticmethod + def getSurfaceFromSpriteSheet(path,columnas,filas,flip=False, step = 1,scale=1): + + lista = [] + surface_imagen = pygame.image.load(path) + fotograma_ancho = int(surface_imagen.get_width()/columnas) + fotograma_alto = int(surface_imagen.get_height()/filas) + fotograma_ancho_scaled = int(fotograma_ancho*scale) + fotograma_alto_scaled = int(fotograma_alto*scale) + x = 0 + + for fila in range(filas): + for columna in range(0,columnas,step): + x = columna * fotograma_ancho + y = fila * fotograma_alto + surface_fotograma = surface_imagen.subsurface(x,y,fotograma_ancho,fotograma_alto) + if(scale != 1): + + surface_fotograma = pygame.transform.scale(surface_fotograma,(fotograma_ancho_scaled, fotograma_alto_scaled)).convert_alpha() + if(flip): + surface_fotograma = pygame.transform.flip(surface_fotograma,True,False).convert_alpha() + lista.append(surface_fotograma) + return lista + + @staticmethod + def getSurfaceFromSeparateFiles(path_format,quantity,flip=False,step = 1,scale=1,w=0,h=0,repeat_frame=1): + lista = [] + for i in range(1,quantity+1): + path = path_format.format(i) + surface_fotograma = pygame.image.load(path) + fotograma_ancho_scaled = int(surface_fotograma.get_rect().w * scale) + fotograma_alto_scaled = int(surface_fotograma.get_rect().h * scale) + if(scale == 1 and w != 0 and h != 0): + surface_fotograma = pygame.transform.scale(surface_fotograma,(w, h)).convert_alpha() + if(scale != 1): + surface_fotograma = pygame.transform.scale(surface_fotograma,(fotograma_ancho_scaled, fotograma_alto_scaled)).convert_alpha() + if(flip): + surface_fotograma = pygame.transform.flip(surface_fotograma,True,False).convert_alpha() + + for i in range(repeat_frame): + lista.append(surface_fotograma) + return lista \ No newline at end of file diff --git a/imegenes/soldier/run and point.png b/imegenes/soldier/run and point.png new file mode 100644 index 0000000000000000000000000000000000000000..c339a2f076c16d70501148ebba113bb307c1caf2 GIT binary patch literal 9453 zcmZ{KbyQSu)b1ffK$-!hksnfybc1vwNJ%%+ARyfcNH@~bAvJVLOR2*EO4k6=IdsQ& z{O(`(u65sa*2J2#-r4UyJD&aQ9i^_OfR9Us3jhGVlA^380HE1|pCz%ez*j-1eG%{t z%}rB58mJzj*#^I0x=AZ(V}r{d`&}deFaS!jQrg~M_HzOpsW)>ryZbKEpD8%6#a2=3 z8`!T-ET}7mdi-SSe2=nkZ6nA3=GW1=@V+kQ;4B(SU>hQnM3;zh?&1}^Xwo9?-qIr6 zsOM;ER{X2UHQQm;wtc!$>E{NFn6@GArAo9l^yHaSlryhC?Z}-Jf!r@oM*U)@(i5~u zR>;dh;oA|^6#~3Y0IdIKVGuUyI``K*&b)7VqV|el;_MxRXDyK+kJZsck?T-WWg)kkg^&J$yvbkHsX zX5{8}t?)+|MsB-{n9$MY`R(TA&U=KIRjMUCLiubxM z;4FL}2F#iaGGn{~W_FeCc}880a)}tvRL0x6BeO)!L7@e*-;`BQQBqOiYC_10S=r0% zs3iFL2aMW2Ja1c~@(>B7h1Y*SJ>?6Jh%j$5ID2f_FxzqEpG%304Bdst+*B+c$~$9! zk~Z&NqBqwU5E2ukac^Igis)NOwYrj|`I=pqm-X`Qy04-FciY`ySx5~$#^CWW55SP5 zxLgoHx8n=bOn#K|lgZK15gRyn;-i;Eh!{3#sE#*V7k#g@9C9J5*Z4Y4$&n5>k6(SC z8HFAUUnluPf6Fvzaw%cK3YnXJJ$g8JAnduP*Qm|@NtHPT00<&5W*y11N~2OzQoir( z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W%sw@xW=|U(u1MfiW;Q2 zf;Dfr`QP@v*ja-8UQr_K#>bo5?32RY7}=$3WOBqt929)2tCZnBZ}5?NOs*Hhvi&(f z6o2hK>s|lgvETT62SM>?yK&5x?|KJ+vsRZ?_;rXxrN`9u&EL5Boz-pz0hX6bpOVL8 zzbN&A0P{vng^5J7^5ZSa8s-J#BdP&ypJjW^!LmtU9=>r`}NyK7C0vbhPK_7JPVb9m4=o(FOcf?VnePS@JS=uG1Nt$ebad# z^}Z$nyj~q5hgwB_ld9s~YQn+IUL^XUA2JJF`8&yB+{~^H(*+zk6xS|pd@3iY=xAxl zoZT>1q$d1##kWRMD$jbs449`}^8QEgX|ARtmTg_0^#WnVBs)#~d5)~$7ytIQ*jWx( zuIi$#Z#pJ;BO~aUV|=P#GBb&r8~4s=7OBICO!AnzW|!j-JWmhl=sH?_Edv7smpTf9 z=sD6=I0c(KT~D_(o@Ks1pQ9EHdm^3SGm`Dh>5)H(rvCr34jL`t@sQ2*V)-r^#Nb zpy%{Zo?eI;Ka`PWXpC#1nS*`Jqcs#F_sA}b;8%St2rA-NpLQ>C;t>*_ge8Ix?25LL zgP>x=>mamRoBik1%Q`&OapaWK&`;%(WXBxuZhrR#v1jHdrP;4&Bemb2p##tQ=Y6P! zfIClL`82C?BMz0j`#_O@bv#AzApzY1J zk|(bPEWV&CFg`Tj#}Mt?Cl2j?Klc!up4Ni&hJiqTiEu#z^2a}^bKG})1z)yY1oL?wCtW9;E*Lej)PP76L3Ed5h#BugF9GcVs7E2z%uJp55__ z=0@>JJ~gJn!s>qIj5}+ifCR;6S G7V self.frame_rate_ms: + if(self.frame < len(self.animation) - 1): + self.frame += 1 + else: + self.frame = 0 + + def draw(self,screen): + + if self.live: + self.image = self.animation[self.frame] + screen.blit(self.image,self.rect) \ No newline at end of file