From f0f90daee007d1658c911c3b6a88f43bc4ed24f7 Mon Sep 17 00:00:00 2001 From: Arthur 'Grizzly' Grisel-Davy Date: Mon, 30 Mar 2020 23:03:42 -0400 Subject: [PATCH] Projectiles bleu se supprimes --- asset/asset.svg | 16 +++++++++--- asset/projectile_down.png | Bin 0 -> 514 bytes asset/projectile_left.png | Bin 0 -> 514 bytes asset/projectile_right.png | Bin 0 -> 525 bytes asset/projectile_up.png | Bin 0 -> 488 bytes models.py | 49 ++++++++++++++++++++++++++++--------- 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 asset/projectile_down.png create mode 100644 asset/projectile_left.png create mode 100644 asset/projectile_right.png create mode 100644 asset/projectile_up.png diff --git a/asset/asset.svg b/asset/asset.svg index f2a26f4..e2196d8 100644 --- a/asset/asset.svg +++ b/asset/asset.svg @@ -25,9 +25,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="2.8" - inkscape:cx="-990.35093" - inkscape:cy="138.68996" + inkscape:zoom="22.4" + inkscape:cx="-1033.5604" + inkscape:cy="234.95109" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -277,5 +277,15 @@ id="rect890" style="opacity:1;fill:#ff6600;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" transform="rotate(90)" /> + + diff --git a/asset/projectile_down.png b/asset/projectile_down.png new file mode 100644 index 0000000000000000000000000000000000000000..283bb721ead48d748f96f08d6eaaa6dadb5675f9 GIT binary patch literal 514 zcmV+d0{#7oP)cc3eu%? z4CV#@h0d;}3c*e6SSYR?B#TQ22gSijvIG&NbV?~`Yo40i3Q693*C8>GXRZC^QswipR(MoSoHi9F2%D zIr-A_JgeJn))HEi?R2{3Fzj-4v_}+$05lpuNT*-q6NzL#nRK?4wPbw%C%d~F0|+1p zI_&IxrrG?B2pI)rjA>xZ`K>z{bB-}SN|Eh@{$I}7Q>)bg$S7<74I1NP?f-9_Qhf9Z2+x+>cm9)POv|#D&XVv^lMyq^cFNS@`zk+9$;MnN+r8;b=6v~)wVe~`3^uT z^^AP}4X*oewNjDygQqAK?OPF+fH`{4asaGXD)JTJ8a-`~891A-$^ZZW07*qoM6N<$ Ef}pb85C8xG literal 0 HcmV?d00001 diff --git a/asset/projectile_left.png b/asset/projectile_left.png new file mode 100644 index 0000000000000000000000000000000000000000..04d38d45c0bab4f2a4efaddb323bd06b6fe89300 GIT binary patch literal 514 zcmV+d0{#7oP)k2_l!GyDr!nrZF`XFW z;<`OJPG$*MO#_MN*{Me3?$`eQPa2JfG!MpfFgiLzF4y{B1Yd-$%}pu2_9zkNkB|30 zgaF*%*Vx@%r(8Z9u$JX0Vmj@#q3i45L&%HbIO6K+lrU`4-du)cV5azLeWj@CKa+MeJ3QVWGH zlyX+yZ}J9|z^0Nweg~RBS%gz~4rLT^7KQ{nJCeHg6C8bq4wI2CXaE2J07*qoM6N<$ Ef?L7ktpET3 literal 0 HcmV?d00001 diff --git a/asset/projectile_right.png b/asset/projectile_right.png new file mode 100644 index 0000000000000000000000000000000000000000..f1b83f8581a383f043c27bc3f7c03f93e801079c GIT binary patch literal 525 zcmV+o0`mQdP)Q;kD<<9)M(lnoYBzwR#x@CxoHTU~qcrY5J3L z`7X8EV~Ry*%k$*L5UABMGg{LGnsFT6?{wY}hTpDS<~U<4FR$S^qxIb1!)mqt9N6gf zy0^OB9ir%a*3qPCOcV{6n5f>)udJ9Gg#vTHgR`^X(cxk5VGw*Z$H!kJP2)_+Zygq!!cQptZIe@G8y)M%J>5jGDF-m|~|4z1Nc36qm^EG|Cn z3}rMw-}Zr%Qt3`*dU~PU?|&kWqbnh{J<8Hji+ujtv&{E58fIOoWYhQigrQFuo?f_* z){07HidyZ7DHccCySwr#6STT&Zdw+u2(D$Fm(rN?VgefYD8jbq$yM79xNJ> P00000NkvXXu0mjf>}BLi literal 0 HcmV?d00001 diff --git a/asset/projectile_up.png b/asset/projectile_up.png new file mode 100644 index 0000000000000000000000000000000000000000..dcd5b48f957f9429edf3fc5e039896c758aae049 GIT binary patch literal 488 zcmVP)XHAJ7;9i+eO0FLWjx zc9@%6!Lq_>CBo|c{aF_RsMl*eJX|2cssbh|m2wyQOto4Dm{fpo7-mmsnl`|z0z9qV zp3rfk0FO%Kcc`_C2&MlndTkg*>wzEE2GH8Y_bDk6Jl7pzW@ZVcjE*Bh%+4;;-yb6g z@Qh?~t8N%Z%`~lHrBuxK-*B85iNrWVLy21vwcl)VB%ce}Y_JssY~J0S5(@P(Iy#LA zxqM!B0KOjZ{hb35-Xf8~b;}C3fISfkJ+DlqD(C6+^U?Rd>q{b$*rf=se?s6I{sDcT eYul#vz5f8@JZq*Tg`cSa0000 0.2): - new_proj = Projectile(name,2,(self.posx,self.posy),self.direction) + new_proj = Projectile(name,texture,2,(self.posx+int(self.img.get_height()/2),self.posy+int(self.img.get_width()/2)),self.direction) self.projectiles.append(new_proj) self.last_fire = time() @@ -74,15 +82,34 @@ class Perso(): class Projectile(): - def __init__(self,name,speed,position,direction): + def __init__(self,name,texture,speed,position,direction): self.name = name - self.img = pygame.image.load(name+'.png') self.speed = speed self.position = position self.direction = direction + if direction[0]!=0: + if direction[0]>0: + self.img = pygame.image.load(texture+'_right.png') + else: + self.img = pygame.image.load(texture+'_left.png') + else: + if direction[1]>0: + self.img = pygame.image.load(texture+'_down.png') + else: + self.img = pygame.image.load(texture+'_up.png') + def move(self): self.position = (self.position[0]+self.speed*self.direction[0],self.position[1]+self.speed*self.direction[1]) def draw(self,surface): - surface.blit(self.img,self.position) \ No newline at end of file + surface.blit(self.img,self.position) + + def is_out(self,surface): + if (self.position[0]<0-self.img.get_width() or + self.position[1]<0-self.img.get_height() or + self.position[0]>surface.get_width()+self.img.get_width() or + self.position[1]>surface.get_height()+self.img.get_height()): + return True + else: + return False