zozibou.py

Created by systeme-eratz

Created on January 18, 2024

6.61 KB

Evitez les mocassins et les Z volants, symboles d’un capitalisme révolu! L’avenir de la mère patrie repose sur vos épaules, camarade. ⚒

Kojiverse Productions


## Zozibou Part.I - Kojiverse Productions
l=[]
l1=[]
##import
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 *;from micropython import *
##shortcuts
kbd_intr(KEY_LOG);k=keydown;fl=fill_rect;dr=draw_string;dl=draw_line
##colors
ccl={"background":color(150,100,255),22:color(50,50,50),0:color(0,0,0),255:color(255,255,255),200:color(255,0,0),20:color(0,255,0),2:color(0,0,255),"or":color(255,230,100)}
##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
  def move(self):
    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:self.is_up=1
    if 1<=self.is_up<self.max_jump:self.is_up+=1;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          
    
  
  def render(self):
    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[0])
    fl(self.x-neg((int(self.t[0]/2)-5),render_dir),self.y+self.t[1]-10,neg(13,render_dir),10,ccl[0])
#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,(67,39,56))
    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,(67,39,56))
#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))
#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),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,(67,39,56))
#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()
fl(0,0,333,333,(0,0,0))
fill_rect(100,50,100,10,(255,0,0))
fill_rect(100,50,10,100,(255,0,0))
fill_rect(100,100,100,10,(255,0,0))
fill_rect(100,150,100,10,(255,0,0))
fill_rect(140,50,10,100,(255,0,0))
draw_string("+++ Ersatz d'Eratz studio +++",50,160,(255,0,0),(0,0,0),1)
sleep(3)


##def
def soleil():fl(0,0,40,40,(248, 132, 24));fl(0,0,39,41,(248, 132, 24));fl(0,0,41,39,(248, 132, 24))
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)


p=4
p1=4
spawner_z(p1)
spawner(p)

##pont
bridge_render()
##main
s=0
while True:
  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]:
    print("game_over")
    p=4;p1=0;s=0;
    l=[]
    l1=[]
    spawner(4)
    j1.x=100
  if k(KEY_ZERO):break  
  sleep(0.03)
  s+=0.02
  j1.v=int(s)+1
  if int(j1.v)==20:
    p+=2
    s=0;spawner(2)
    if p1>1:
      p1+=2;spawner_z(2)
  if p==6:
    p=4;
    p1+=2
    spawner_z(2)
##break
input("\n\n\n\tunlaunched\n\n[press OK]")

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.