chute_bloodandtears.py

Created by rockingchair1196

Created on April 16, 2025

4.89 KB

Hey ! Je suis RockingCha1r, et je vous présente mon premier mod !

Chute : Blood and Tears!

Une version optimisée pour le speedrun, de difficulté beaucoup plus élevée, du jeu Chute, créée par Antarctus.

Tous les niveaux ont été refaits, et de nouveaux vont bientôt être ajoutés ! Merci de jouer à mon mod ! Pour m'envoyer votre score et le mettre dans le classement, envoyez-moi un mp avec screen à l'appui de votre temps sur discord à RockingCha1r !

Vous voulez regarder le code du jeu ? Vous pouvez essayer la version non-optimisée, avec un code bien plus lisible, ici

Classement

Varmule : 28.617s

RockingCha1r : 33.308s

L'ascenseur : 43.705s


_B=False
_A=True
from kandinsky import*
from ion import*
from time import*
backColor=0,0,0
plateforms_color=0,0,150
colorenemy=0
death_color=0,0,0
level=0
class Entity:
  def __init__(self,x,y,width,height,speed,ma=_A):self.x=x;self.y=y;self.width=width;self.height=height;self.speed=speed;self.move_alone=ma;self.chute=0;self.gx=self.x+int(self.width/2);self.gy=self.y+self.height;self.dead=_B;self.drawing=[]
  def set_drawing_inverse(self):
    self.drawing_inverse=[None]*len(self.drawing)
    for i in range(len(self.drawing)):j=self.drawing[i];self.drawing_inverse[i]=[self.width-j[0]-j[2],j[1],j[2],j[3],j[4]]
  def contact(self,x1,y1,x2,y2):
    if self.x<=x1<=self.x+self.width or self.x<=x2<=self.x+self.width:
      if self.y<=y1<=self.y+self.height or self.y<=y2<=self.y+self.height:return _A
    return _B
  def step(self):
    x=self.x;y=self.y;self.move()
    if self.x!=x or self.y!=y or len(shoot):fill_rect(x,y,20,30,backColor);self.draw()
  def move(self):
    global level,colorenemy
    if self.chute:
      if self.chute>0:
        if self.tomber():self.y+=self.chute;self.chute+=1
        else:self.y=plateforms[self.get_plateform()][1]-self.height
        if self.y>222:self.dead=_A
      else:self.y+=self.chute;self.chute+=1
    if self.move_alone:
      self.x+=self.speed
      if self.tomber():self.speed*=-1;self.x+=self.speed
    else:
      x=keydown(3)-keydown(0)
      if x:self.speed=abs(self.speed)*x;self.x+=self.speed
      if keydown(KEY_UP)and not self.tomber():self.y=plateforms[self.get_plateform()][1]-self.height;self.chute=-10
      if not self.tomber():
        if self.contact(points[1][0],points[1][1],points[1][0]+20,points[0][1]+5):colorenemy=colorenemy*2+1;level+=1;self.dead=_A
    if self.tomber()and self.chute==0:self.chute=1
  def tomber(self):
    self.gx=self.x+int(self.width/2);self.gy=self.y+self.height
    for i in plateforms:
      if self.gy<=i[1]<=self.gy+self.chute:
        if i[0]<=self.gx<=i[0]+i[2]:return _B
    return _A
  def get_plateform(self):
    if not self.tomber():
      for i in plateforms:
        if self.gy<=i[1]<=self.gy+self.chute:
          if i[0]<=self.gx<=i[0]+i[2]:return plateforms.index(i)
  def draw(self):
    if self.speed<=0:
      for i in self.drawing:fill_rect(self.x+i[0],self.y+i[1],i[2],i[3],i[4])
    else:
      for i in self.drawing_inverse:fill_rect(self.x+i[0],self.y+i[1],i[2],i[3],i[4])
def draw_all_plateforms(color):
  for i in plateforms:fill_rect(i[0],i[1],i[2],i[3],color)
def draw_all_entities():
  for i in entities:i.move();i.draw()
def death_animation():
  for y in range(11):
    for x in range(16):fill_rect(x*20,y*20,20,24,death_color);sleep(.003)
points=[]
def draw_all_points():fill_rect(points[0][0],points[0][1]-5,20,5,(255,150,100));fill_rect(points[1][0],points[1][1]-5,20,5,(100,100,255))
maps=[[[[10,200],[290,200]],[],[[10,200,300,10]],'           CHUTE:\n         Blood and Tears'],[[[0,200],[300,50]],[[60,130,20,30,5]],[[0,200,40,10],[40,160,40,10],[20,110,20,10],[100,100,20,10],[180,80,20,10],[280,50,40,10]]],[[[0,200],[300,50]],[[60,110,20,30,4],[60,50,20,30,5]],[[0,200,40,10],[40,150,50,10],[280,50,40,10],[0,120,20,10],[40,80,50,10],[200,70,20,10]],"In this game, you can't shoot"],[[[0,200],[300,80]],[[120,170,20,30,10],[180,50,20,30,10],[20,110,20,30,10]],[[0,200,320,10],[0,80,320,10],[0,140,320,10],[300,180,20,10],[0,120,20,10]]],[[[0,200],[0,140]],[[110,170,20,30,7],[270,170,20,30,7],[180,110,20,30,6],[30,110,20,30,7]],[[0,200,140,10],[170,200,150,10],[0,140,140,10],[170,140,150,10],[300,170,20,10]]]]
def spawn(level):
  global avatar,entities,plateforms,shoot,points,txt,run;fill_rect(0,0,320,222,backColor);shoot=[]
  if level==len(maps):run=_B;return
  map=maps[level];points=map[0];plateforms=map[2];avatar=Entity(points[0][0],points[0][1]-30,20,30,10,_B);avatar.drawing=[(3,0,17,30,(255,0,0)),(0,3,12,10,(200,200,200))];avatar.set_drawing_inverse();entities=[avatar]
  for i in map[1]:entities+=[Entity(i[0],i[1],i[2],i[3],i[4])];entities[-1].drawing=[(3,0,17,30,(0,255,0)),(0,3,12,10,(200,200,200))];entities[-1].set_drawing_inverse()
  if len(map)==4:draw_string(map[3],20,20,(150,)*3,backColor)
  avatar.draw()
spawn(level)
time_start=monotonic()
run=_A
while run:
  if avatar.dead:death_animation();spawn(level)
  for i in range(len(entities)-1,0,-1):
    for j in range(len(shoot)-1,-1,-1):
      if entities[i].contact(shoot[j][0]-5,shoot[j][1]-5,shoot[j][0]+5,shoot[j][1]+5):fill_rect(entities[i].x,entities[i].y,20,30,backColor);fill_rect(shoot[j][0]-5,shoot[j][1]-5,10,10,backColor);del entities[i];del shoot[j];break
  for i in entities:i.step()
  for i in entities[1:]:
    if i.contact(avatar.x,avatar.y,avatar.x+avatar.width,avatar.y+avatar.height):avatar.dead=_A
  draw_all_points();draw_all_plateforms(plateforms_color);sleep(.05)
a='Verify = '+str((monotonic()-time_start)*round(colorenemy)*2)
print(str(a))
print('Gagne !')
print('Record : 28.617s')
print('Temps:')
print(round(monotonic()-time_start,3),' s')

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.