zozibou2.py

Created by systeme-eratz

Created on June 26, 2023

11.5 KB

Le but du jeu est simple : survivre le plus longtemps !

Commandes : Se déplacer : flèches, Sauter : OK, Pouvoir spécial : Retour.

Bon jeu,

Kojiverse Productions


## Zozibou Part.II - Kojiverse Productions
#reboot = True  # !!!
#pres = True  # !
l=[]
l1=[]
##import
SAVEFILE = "zozibou_2.sav"
high_score,last_score = 0,0
is_omega=True
from random import *;from matplotlib.pyplot import *;from math import *;from kandinsky import *;from ion import *;from os import *;from random import *;from time import *
try:from micropython import *
except:is_omega = False
if not is_omega:raise ImportError ("ce jeu necessite Omega pour fonctionner ! ")
else:
  def del_prog():
    if is_prog():
      remove(SAVEFILE)  
  def save_prog(a,b):
    with open(SAVEFILE,"w") as f:
      f.truncate(0)
      f.write("%d\n%d"%(a,b))

  def is_prog():
    if SAVEFILE in listdir():return True
    return False

  def load_prog():
    with open(SAVEFILE,"r") as f:
      global high_score
      global last_score
      high_score = int(f.readline())
      last_score = int(f.readline())
#      print(high_score,last_score)    
##shortcuts
kbd_intr(KEY_XNT)
k=keydown;fl=fill_rect;dr=draw_string;dl=draw_line
##colors
ccl={"background":color(10,0,0),  22:color(22,22,22),  0:color(255,255,255),  255:color(255,255,255),  200:color(255,0,0),  20:color(0,255,0),  2:color(0,0,255),  "or":color(50,0,0),"pull":color(189, 135, 136),"ch":color(67,39,56),}
##classe ecran
class Screen:
  def render(self):
    fl(0,0,333,160,ccl["background"])
    soleil()
##classe joueur
class Player:
  def __init__(self):
    self.x,self.y = 120,90;self.dir_1 = "right";self.dir_2 = None;self.t=[20,70];self.is_up=0
    self.max_jump=8
    self.v=10
    self.is_ac=False
  def move(self):
    if k(KEY_HOME):input("\n\ten pause!\n[press OK to continue]")
    if k(KEY_RIGHT) and self.x-int(self.t[0]/2)<310:self.x+=10;self.dir_1="right"
    if k(KEY_LEFT) and self.x-int(self.t[0]/2)>5:self.x-=10;self.dir_1="left"
    if k(KEY_OK) and self.is_up==0:
      if k(KEY_DOWN):
        self.tatata=0.8
      else:self.tatata=1
      self.is_up=1

    if 1<=self.is_up<self.max_jump:self.is_up+=self.tatata;self.y-=10
    if self.is_up>=self.max_jump and self.y<90:self.y+=10
    if self.y==90:self.is_up=0          
    if k(KEY_BACK) and int(cTime>2) and not self.is_ac:
      self.is_ac=True
    if self.y<90 and not self.is_up:self.y+=10
  def render(self,cry=False):
    if self.dir_1=="right":render_dir = ""
    else:render_dir = "-" 
#corps - (248,170,136)
#    fl(self.x-int(self.t[0]/2),self.y,self.t[0],self.t[1],(255,0,0))
    fl(self.x-int(self.t[0]/3),self.y,int(self.t[0]/1.5),int(self.t[1]/2),(248,170,136))
    fl(self.x-int(self.t[0]/4),self.y+int(self.t[1]/2),int(self.t[0]/2),int(self.t[1]/2),(248,170,136))
#chaussures
    fl(self.x-int(self.t[0]/2)+5,self.y+self.t[1]-15,int(self.t[0]/2),10,ccl["ch"])
    fl(self.x-neg((int(self.t[0]/2)-5),render_dir),self.y+self.t[1]-10,neg(13,render_dir),10,ccl["ch"])
#jupe
    fl(self.x-int(self.t[0]/3),self.y+int(self.t[1]/2)-2,int(self.t[0]/1.5),2,ccl[0])
    fl(self.x-int(self.t[0]/3)-2,self.y+int(self.t[1]/2),int(self.t[0]/1.5)+4,5,ccl[0])    
    fl(self.x-int(self.t[0]/3)-4,self.y+int(self.t[1]/2)+5,int(self.t[0]/1.5)+8,10,ccl[0])    
#pull - (67,39,56)
    fl(self.x-int(self.t[0]/3),self.y+int(self.t[1]/2)-20,int(self.t[0]/1.5),20,ccl["pull"])
    fl(self.x-neg((int(self.t[0]/2)-5),render_dir),self.y+int(self.t[1]/2)-18,neg(int((self.t[0]/1.5)),render_dir),10,ccl["pull"])
#visage
    fl(self.x+neg((int(self.t[0]/2)-5),render_dir),self.y+5,2,2,ccl[2])
    fl(self.x+neg((int(self.t[0]/2)-3),render_dir),self.y+7,2,2,(248,170,136))
    if cry:
          fl(self.x+neg((int(self.t[0]/2)-5),render_dir),self.y+5,2,2,(0,0,0))
          fl(self.x+neg((int(self.t[0]/2)-5),render_dir),self.y+7,2,7,ccl[2])

#sac
    ## demander a lys les couleurs de son sac lol
    #fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12,-neg(15,render_dir),18,"green")
    fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12,-neg(15,render_dir),3,'red')
    fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12+3,-neg(15,render_dir),3,'orange')
    fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12+6,-neg(15,render_dir),3,"yellow")
    fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12+9,-neg(15,render_dir),3,"green")
    fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12+12,-neg(15,render_dir),3,"blue")
    fl(self.x+int(neg((int(self.t[0]/2)-5),render_dir)),self.y+int(self.t[1]/2)-12+15,-neg(15,render_dir),3,"purple")    
#18/6 = 3
#bras
    fl(self.x+neg((int(self.t[0]/2)-7),render_dir),self.y+int(self.t[1]/2)-18,-neg(int((self.t[0]/3)),render_dir),30,(248,170,136))    
    fl(self.x+neg((int(self.t[0]/2)-7),render_dir),self.y+int(self.t[1]/2)-18,-neg(int((self.t[0]/3)),render_dir),20,ccl["pull"])
#cheveux - (240,209,114)
    fl(self.x-int(self.t[0]/3)-1,self.y-2,int(self.t[0]/1.5)+2,5,(240,209,114))
    fl(self.x-neg((int(self.t[0]/3)+5),render_dir),self.y,neg(int(self.t[0]/1.5),render_dir),20,(240,209,114))

  def globall(self):
    self.move();self.render()


class Mocassin:
  def __init__(self):
    self.y=150
    self.dir=randint(1,2)
    if self.dir==1:self.x=randint(-200,0)
    else:self.x=randint(320,520)
    
  def move(self):
    if self.dir==1:self.x+=j1.v
    else:self.x-=j1.v
  def render(self):
    fl(self.x,self.y,27,5,(88,41,0));fl(self.x,self.y+5,30,5,(88,41,0));fl(self.x+10,self.y-2,5,10,(88,41,0))
  
  def globall(self):
    self.move();self.render()

class Z:
  def __init__(self):
    self.y=50
    
    self.dir=randint(1,2)
    if self.dir==1:self.x=randint(-200,0)
    else:self.x=randint(320,520)
    
  def move(self):
    if self.dir==1:self.x+=j1.v*2
    else:self.x-=j1.v*2
    
  def render(self):
    dl(self.x,self.y,self.x+20,self.y,ccl[2])
    dl(self.x,self.y+20,self.x+20,self.y+20,ccl[2])
    dl(self.x+20,self.y,self.x,self.y+20,ccl[2])
  def globall(self):
    self.move();self.render()
  
##assignement des classes
screen=Screen()
j1=Player()
z=Z()
def rainbow():
  fl(0,0,333,37,"red");fl(0,37,333,37,"orange");fl(0,37*2,333,37,"yellow");fl(0,37*3,333,37,"green");fl(0,37*4,333,37,"blue");fl(0,37*5,333,37,(104,40,120))
def logo_ees(t=2):cl=(0,0,0);rainbow();fill_rect(100,50,100,10,cl);fill_rect(100,50,10,100,cl);fill_rect(100,100,100,10,cl);fill_rect(100,150,100,10,cl);fill_rect(140,50,10,100,cl);draw_string("+++ Ersatz d'Eratz studio +++",50,160,cl,"blue",1);sleep(t)
def logo_rs(t=2):fl(0,0,333,333,(40,0,0));fl(19,19,282,182,(0,0,0));dr("RUSSIAN STUFF",85,8,(255,0,0),(40,0,0));fl(20,20,280,60,(255,0,0));fl(20,80,280,60,(0,0,248));dr("RUSSIAN STUFF",85,195,(255,255,255),(40,0,0));fl(20,140,280,60,(255,255,255));dr("'I'm stuff'",90,35,(255,255,255),(255,0,0));dr("'I'm stuff'",90,95,(255,0,0),(0,0,248));dr("'I'm stuff'",90,155,(0,0,248),(255,255,255));sleep(t)
def logo():logo_ees();logo_rs()

def start_screen():
  rainbow();dr("Z O Z | B O U - part.II",35,50,"red","orange");dr("- Autograph Boy's Revenge -",20,37*2+5,"orange","yellow");dr("a game by Ersatz d'Ersatz studio",50,37*3+15,"yellow","green",1);dr("     and Russian Stuff",50,37*4+5,"green","blue",1)
  e = [104, 40, 120];c = [0, 0, 248]
  while not (k(KEY_OK) or k(KEY_ZERO)):
    dr("press [OK] to start",50,37*5+5,(c[0],c[1],c[2]),(104, 40, 120));c[0]+=13;c[1]+=5;c[2]-=16  
    if c==e:c=[0,0,248];sleep(0.15)
    sleep(0.15)

def beggin():
  if not is_prog():
    rainbow();dr("cette loi c'est la legalisation\n de la pedophilie ! ",5,5,"purple","red",1);dr("l'homosexualite est une a-bo-mi-na-tion !",5,37+5,"red","orange",1);dr("ce n'est pas naturel",5,37*2+5,"orange","yellow",1);dr("l'amalgame est facile ;\n homo c'est l'abomination",5,37*3+5,"yellow","green",1);dr("ca s'propage en fait, \n c'est comme une maladie qui s'propage",5,37*4+5,"green","blue",1);dr("j'suis pas homophobe ;\n mais j'aime pas les pedes",5,37*5+5,"blue","purple",1)
    sleep(6)        
    k=Player()
    fl(0,0,333,333,(10,0,40))
    bridge_render();k.x=250;k.dir_1="left";k.render(True)
    dr("choquee par le comportement des gros fafs, \n lychka parti affronter Autograph boy\n le maitre de la secte des mocassins\n mais la route est longue et semmee \n d'embuches...\n\n\n\n\n c'est pourquoi lychka devra recourir a \n son nouveau pouvoir...",5,5,(255,255,255),(10,0,40),1)
    sleep(7)
    del k
    input("commandes du jeu : \nse deplacer : croix directionnelle\nsauter : OK\nAntechrist : RETOUR (se teleporte en haut\n en echange d'une reduction du score)\npause : HOME\nreinitialiser la sauvegarde : ON/OFF\n[press OK]")

def waiting_for_game():
  if is_prog():
#    input("load prog : HG : %s"%(high_score))
    load_prog()
    
try:
  if reboot:del_prog();print("progression reboot")
except:pass
def start():
  logo()
  start_screen()
  beggin()
  waiting_for_game()


##def
def aC(x,y):fl(x,y,10,60,(255,0,0));fl(x-20,y+40,50,10,(255,0,0))
def soleil():fl(0,0,40,40,(100,0,0));fl(0,0,39,41,(220,220,220));fl(0,0,41,39,(220,220,220))
def code_preuve(x):
  x=str(x);x=[i for i in x];x.reverse();code=[]
  for i in range(len(x)):code.append("/%d/"%(int(x[i])-(7-666)))  
  return "".join([i for i in code])
def neg(txt,var):return int("{}{}".format(var,txt))
def carre_or(x,y,x1,y1):fl(x,y,x1,y1,ccl["or"]);fl(x+1,y+1,x1-2,y1-2,ccl[22])
def pilier(x):fl(x,201,60,30,ccl[22]);fl(x+1,200,58,30,ccl[22]);carre_or(x+20,170,20,50)
def bridge_render():fl(0,200,333,222,ccl["background"]);fl(0,160,333,40,ccl[22]);dl(0,160,333,160,ccl["or"]);carre_or(5,170,45,20);carre_or(90,170,140,20);carre_or(270,170,45,20);pilier(40);pilier(220)
def bulle_txt(x,y,t1,t2,txt):fl(x,y,t1,t2,(255,255,255));dr(txt,y+5,y+5,ccl[0])
def spawner(n):
  for i in range(n):
    s="m{}".format(len(l)+i+1);s=Mocassin();l.append(s)
def spawner_z(n):
  for i in range(n):
    s="m{}".format(len(l1)+i+1);s=Z();l1.append(s)

try:
  if pres:
    start()
except:
  waiting_for_game()
p=4
p1=4
spawner_z(p1)
spawner(p)

##pont
bridge_render()
##main
s=0
global cTime
cTime=0
print("load save : ",is_prog(),"\n")
while True:
  if get_pixel(0,210)==ccl[255]:
    bridge_render()
  wait_vblank()    
  screen.render()
  j1.globall()
  for i in range(len(l)):
    l[i].globall()
    if l[i]==1:
      if l[i].x>320:
        l[i]=Mocassin()
    else:
      if l[i].x<0:
        l[i]=Mocassin()
  for i in range(len(l1)):
    l1[i].globall()
    if l1[i]==1:
      if l1[i].x>320:
        l1[i]=Z()
    else:
      if l1[i].x<0:
        l1[i]=Z()
    
  if get_pixel(j1.x-int(j1.t[0]/2),j1.y+68)==color(88,41,0) or get_pixel(j1.x+int(j1.t[0]/2),j1.y+68)==color(88,41,0) or get_pixel(j1.x-int(j1.t[0]/2),j1.y)==ccl[2] or get_pixel(j1.x+int(j1.t[0]/2),j1.y)==ccl[2]: 
    if True:
      if cTime>high_score:
        high_score=int(cTime)
      print("\n\nGame over ! \nscore : %s\nhigh score : %s\nlast score : %s\n"%(int(cTime),high_score,last_score));print("code_preuve : %s"%code_preuve(int(cTime)));last_score = int(cTime);save_prog(high_score,last_score)
      p=4;p1=0;s=0;l=[];l1=[];cTime=0;spawner(4);j1.x=100
  if k(KEY_ZERO):break  
  sleep(0.03)
  if j1.is_ac and cTime>2:cTime-=2;aC(j1.x,j1.y);sleep(1);j1.y = -100;j1.is_ac=False
  cTime+=0.05
  dr(str(int(cTime)),5,5,(0,0,0),(220,220,220))
  s+=0.02
  j1.v=int(s)+1
  #print(p,j1.v)
    
  if int(j1.v)==5:
    p+=2;s=0;spawner(2);p1+=2;spawner_z(2)
    if p1>1:p1+=2;spawner_z(2)
  if p>=6:p=4;p1+=2;spawner_z(p1)
  if p1>=6:p1=2;l1=[];spawner_z(p1)
  if k(KEY_ONOFF):del_prog();dr("progression reboot",50,100);sleep(1);p=4;p1=2;s=0;l=[];l1=[];cTime=0;spawner(4);j1.x=100;spawner_z(2)
##break
save_prog(high_score,last_score)
input("\n\n\n\tunlaunched\n\n[press OK]")

# Ersatz d'Eratz Studio & Russian Stuff #
# A game about the real life            #
# to skip intro, put # in 2nd line      #
# to restart prog, dimiss # in 1st line #

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.