bombermaths.py

Created by rockingchair1196

Created on March 24, 2024

5.14 KB

Hello ! Moi c'est RockingChair, et je vous présente mon tout premier jeu sur calculatrice...

Bombermaths !

Toute ressemblance avec un autre jeu serait complètement fortuite.

 

En tout cas, j'espère que ce jeu vous aura plu, et si vous voulez observer mon code, vous pouvez regarder une autre version de mon jeu, avec un code bien plus clair, mais qui prend plus de place : Ici !

 

1.0 - Sortie du jeu !

 

1.1 - Première mise-à-jour, avec une amélioration du contenu, comme par exemple un menu modifié, des meilleures explosions, et des personnages plus faciles à distinguer, ainsi qu'un jeu plus facile à jouer pour le joueur 2... Mais aussi de majeures optimisations accompagnées de correction de bugs !


w='true'
v=range
g=round
m=.01
x=50
y=60
from kandinsky import fill_rect as A,draw_string as K,color as J,get_pixel as T
from ion import keydown as L
from time import sleep as H
from random import randint as z
A0=['fbff','f676','f3cf','fecf','efdd','fc3f','ff3e','6ecf','fbdf','fcff','bfbf','fbd7','e33e','7bb7','f37f','337f','fb3f','bbfb','f66f','fdcc','b77b','f333','9dff','ddbb','6bb6','37b7','cede','b7b7','fe3f','66ff','fbbb','7bbb','ffd9','b66b','26bb','f7cf']
def h(t,x,y,s,c):
  for B in v(len(t)):
    if not t[B]==' ':
      C=int(A0[int(t[B],36)],16)
      for D in v(16):
        if C%2:A(x+D%4*s,y+D//4*s,s,s,c)
        C//=2
    x+=s*5
i=100
Q=0
j=50
e=J(255,255,255)
B=J(0,0,0)
M=J(200,230,255)
N=J(255,0,0)
AB=J(253,54,49)
AC=J(128,16,12)
n=J(255,140,0)
o=J(60,179,113)
p=J(210,105,30)
I=J(255,142,41)
R=J(148,82,24)
k=J(150,150,150)
O=J(245,245,220)
f=J(85,85,85)
A1=J(0,150,0)
A2=J(0,128,128)
D=30
E=30
F=280
G=30
q=w
def A3():
  A(0,0,320,222,M);K('Les contrôles !',80,10,B,M);K('Joueur 1   -   Joueur 2',30,30,B,M);K('Flèches       x 3 Ans -',30,50,B,M);K('Shift             6',30,70,B,M);K('Appuyez sur OK pour démarrer',20,200,B,M);H(.2);C=0
  while C==0:
    if L(4):C=1;s()
def r():A(D-2,E-2,19,19,O);A(D,E,15,15,A2);A(D+3,E+6,3,3,B);A(D+9,E+6,3,3,B);A(F-2,G-2,19,19,O);A(F,G,15,15,A1);A(F+3,G+6,3,3,B);A(F+9,G+6,3,3,B)
def P(x,y):x=x*25;y=y*25;A(x,y,25,25,I);A(x+1,y+1,24,24,R);A(x+1,y+1,23,23,p);H(m)
def b(x,y):x=x*25;y=y*25;A(x,y,25,25,B);A(x+1,y+1,23,23,k);A(x+1,y+7,23,2,f);A(x+1,y+17,23,2,f);A(x+6,y+7,2,10,f);A(x+20,y+17,2,7,f);H(m)
def W(x,y,xfin,yfin,addx,addy,commande):
  while x!=xfin or y!=yfin:
    if commande==b:b(x,y)
    else:P(x,y)
    x+=addx;y+=addy
def s():
  A(0,0,320,240,O);W(13,0,0,0,-1,0,P);W(0,0,0,8,0,1,P);W(0,8,12,8,1,0,P);W(12,8,12,0,0,-1,P);B=3
  while B!=6:W(1,B,12,B,1,0,b);B+=1
  B=2
  while B!=10:W(2,B,11,B,1,0,b);B+=4
  B=1
  while B!=13:W(3,B,10,B,1,0,b);B+=6
  P(3,3);P(9,3);P(3,5);P(9,5);P(5,2);P(7,2);P(5,6);P(7,6);r();H(.5);AA()
X=0
Y=0
c=0
d=0
U=0
V=0
Z=0
a=0
def A4():global E,D,Y,X,U;U=1;X=g(D/25);Y=g(E/25)
def A5():global G,F,a,Z,V;V=1;Z=g(F/25);a=g(G/25)
def A6():global X,Y;C=X*25;D=Y*25;A(C+7,D+7,10,10,B)
def A7():global a,Z;C=Z*25;D=a*25;A(C+7,D+7,10,10,B)
def t():global U,V;U=0;V=0
def S(kx,ky):
  C='La partie est terminée !';A='false';global G,F,E,D
  if D+8>=kx and D+8<=kx+24 and E+8>=ky and E+8<=ky+24:I=A;t();K(C,45,110,e,B);K('Le joueur 2 a gagné !',55,125,e,B);H(2);J=100;L=50;D=30;E=30;F=280;G=30;l()
  if F+8>=kx and F+8<=kx+24 and G+8>=ky and G+8<=ky+24:I=A;t();K(C,45,110,e,B);K('Le joueur 1 a gagné !',55,125,e,B);H(2);J=100;L=50;D=30;E=30;F=280;G=30;l()
def A8():
  global Y,X,c,U;U=0;c=0;B=X*25;C=Y*25;A(B,C,25,25,N);S(B,C)
  if T(B-25,C)!=I:A(B-25,C,25,25,N);S(B-25,C);H(.1);A(B-25,C,25,25,O)
  if T(B,C-25)!=I:A(B,C-25,25,25,N);S(B,C-25);H(.1);A(B,C-25,25,25,O)
  if T(B+25,C)!=I:A(B+25,C,25,25,N);S(B+25,C);H(.1);A(B+25,C,25,25,O)
  if T(B,C+25)!=I:A(B,C+25,25,25,N);S(B,C+25);H(.1);A(B,C+25,25,25,O)
  A(B,C,25,25,O)
def A9():
  global a,Z,d,V;V=0;d=0;B=Z*25;C=a*25;A(B,C,25,25,N);S(B,C)
  if T(B-25,C)!=I:A(B-25,C,25,25,N);S(B-25,C);H(.1);A(B-25,C,25,25,O)
  if T(B,C-25)!=I:A(B,C-25,25,25,N);S(B,C-25);H(.1);A(B,C-25,25,25,O)
  if T(B+25,C)!=I:A(B+25,C,25,25,N);S(B+25,C);H(.1);A(B+25,C,25,25,O)
  if T(B,C+25)!=I:A(B,C+25,25,25,N);S(B,C+25);H(.1);A(B,C+25,25,25,O)
  A(B,C,25,25,O)
def C(x,y,color):return T(x,y)!=color
def AA():
  global D,V,U,d,c,G,F,E,q
  while q==w:
    if C(D-2,E-3,B)and C(D-2,E-3,R)and C(D+17,E-3,B)and C(D+17,E-3,R):
      if L(1):E-=1
    if C(D-3,E-2,B)and C(D-3,E-2,R)and C(D-3,E+17,B)and C(D-3,E+17,R):
      if L(0):D-=1
    if C(D-2,E+18,B)and C(D-2,E+18,I)and C(D+17,E+18,B)and C(D+17,E+18,I):
      if L(2):E+=1
    if C(D+18,E-2,B)and C(D+18,E-2,I)and C(D+18,E+17,B)and C(D+18,E+17,I):
      if L(3):D+=1
    if L(12):
      if U==0:A4()
    if L(38):
      if V==0:A5()
    if U==1:
      c+=1;A6()
      if c>x:A8()
    if V==1:
      d+=1;A7()
      if d>y:A9()
    if C(F-2,G-3,B)and C(F-2,G-3,R)and C(F+17,G-3,B)and C(F+17,G-3,R):
      if L(39):G-=1
    if C(F-3,G-2,B)and C(F-3,G-2,R)and C(F-3,G+17,B)and C(F-3,G+17,R):
      if L(44):F-=1
    if C(F-2,G+18,B)and C(F-2,G+18,I)and C(F+17,G+18,B)and C(F+17,G+18,I):
      if L(51):G+=1
    if C(F+18,G-2,B)and C(F+18,G-2,I)and C(F+18,G+17,B)and C(F+18,G+17,I):
      if L(46):F+=1
    r();H(.01)
  H(1)
def l():
  global j,Q,i;C=0
  while i==100:
    if C==1:
      A(0,0,320,240,M);A(60,15,5,5,k);A(65,10,5,5,k);A(70,10,5,5,n);A(70,5,5,5,N);A(75,10,5,5,N);A(70,15,5,5,N);A(0,180,320,10,o);A(0,190,320,60,p);h(' O    MATHS',25,20,5,B);h('B MBER',25,20,5,n);h('By RockingChair',96,209,3,R);D=0
      while D!=320:A(D,160+z(0,10),5,20,o);D+=8
    if L(1):Q-=1;H(.2)
    elif L(2):Q+=1;H(.2)
    if j!=Q or C<=2:
      A(0,50,320,90,M)
      if Q%3==0:K('→ Jouer',100,80,B,M)
      else:K('Jouer',100,80,B,M)
      if Q%3==1:K('→ Commandes',100,100,B,M)
      else:K('Commandes',100,100,B,M)
      if Q%3==2:K('→ Quitter',100,120,B,M)
      else:K('Quitter',100,120,B,M)
    if L(4)or L(52):
      if Q%3==0:s();i=0
      elif Q%3==1:A3()
      elif Q%3==2:raise BaseException('Aurevoir ! :)')
    H(.01);C+=1
    if C>=2:j=Q
u=0
while u==0:u=1;l()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.